
Python Programming Quiz

Quiz
•
Computers
•
University
•
Medium
Omphile Mosingathi
Used 2+ times
FREE Resource
17 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? fruits = ["apple", "banana", "cherry"] for fruit in fruits: print(fruit)
apple banana cherry
apple
banana
cherry
["apple", "banana", "cherry"]
Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given a file `records.txt` with content: Alice,85 Bob,72 Carol,90
What will be the output of the following code? with open('records.txt', 'r') as file:
for line in file: name, grade = line.strip().split(',') print(f"Name: {name}, Grade: {grade}")
Name: Alice, Grade: 85
Name: Bob, Grade: 72
Name: Carol, Grade: 90
Alice,85
Bob,72
Carol,90
Error
Name: Alice, Grade: 85, Bob, Grade: 72, Carol, Grade: 90
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does it mean that lists are mutable in Python?
Lists can be changed after creation
Lists cannot be changed after creation
Lists are always sorted
Lists are immutable
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you open a file for reading in Python?
open('filename', 'w')
open('filename', 'r')
open('filename', 'a')
open('filename', 'x')
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which pattern involves making a guess and checking it against a condition in a list?
Accumulator Pattern
Guess and Check Pattern
Mutability Pattern
Iteration Pattern
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the expression `10 % 3` in Python?
1
2
3
0
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you access the first element of a list named `my_list`?
my_list[1]
my_list[0]
my_list[first]
my_list[-1]
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Python introduction

Quiz
•
University
20 questions
Quiz on Java

Quiz
•
University
15 questions
Data Structure

Quiz
•
University
15 questions
FOP - RECAP CHAP 3

Quiz
•
University
13 questions
Programming Concepts Quiz

Quiz
•
6th Grade - University
15 questions
C programming

Quiz
•
University
15 questions
HCI 584 Python quiz

Quiz
•
University
20 questions
PYTHON FUNCTION

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University