WorksheetsKarel Review
Total questions: 37
Worksheet time: 19mins
Why do we use functions in programming?
Break down our program into smaller parts
Avoid repeating code
Make our program more readable
All of the above
How many times should the start function be defined in a program?
0
1
2
However many you like
How many times should the start function be defined in a program?
0
1
2
However many you like
Which of these is a valid Karel command?
move;
MOVE
move();
move()
If Karel is facing South and the code:
turnLeft();
turnLeft();
runs; which direction is Karel facing now?
North
South
East
West
What is a code comment?
A way to teach Karel a new word
A way to give notes to the reader to explain what your code is doing
A message to your teacher in code
A place to write whatever you want in your code
turnLeft();
turnLeft();
turnLeft();
runs; which direction is Karel facing now? Karel is a Cat?
True
False
The code in the picture will move Karel in a square.
True
False
Which code will put Karel in the position shown in second world?
putBall(); putBall(); move(); move();
move(); putBall(); move(); putBall();
putBall(); move(); putBall(); move();
move(); putBall(); putBall(); move();
Is this Function written correctly?
True
False
What is the name of this function?
function
spin()
3 turnLeft();
spin();
Which function will allow Karel to spin in circle?
What is a reason we use functions?
Break down our program into smaller parts.
Because it is more complex.
It looks cool and helps the fight against martians!
Functions are basically Algebra and programmers like Algebra.
What is top down design?
Top down design is a way of designing your program by starting with the biggest problem and breaking it down into smaller and smaller pieces that are easier to solve.
Top down design is a way that you can create designs on a computer to put on a web page
Top down design is a way of designing your programs starting with the individual commands first
Top down design is a way to use loops and classes to decompose the problem
What commands does SuperKarel know that regular Karel does not?
turnLeft() and jump()
turnRight() and jump()
turnAround() and turnRight()
turnAround() and jump()
Which of the following is the correct for loop syntax to make Karel turn left 4 times?
for(var i = 0; i = 4; i++) {
turnLeft();
}
for(var i = 0; i < 4; i++) {
turnLeft();
}
for var i = 0; i < 4; i++
turnLeft();
for(var i = 0, i < 4, i++) {
turnLeft();
}
What is the best way for Karel to move 10 times?
move();
move();
move();
move();
move();
move();
move();
move();
move();
move();
for (var i = 0; i < 10; i++) {
move();
}
move(10);
move10();
Which "if" statement is correctly written?
for (condition) {
//code in here
}
if (condition) {
//code in here
}
if (var i = 0; i < count; i++) {
//code in here
}
if false {
//code in here
}
Why do we use if statements in JavaScript?
To break out of some block of code
To do something only if a condition is true
To do something while a condition is true
To repeat something for a fixed number of times
Why do we use while loops in JavaScript?
To break out of some block of code
To do something if a condition is true
To repeat some code while a condition is true
To repeat something for a fixed number of times
What do we use control structures for in JavaScript?
Control the flow of the program; how the commands execute.
Start our JavaScript program
Store information for later
Teach Karel new commands
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 control structure do you need to use?
For Loop
While Loop
If Statement
If/Else Statement
None of these
You need to write a program that has Karel move 6 times and then put a ball.
Which control structure do you need to use?
Foor Loop
While Loop
If Statement
If/Else Statement
None of these
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?
For Loop
While Loop
If Statement
If/Else Statement
None of these
