wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Karel Structures (Review)

Total questions: 72

Worksheet time: 36mins

Name
Class
Date
1.

Fill in the blank: For loops let Karel repeat a section of code a ______ number of times.

a)

fixed

b)

random

c)

infinite

d)

variable

2.

Fill in the blank: A For Loop is used to ________.

a)

Repeat a fixed number of times

b)

Store data permanently

c)

Display output on the screen

d)

Accept user input

3.

What is the correct syntax for a for loop that executes code a specific number of times?

a)

for i in range(count):

b)

while i < count:

c)

repeat count times:

d)

for count in range(i):

4.

Fill in the blank: The code inside the for loop 'for i in range(count):' will execute ______ times.

a)

count

b)

count+1

c)

count-1

d)

infinite

5.

Look at the code below: # This places ten balls down for i in range(10): put_ball() What does this code do?

a)

A) Places ten balls down

b)

B) Places one ball down

c)

C) Places five balls down

d)

D) Does nothing

6.

Fill in the blank: The function put_ball() is called ______ times in the given for loop.

a)

10

b)

5

c)

20

d)

15

7.

What does this code do?

a)

A) Places one ball down

b)

B) Places ten balls down

c)

C) Places one hundred balls down

d)

D) Places one thousand balls down

8.

Fill in the blank: The function 'put_ball()' is called ______ times in this loop.

a)

100

b)

10

c)

50

d)

200

9.

Read the following code and answer the question: # This places one hundred balls down for i in range(100): put_ball()

a)

True

b)

False

10.

What is a mistake in our program called? Fill in the blank: A mistake in our program is called a _______.

a)

bug

b)

loop

c)

variable

d)

function

11.

If Karel runs into a wall, what is this called?

a)

A feature

b)

A bug

c)

A crash

d)

A command

12.

Is Karel's front clear?

a)

True

b)

False

13.

Is Karel facing east?

a)

True

b)

False

14.

Fill in the blank: A conditional is a function that returns a ________ answer.

a)

true/false

b)

numeric

c)

string

d)

multiple choice

15.

What is the Karel conditional that checks if the front is clear?

a)

front_is_clear()

b)

left_is_clear()

c)

right_is_blocked()

d)

front_is_blocked()

16.

What is the Karel conditional that checks if the front is blocked?

a)

front_is_blocked()

b)

front_is_clear()

c)

left_is_blocked()

d)

right_is_blocked()

17.

What is the Karel conditional that checks if the left is clear?

a)

left_is_clear()

b)

front_is_clear()

c)

right_is_clear()

d)

no_beepers_present()

18.

What is the Karel conditional that checks if the left is blocked?

a)

left_is_blocked()

b)

front_is_blocked()

c)

right_is_blocked()

d)

left_is_clear()

19.

What is the Karel conditional that checks if the right is clear?

a)

right_is_clear()

b)

front_is_clear()

c)

left_is_clear()

d)

no_beepers_present()

20.

What is the Karel conditional that checks if the right is blocked?

a)

right_is_blocked()

b)

front_is_blocked()

c)

left_is_blocked()

d)

no_beepers_present()

21.

What is the Karel conditional that checks if balls are present?

a)

balls_present()

b)

no_balls_present()

c)

balls_absent()

d)

is_ball_missing()

22.

What is the Karel conditional that checks if no balls are present?

a)

no_balls_present()

b)

balls_present()

c)

no_beepers_present()

d)

beepers_present()

23.

What is the Karel conditional that checks if Karel is facing north?

a)

facing_north()

b)

front_is_clear()

c)

beepers_present()

d)

left_is_clear()

24.

What is the Karel conditional that checks if Karel is facing south?

a)

facing_south()

b)

facing_north()

c)

front_is_clear()

d)

left_is_blocked()

25.

What is the Karel conditional that checks if Karel is facing east?

a)

facing_east()

b)

front_is_clear()

c)

beepers_present()

d)

left_is_clear()

26.

What is the Karel conditional that checks if Karel is facing west?

a)

facing_west()

b)

facing_east()

c)

front_is_clear()

d)

left_is_blocked()

27.

Fill in the blank: The syntax for an if statement in Python is 'if _____: # code'.

a)

condition

b)

variable

c)

loop

d)

function

28.

Refer to the code example below: if front_is_clear(): move() What does this code do?

a)

Moves only if the front is clear

b)

Moves regardless of the front

c)

Stops if the front is clear

d)

Turns left if the front is clear

29.

What is the purpose of the 'else' block in an if/else statement?

a)

To run code if the condition is true

b)

To run code if the condition is false

c)

To end the program

d)

To repeat the code

30.

Fill in the blank: In an if/else statement, the code inside the 'if' block runs only if the ______ is true.

a)

condition

b)

loop

c)

variable

d)

function

31.

Refer to the following code snippet: if front_is_clear(): move() else: turn_left() What will happen if front_is_clear() returns True?

a)

The robot will turn left

b)

The robot will move forward

c)

The robot will stop

d)

The robot will move backward

32.

If front_is_clear() returns False, the robot will _______.

a)

turn left

b)

move forward

c)

stop and wait

d)

pick up an object

33.

Refer to the following code snippet: if front_is_clear(): move() else: turn_left()

a)

True

b)

False

34.

Why do if statements and if/else statements let Karel handle different types of worlds?

a)

They allow Karel to make decisions based on conditions

b)

They make Karel run faster

c)

They help Karel draw pictures

d)

They are used for decoration

35.

Fill in the blank: We went from solving very specific problems, and now can solve more ______ problems.

a)

general

b)

difficult

c)

random

d)

simple

36.

Fill in the blank: While Loops ______ as long as the condition is true.

a)

repeat

b)

stop

c)

