
Python Programming Quiz
Authored by Omphile Mosingathi
Computers
University
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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]
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
quizz tkinter
Quiz
•
11th Grade - University
15 questions
Coding club Summit Online Quiz
Quiz
•
University
20 questions
Infrastructure (Network)
Quiz
•
University
20 questions
C Quest 2.0
Quiz
•
University
16 questions
Python
Quiz
•
University
20 questions
PHP First Internal Practical Viva
Quiz
•
University
20 questions
Hash
Quiz
•
University
17 questions
HTML
Quiz
•
12th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade