Font size
WorksheetsKarel Structures (Review)
Total questions: 72
Worksheet time: 36mins
Fill in the blank: For loops let Karel repeat a section of code a ______ number of times.
fixed
random
infinite
variable
Fill in the blank: A For Loop is used to ________.
Repeat a fixed number of times
Store data permanently
Display output on the screen
Accept user input
What is the correct syntax for a for loop that executes code a specific number of times?
for i in range(count):
while i < count:
repeat count times:
for count in range(i):
Fill in the blank: The code inside the for loop 'for i in range(count):' will execute ______ times.
count
count+1
count-1
infinite
Look at the code below: # This places ten balls down for i in range(10): put_ball() What does this code do?
A) Places ten balls down
B) Places one ball down
C) Places five balls down
D) Does nothing
Fill in the blank: The function put_ball() is called ______ times in the given for loop.
10
5
20
15
What does this code do?
A) Places one ball down
B) Places ten balls down
C) Places one hundred balls down
D) Places one thousand balls down
Fill in the blank: The function 'put_ball()' is called ______ times in this loop.
100
10
50
200
Read the following code and answer the question: # This places one hundred balls down for i in range(100): put_ball()
True
False
What is a mistake in our program called? Fill in the blank: A mistake in our program is called a _______.
bug
loop
variable
function
If Karel runs into a wall, what is this called?
A feature
A bug
A crash
A command
Is Karel's front clear?
True
False
Is Karel facing east?
True
False
Fill in the blank: A conditional is a function that returns a ________ answer.
true/false
numeric
string
multiple choice
What is the Karel conditional that checks if the front is clear?
front_is_clear()
left_is_clear()
right_is_blocked()
front_is_blocked()
What is the Karel conditional that checks if the front is blocked?
front_is_blocked()
front_is_clear()
left_is_blocked()
right_is_blocked()
What is the Karel conditional that checks if the left is clear?
left_is_clear()
front_is_clear()
right_is_clear()
no_beepers_present()
What is the Karel conditional that checks if the left is blocked?
left_is_blocked()
front_is_blocked()
right_is_blocked()
left_is_clear()
What is the Karel conditional that checks if the right is clear?
right_is_clear()
front_is_clear()
left_is_clear()
no_beepers_present()
What is the Karel conditional that checks if the right is blocked?
right_is_blocked()
front_is_blocked()
left_is_blocked()
no_beepers_present()
What is the Karel conditional that checks if balls are present?
balls_present()
no_balls_present()
balls_absent()
is_ball_missing()
What is the Karel conditional that checks if no balls are present?
no_balls_present()
balls_present()
no_beepers_present()
beepers_present()
What is the Karel conditional that checks if Karel is facing north?
facing_north()
front_is_clear()
beepers_present()
left_is_clear()
What is the Karel conditional that checks if Karel is facing south?
facing_south()
facing_north()
front_is_clear()
left_is_blocked()
What is the Karel conditional that checks if Karel is facing east?
facing_east()
front_is_clear()
beepers_present()
left_is_clear()
What is the Karel conditional that checks if Karel is facing west?
facing_west()
facing_east()
front_is_clear()
left_is_blocked()
Fill in the blank: The syntax for an if statement in Python is 'if _____: # code'.
condition
variable
loop
function
Refer to the code example below: if front_is_clear(): move() What does this code do?
Moves only if the front is clear
Moves regardless of the front
Stops if the front is clear
Turns left if the front is clear
What is the purpose of the 'else' block in an if/else statement?
To run code if the condition is true
To run code if the condition is false
To end the program
To repeat the code
Fill in the blank: In an if/else statement, the code inside the 'if' block runs only if the ______ is true.
condition
loop
variable
function
Refer to the following code snippet: if front_is_clear(): move() else: turn_left() What will happen if front_is_clear() returns True?
The robot will turn left
The robot will move forward
The robot will stop
The robot will move backward
If front_is_clear() returns False, the robot will _______.
turn left
move forward
stop and wait
pick up an object
Refer to the following code snippet: if front_is_clear(): move() else: turn_left()
True
False
Why do if statements and if/else statements let Karel handle different types of worlds?
They allow Karel to make decisions based on conditions
They make Karel run faster
They help Karel draw pictures
They are used for decoration
Fill in the blank: We went from solving very specific problems, and now can solve more ______ problems.
general
difficult
random
simple
Fill in the blank: While Loops ______ as long as the condition is true.
repeat
stop
pause
skip
What does the following code structure represent?
while front_is_clear():
move()
For loop
While loop
If statement
Function definition
What type of loop is used in this code?
For loop
While loop
Do-while loop
Infinite loop
Look at the following code example: while front_is_clear(): move() Fill in the blank: The code will keep executing the move() command as long as the condition ______ is true.
front_is_clear()
move()
while
clear_front()
This code performs a specific function. What does it do?
It calculates the sum of two numbers.
It sorts a list in ascending order.
It prints 'Hello, World!' to the console.
It finds the maximum value in an array.
Fill in the blank: SuperKarel has ________ and turn_around() already defined.
turn_right()
turn_left()
move()
pick_beeper()
Which of the following functions are already defined for SuperKarel? Select all that apply.
turn_left()
turn_right()
move()
turn_around()
According to the information about SuperKarel, which commands can be called without having to define them first?
turn_left() and turn_right()
turn_right() and turn_around()
turn_around() and move()
move() and turn_left()
Fill in the blank: SuperKarel already knows the commands ________ and ________, so we do not need to define them first.
turn_right(), turn_around()
move(), put_beeper()
pick_beeper(), turn_left()
move(), turn_left()
Fill in the blank: The command to move SuperKarel forward is _________.
move()
forward()
step()
go()
The command to make SuperKarel put a ball down is _________.
put_ball()
drop_ball()
place_ball()
set_ball()
The command to make SuperKarel pick up a ball is _________.
take_ball()
pick_ball()
grab_ball()
get_ball()
These are the commands SuperKarel knows. Fill in the blank: The command to make SuperKarel turn left is _________.
turn_left()
turn_right()
move()
take_ball()
The command to make SuperKarel turn right is _________
turn_right()
turn_left()
move()
pick_beeper()
The command to make SuperKarel turn around is _________
turn_around()
turn_left()
move()
pick_beeper()
What does the following code do? if front_is_clear(): move()
Moves forward if the front is clear
Moves backward if the front is clear
Always moves forward
Does nothing
What does the 'A' in API stand for?
Application
Access
Advanced
Automated
What does the 'P' in API stand for?
Programming
Protocol
Process
Package
What does the 'I' in API stand for?
Interface
Internet
Integration
Instruction
Fill in the blank: An API is a set of tools for building ______ (programs).
software
hardware
websites
machines
Which of the following best describes a good API?
It makes it harder to develop a program
It makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer
It provides no building blocks
It is only used for hardware development
Karel is an API built in which programming language to make it easier to build cool programs quickly?
Java
Python
C++
JavaScript
The Karel API abstracts away the complex details involved in getting Karel the dog to move across the _______.
screen
keyboard
room
cloud
What is the main difference between the SuperKarel API and the Karel API?
SuperKarel API is completely different
SuperKarel API is the same as the Karel API, with some new additions
SuperKarel API has fewer features than Karel API
SuperKarel API is only for advanced users
The SuperKarel API abstracts away the details involved in getting Karel to ________ and ________.
turn right; turn around
move forward; pick beeper
turn left; put beeper
jump; dance
Fill in the blank: The command to make SuperKarel move forward is _________.
move()
forward()
step()
go()
Fill in the blank: The command to make SuperKarel put a ball down is _________.
put_ball()
drop_ball()
place_ball()
set_ball()
Fill in the blank: The command to make SuperKarel pick up a ball is _________.
take_ball()
pick_ball()
grab_ball()
collect_ball()
Fill in the blank: The command to make SuperKarel turn left is _________.
turn_left()
turn_right()
move()
pick_beeper()
Fill in the blank: The command to make SuperKarel turn right is _________.
turn_right()
turn_left()
move()
pick_beeper()
Fill in the blank: The command to make SuperKarel turn around is _________.
turn_around()
turn_left()
move()
pick_beeper()
Fill in the blank: The command to make Karel move forward is _________.
move()
step()
forward()
go()
Fill in the blank: The command to make Karel put a ball is _________.
put_ball()
drop_ball()
place_ball()
set_ball()
Fill in the blank: The command to make Karel take a ball is _________
take_ball()
grab_ball()
pick_ball()
collect_ball()
Fill in the blank: The command to make Karel turn left is _________.
turn_left()
move()
pick_beeper()
turn_right()
Fill in the blank: __________ is an important part of an API.
Documentation
Encryption
Animation
Decoration
Documentation provides programmers with:
instructions and information about the code
extra lines of code for execution
a way to compile programs
a method to debug automatically
