No student devices needed. Know more
27 questions
Karel lives in a grid world. Each point on the grid is marked by a dot, and is a location that Karel can be in. The world has streets and avenues.
The __________ run horizontally
avenue
street
soi
lane
Karel's world has streets and avenues. The _________ run vertically.
avenue
street
soi
lane
Which one is not a command in Karel?
move();
putBall();
takeBall();
turnRight();
Select all that are important things to note when you write a command.
You need to write the command exactly as it appears
You need to match the exact capitalization
Make sure to end every command with a ();
Each command goes on its own line.
Every command should end with a (); This is how Karel can understand the command.
These rules are called the ________.
coding ends
formtax
codetax
syntax
How many commands does Karel know?
10
6
5
4
Which coding is correct?
move();
move();
putBal();
move();
move();
move();
move();
placeBall();
move();
move();
move();
move();
takeBall();
move();
move();
move();
move();
putBall();
move();
move();
We can teach Karel to turn right by defining a function called turnRight() that shows Karel how to turn to the right.
Which one is the correct way to define this function?
function turnRight; {
turnLeft();
turnLeft();
turnLeft();
}
function turnRight() ;{
turnLeft();
turnLeft();
turnLeft();
}
function turnRight() {
turnLeft();
turnLeft();
turnLeft();
}
function turnRight(); {
turnLeft();
turnLeft();
turnLeft();
}
we have a set of commands inside of curly braces. This set of commands is called the ________ body. It is very important to remember that everything Karel is supposed to do when told the command is INSIDE of the curly braces.
What exactly are functions in Karel the Dog?
One way of thinking about functions is to think of them being single commands that Karel knows by a single name
One way of thinking about functions is to think of them being little blocks of commands that Karel knows by a single name
One way of thinking about functions is to think of them being one commands that Karel knows by a specific name
The very first thing we have to decide when creating a function is what to name it. Select all the things we need to remember
The name of a function should always be an action describing the function, just like move() or putBall() are actions.
The name of the function should specifically describe what the function does.
Because it is a name it should start with a capital letter
It can be a silly made up name
Function names must also follow a particular format. Functions whose names are made up of more than one word are always written in a style called Camel Case.
What does that mean?
All words must be capitalized
The first word of a function is lowercase, but all of the other words begin with upper case letters.
Functions should always start with a letter and not contain any other characters besides letters and numbers. What does this mean?
This means that a function name MUST NOT contain spaces
This means that a function name MAY contain spaces
Functions may contain letters and numbers but
may only start with numbers
may only start with letters
After the function has a legal, descriptive name, the next step in creating a function is to _______ and ________ the function.
Which of the following are good function names?
goToEnd()
function one()
superimportantfunction()
climbUpTower()
What are the most important rules for function names?
It is a name you can remember
It starts with a letter and has a nice programming sound
It describes what it does, is in Camel Case, and doesn't have any illegal characters.
It starts with a lowercase letter, has a space and the second word is capitalized
True or False:
Commands may be inserted among your functions
True
False
The start() function is a very special function. All of the commands you wish to execute must go ____________ of the start function, between the curly braces. The commands will be executed in the order that they appear.
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?
1
2
0
As many times you like
If Karel is facing South and the code:
turnLeft();
turnLeft();
runs; which direction is Karel facing now?
West
East
NorthEast
North
Which of the following is incorrect?
putBall()
move();
Takeball();
turnLeft();
True or False Every command must end with {}
True
False
Which of these is a valid Karel command?
move;
move;
move();
MOVE
move()
What command will place a ball down in a spot?
placeBall();
Putball();
putball():
putBall();
If Karel is facing North and the code turnLeft();
turnLeft();
turnLeft();
runs; which direction is Karel facing now?
North
West
East
South
Explore all questions with a free account