
CS 2 - Python Unit 1
Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Jon Kern
Used 3+ times
FREE Resource
Enhance your content in a minute
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What’s wrong with this code?
def go():
move()
move()
def go():
move()
move()
move()
go()
go()
The go function is called twice
The go function has been defined twice
The go function has a syntax error
go is not a command that Karel understands
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is wrong with this for loop?
for i in range = 5; move()
A. The for loop uses a semicolon(;) instead of colon(:)
B. It should say range(5) instead of range = 5
The for loop is correct
A
B
A and B
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the mystery function do?
def mystery():
while no_balls_present():
move()
Karel moves until it is on a ball
Karel moves once if there is no ball present
Karel moves until it puts down a ball
Karel checks if there is no ball on the current spot and then moves once
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Say Karel is on a location with one tennis ball. After the following code runs, how many tennis balls will there be at that location?
for i in range(3):
if balls_present():
take_ball()
else:
put_ball()
put_ball()
0
1
2
6
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why does a programmer indent their code?
Helps show the structure of the code.
Easier for other people to understand.
In Python, it is used to help determine what parts of a code are included in a code block, such as an if statement or for loop.
All of the above
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Say you want to write a program to have Karel put down 300 tennis balls. Which control structure would you use?
For loop
While loop
If statement
Nested while loop
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs?
move()
putball()
move()
move()
move()
move()
move()
Karel will end on Street 1, Avenue 2
This code won’t run because of a syntax error
Karel will end on Street 1, Avenue 7
Karel will crash into a wall
Create a free account and access millions of resources
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
10 questions
Word basics
Quiz
•
8th - 12th Grade
17 questions
IT Fundamentals Networking
Quiz
•
9th - 12th Grade
10 questions
Complex Sprite Movement
Quiz
•
9th - 12th Grade
10 questions
Chapter 4 - Latihan
Quiz
•
1st - 12th Grade
9 questions
Scratch
Quiz
•
3rd - 9th Grade
15 questions
Photoshop Keyboard Shortcuts & Tools
Quiz
•
8th - 12th Grade
10 questions
Python списки
Quiz
•
10th Grade
15 questions
Digital Etiquette
Quiz
•
4th Grade - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
