NEW
Font size
S
M
L
XL
WorksheetsProgramming with Karel Unit 3 - 3.7 - 3.12 Quiz
Total questions: 23
Worksheet time: 12mins
Name
Class
Date
1.
How do you write a single-line comment?
a)
comment //
b)
++ comment
c)
// comment
d)
** comment
2.
What is a code comment?
a)
A way to teach Karel a new word.
b)
A way to give notes to the reader to explain what your code is doing.
c)
A message to your teacher in code.
d)
A place to write whatever you want in your code.
3.
How do you write a multi-line comment?
a)
/* comment */
b)
// comment
c)
** comment
d)
# comment#
4.
The assumptions we make and what must be true before the function is called is known as?
a)
Precondition
b)
Postcondition
c)
Adaptation
d)
Comments
5.
Each of the following answer choices describes a basketball game. Which answer choice describes the game with the lowest level of abstraction:
a)
The Warriors won by 10 points.
b)
The Warriors had an early lead, but were down by 4 at halftime. They tied it up in the 4th quarter and the game went into overtime. They won by 10 points in overtime.
c)
First, Steph Curry jumped in the air and grabbed the ball. Then he dribbled it three times and passed it to Klay Thompson…
d)
First, Steph Curry flexed his left and right quad muscles at the exact same time, then he flexed each muscle in his fingers…
6.
You need to write a program that has Karel move if the front is clear, but if it isn’t clear, Karel will do nothing.
Which control structure do you need to use?
a)
For Loop
b)
While Loop
c)
If Statement
d)
None of these
7.
Define Abstraction
a)
Breaking a task into smaller tasks.
b)
Drawing a map to show how to reach a destination.
c)
Creating step by step instructions.
d)
Focusing on what is important and ignoring what is unnecessary.
8.
Karel needs to pick up a pile of tennis balls. Which of the following start functions solves the problem at the highest level of abstraction?
a)
Option 1
b)
Option 2
c)
Option 3
d)
Option 4
9.
What commands does SuperKarel know that regular Karel does not?
a)
turnLeft() and jump()
b)
turnRight() and jump()
c)
turnAround() and turnRight()
d)
turnAround() and jump()
10.
Your program has good style when you have broken down the problem in a reasonable way, and made your code clear to others.
a)
True
b)
False
11.
What is the best way for Karel to move 10 times?
a)
move10();
b)
move(10);
c)
Option 3
d)
Option 4
12.
True or False: A For Loop allows Karel to repeat a section of code for a fixed number of times.
a)
True
b)
False
13.
True or False: A Condition is a function that returns a true/false answer.
a)
True
b)
False
14.
Why do we use if statements in JavaScript?
a)
To break out of some block of code.
b)
To repeat something for a fixed number of times.
c)
To do something while a condition is true
d)
To do something only if a condition is true
15.
Which general "if" statement definition is written correctly?
a)
Option 1
b)
Option 2
c)
Option 3
d)
Option 4
16.
Why do we use if/else statements in JavaScript?
a)
To repeat something for a fixed number of times.
b)
To break out of some block of code
c)
To either do something if a condition is true or do something else.
d)
To repeat something while a condition is true.
17.
What does an if/else statement look like?
a)
Option 1
b)
Option 2
c)
Option 3
d)
Option 4
18.
True or False: If Statements and If/Else Statements allow Karel to handle different types of worlds.
a)
True
b)
False
19.
You need to write a program where Karel will take a ball if there is a ball present, otherwise Karel should put down a ball.
Which of the following control structure do you need to use?
a)
For Loop
b)
If Statement
c)
If/Else Statement
d)
None of these
20.
You need to write a program where Karel will put down 6 balls and then move forward one location. Which of the following control sturcture do you need to use?
a)
For Loop
b)
If Statement
c)
If/Else Statement
d)
None of these
21.
A method that is used to repeat code in the program
a)
Debug
b)
Decode
c)
Loop
d)
Comment
22.
Justin is creating a program. He wants to use a loop that will run for only 20 times. Which loop is Justin using?
a)
While
b)
If/else
c)
For
d)
Curley bracket
23.
Writing functions is a practice of abstraction?
a)
True
b)
False
Reset
