NEW
Font size
WorksheetsProgramming with Karel
Total questions: 22
Worksheet time: 12mins
What is the start function?
A function that starts.
It is the main body of a program, where all other functions are called up.
It is the start of a racing program.
It is another function like all others that can be written with any definition you want.
Which function will allow Karel to spin in circle?
How familiar are you with computer programming?
I really don't understand programming?
I feel a little more comfortable since our class?
I feel like I already know most things about programming?
I am a pro and ready to go work for Google, Apple or some other major programming company.
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 another reason we use functions?
To help make things in programming more complex.
to repeat code more frequently and make it harder to others to know what we are doing.
To avoid repeating code and make it more readable.
To help fight against galactic invaders and keep cats out of Karel's world.
How much wood could a woodchuck chuck, if a wood chuck could program on a computer?
No way to know.
Programming will not help a woodchuck.
Woodchuck's should learn programming.
Basically the same amount as always.
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
In the following code snippet, how many times is the turnRight function called and how many times is it defined?
Called 1 time, defined 1 time
Called 1 time, defined 3 times
Called 3 times, defined 1 time
Called 3 times, defined 3 times
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
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
Which general while loop definition is written correctly?
while (x is true) {
//code
}
if (i < 5) {
//code
}
while (var i = 0; i < count; i++) {
//code
}
while (condition) {
//code
}
Which of the following are control structures:
- "if" function
- "if/else" function
- "while" function
- "for" function
- only
- and 2.
- 3. and 4.
all of them
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 take all the tennis balls where Karel is standing if there are any there.
Karel should end up with no tennis balls on that spot.
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 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