pause

d)

skip

37.

What does the following code structure represent?

while front_is_clear():

move()

a)

For loop

b)

While loop

c)

If statement

d)

Function definition

38.

What type of loop is used in this code?

a)

For loop

b)

While loop

c)

Do-while loop

d)

Infinite loop

39.

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.

a)

front_is_clear()

b)

move()

c)

while

d)

clear_front()

40.

This code performs a specific function. What does it do?

a)

It calculates the sum of two numbers.

b)

It sorts a list in ascending order.

c)

It prints 'Hello, World!' to the console.

d)

It finds the maximum value in an array.

41.

Fill in the blank: SuperKarel has ________ and turn_around() already defined.

a)

turn_right()

b)

turn_left()

c)

move()

d)

pick_beeper()

42.

Which of the following functions are already defined for SuperKarel? Select all that apply.

a)

turn_left()

b)

turn_right()

c)

move()

d)

turn_around()

43.

According to the information about SuperKarel, which commands can be called without having to define them first?

a)

turn_left() and turn_right()

b)

turn_right() and turn_around()

c)

turn_around() and move()

d)

move() and turn_left()

44.

Fill in the blank: SuperKarel already knows the commands ________ and ________, so we do not need to define them first.

a)

turn_right(), turn_around()

b)

move(), put_beeper()

c)

pick_beeper(), turn_left()

d)

move(), turn_left()

45.

Fill in the blank: The command to move SuperKarel forward is _________.

a)

move()

b)

forward()

c)

step()

d)

go()

46.

The command to make SuperKarel put a ball down is _________.

a)

put_ball()

b)

drop_ball()

c)

place_ball()

d)

set_ball()

47.

The command to make SuperKarel pick up a ball is _________.

a)

take_ball()

b)

pick_ball()

c)

grab_ball()

d)

get_ball()

48.

These are the commands SuperKarel knows. Fill in the blank: The command to make SuperKarel turn left is _________.

a)

turn_left()

b)

turn_right()

c)

move()

d)

take_ball()

49.

The command to make SuperKarel turn right is _________

a)

turn_right()

b)

turn_left()

c)

move()

d)

pick_beeper()

50.

The command to make SuperKarel turn around is _________

a)

turn_around()

b)

turn_left()

c)

move()

d)

pick_beeper()

51.

What does the following code do? if front_is_clear(): move()

a)

Moves forward if the front is clear

b)

Moves backward if the front is clear

c)

Always moves forward

d)

Does nothing

52.

What does the 'A' in API stand for?

a)

Application

b)

Access

c)

Advanced

d)

Automated

53.

What does the 'P' in API stand for?

a)

Programming

b)

Protocol

c)

Process

d)

Package

54.

What does the 'I' in API stand for?

a)

Interface

b)

Internet

c)

Integration

d)

Instruction

55.

Fill in the blank: An API is a set of tools for building ______ (programs).

a)

software

b)

hardware

c)

websites

d)

machines

56.

Which of the following best describes a good API?

a)

It makes it harder to develop a program

b)

It makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer

c)

It provides no building blocks

d)

It is only used for hardware development

57.

Karel is an API built in which programming language to make it easier to build cool programs quickly?

a)

Java

b)

Python

c)

C++

d)

JavaScript

58.

The Karel API abstracts away the complex details involved in getting Karel the dog to move across the _______.

a)

screen

b)

keyboard

c)

room

d)

cloud

59.

What is the main difference between the SuperKarel API and the Karel API?

a)

SuperKarel API is completely different

b)

SuperKarel API is the same as the Karel API, with some new additions

c)

SuperKarel API has fewer features than Karel API

d)

SuperKarel API is only for advanced users

60.

The SuperKarel API abstracts away the details involved in getting Karel to ________ and ________.

a)

turn right; turn around

b)

move forward; pick beeper

c)

turn left; put beeper

d)

jump; dance

61.

Fill in the blank: The command to make SuperKarel move forward is _________.

a)

move()

b)

forward()

c)

step()

d)

go()

62.

Fill in the blank: The command to make SuperKarel put a ball down is _________.

a)

put_ball()

b)

drop_ball()

c)

place_ball()

d)

set_ball()

63.

Fill in the blank: The command to make SuperKarel pick up a ball is _________.

a)

take_ball()

b)

pick_ball()

c)

grab_ball()

d)

collect_ball()

64.

Fill in the blank: The command to make SuperKarel turn left is _________.

a)

turn_left()

b)

turn_right()

c)

move()

d)

pick_beeper()

65.

Fill in the blank: The command to make SuperKarel turn right is _________.

a)

turn_right()

b)

turn_left()

c)

move()

d)

pick_beeper()

66.

Fill in the blank: The command to make SuperKarel turn around is _________.

a)

turn_around()

b)

turn_left()

c)

move()

d)

pick_beeper()

67.

Fill in the blank: The command to make Karel move forward is _________.

a)

move()

b)

step()

c)

forward()

d)

go()

68.

Fill in the blank: The command to make Karel put a ball is _________.

a)

put_ball()

b)

drop_ball()

c)

place_ball()

d)

set_ball()

69.

Fill in the blank: The command to make Karel take a ball is _________

a)

take_ball()

b)

grab_ball()

c)

pick_ball()

d)

collect_ball()

70.

Fill in the blank: The command to make Karel turn left is _________.

a)

turn_left()

b)

move()

c)

pick_beeper()

d)

turn_right()

71.

Fill in the blank: __________ is an important part of an API.

a)

Documentation

b)

Encryption

c)

Animation

d)

Decoration

72.

Documentation provides programmers with:

a)

instructions and information about the code

b)

extra lines of code for execution

c)

a way to compile programs

d)

a method to debug automatically