Python U2M3 Test

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Jennifer OKeefe
Used 20+ times
FREE Resource
16 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the following for loop code, the variable name is "student" because it can only be called "student" and cannot be replaced with another valid variable name such as "pupil".
students=["Alton", "Hiroto", "Skye", "Tobias"]
for student in students"
print("Hello", student)
True
False
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which code is the best use of Python to iterate through the list "numbers"?
numbers=[7, 1, 5, 8, 0]
for range[5] in numbers:
for int in list:
for number in numbers:
all of the above
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Choose the best representation of the output expected for the following code.
cities=["New York", "Shanghai", "Munich", "Tokyo", "Dubai", "Mexico City", Sao Paulo", Hyderabad"]
for city in cities:
if city.startswith("P"):
print(city)
elif city.startswith("D"):
print(city)
Sao Paolo Dubai
Dubai
Sao Paulo
None of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which code will result in the ltr_cnt=2 for counting the letter "c" found in the following test_string?
test_string='Mexico City'
-
ltr_cnt=test_string.count('c')
ltr_cnt=test_string.count('C')
none of the above
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In Python, range (0,5) is equivalent to the list[0, 1, 2, 3, 4]
True
False
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Choose the best representation of the output expected for the following code.
numbers=" "
for x in range (7)
numbers +=str(x)
print(numbers)
0
7
1234567
0123456
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Choose the best representation of the output expected for the following code.
number=" "
for x in range(2, 8, 2):
numbers+=str(x)
print(numbers)
2
8
2468
246
Create a free account and access millions of resources
Similar Resources on Wayground
13 questions
Python Fundamentals and Programming

Quiz
•
11th - 12th Grade
15 questions
Python and PseudoCode Quiz

Quiz
•
10th Grade - University
20 questions
8525 AQA GCSE 3.2.6 Data Structures

Quiz
•
10th Grade
19 questions
Programming Techniques Survey

Quiz
•
8th - 12th Grade
16 questions
Python Basics

Quiz
•
KG - University
14 questions
year 8 lesson 2 quiz - python

Quiz
•
8th - 10th Grade
17 questions
Python - Quiz

Quiz
•
9th - 11th Grade
20 questions
Python

Quiz
•
12th Grade
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
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th 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