Worksheets7th Grade Programing with Karel
Total questions: 26
Worksheet time: 16mins
Which of these is a valid Karel command?
move;
MOVE
move();
move()
What is a street in a Karel world?
A row
A column
A single point
Karel's Position
What is an avenue in a Karel world?
A row
A column
A single point
Karel's position
If Karel starts at Street 1 and Avenue 3 facing East, what street and avenue will Karel be on after this code runs?
move();
move();
move();
turnLeft();
move();
Street 1 and Avenue 3
Street 4 and Avenue 4
Street 2 and Avenue 6
Street 6 and Avenue 2
If Karel is facing North and the code
turnLeft();
turnLeft();
North
East
South
West
How many times should Karel turn left in order to turn right?
1
2
3
4
What can be used to teach Karel to turn right?
Functions
Varibles
Dog Treats
Karel can already turn right
How many times should the start function be defined in a program?
0
1
2
However many times you like
How many times should you call the start function in a program?
0
1
2
however many times you like
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
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 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()
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();
Why do we use if statements in JavaScript?
To break out of some block of code
To do something while a condition is true
To do something only if a condition is true
To repeat something for a fixed number of times
Which general if statement definition is written correctly?
for(condition) {
// code
}
if false {
//code
}
if(var i = 0; i < count; i++) {
//code
}
if(condition) {
//code
}
Why do we use if/else statements in JavaScript?
To repeat something for a fixed number of times
To either do something if a condition is true or do something else
To repeat something while a condition is true
To break out of some block of code
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 timesAnswered 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
Which of the below are examples of control structures?
(I) if
(II) if/else
(III) while
(IV) for
I only
I and II only
III and I only
I, II, III, and IV
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?
If/Else statement
While Loop
For loop
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
None of these
You need to write a program that has Karel put down a tennis ball if the world has dimensions of 1x1.
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
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
Why should a programmer indent their code?
Easier for other people to understand
Helps show the structure of the code
Indenting is a key part of good programming style
All of the above
