Python quiz

Quiz
•
Computers
•
10th Grade - Professional Development
•
Hard
Viraj Yeotikar
Used 26+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which one is NOT a legal variable name?
my_var
Myvar
_myvar
my-var
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the correct syntax to output the type of a variable or object in Python?
print(typeof(x))
print(type(x))
print(typeof x)
print(typeOf(x))
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which method can be used to remove any whitespace from both the beginning and the end of a string?
ptrim()
len()
strip()
trim()
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A while loop in Python is used for what type of iteration?
indefinite
discriminant
definite
indeterminate
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these collections defines a LIST?
["apple", "banana", "cherry"]
{"apple", "banana", "cherry"}
("apple", "banana", "cherry")
{"name": "apple", "color": "green"}
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code snippet:
a = ['foo', 'bar', 'baz', 'qux', 'corge']
while a:
if len(a) < 3:
break
print(a.pop())
print('Done.')
corge
qux
baz
corge
qux
baz
Done.
The snippet doesn’t generate any output.
corge
qux
baz
bar
foo
Done.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Will the print() statement on line 5 be executed in this case:
a = ['foo','bar','baz','qux','corge']
while a:
print(a.pop())
else:
print('Done.')
No
Yes
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Basic Python

Quiz
•
Professional Development
8 questions
Python String Slicing

Quiz
•
University
15 questions
Grade XI test

Quiz
•
5th - 12th Grade
10 questions
Mastering Python String Techniques

Quiz
•
9th - 12th Grade
7 questions
[Python OOP] Inheritance, special function

Quiz
•
12th Grade
10 questions
Web-II-Loop and Function

Quiz
•
University
9 questions
Python Basics Quiz for KS3

Quiz
•
11th Grade - University
10 questions
J277 - 2.2 - Functions in Python

Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade