Karel Basics
Functions and Syntax
Control Structures
Logic and Concepts
Bonus! (Complete rest of row first)
100

🐢 What command makes Karel move forward one square?

move();

100

✏️ What is the correct syntax for defining a new function named turnRight?

function turnRight() {
    turnLeft();
    turnLeft();
    turnLeft();
}

100

πŸ” Which control structure repeats code a fixed number of times?

a for loop

100

🐞 Why do we use functions in Karel programs?  (3 reasons!)

Functions break down our program into smaller parts, avoid repeating code, and make our program more readable. 

100

πŸ” What is the only food that can never go bad? 

Honey

200

πŸ” Why is this function call invalid?  

Turnleft();

Javascript is case-sensitive; should be turnLeft();

200

πŸ“ž What is the difference between defining and calling a function?

Defining creates it; calling executes it. 

Defining uses the "function" keyword and creates a box; calling is just the name

200

πŸ”„ What is the syntax for a while loop in Karel?  

(put ... in place of executable code)

while (condition) {
    ...
}

200

πŸ”€ What is "top-down design"?

Breaking a problem into smaller parts and solving each one step by step

200

🌎What is the only U.S. state that can be typed in using only one row of a standard β€œQWERTY” keyboard? 

Alaska

300

πŸ” What is wrong with this command:

putball();

JavaScript is case-sensitive; it should be putBall(); in lowerCamelCase

300

πŸ” How many times can you define a function in your program?  How many times can you call a function in your program?

You can only define a function ONCE with the same name.  You can call a function as many times as you want. 

300

🧠 When should you use a for loop instead of a while loop?

Use for when the number of repetitions is known.  Use while when you want to repeat until a condition is false. 

300

🧱 What is a "precondition" and "postcondition" in Karel programming?

Precondition: what must be true before a function runs; Postcondition: what is true after it runs

300

πŸŽ₯ The iconic β€œHollywood” sign originally spelled out what word?

Hollywoodland

400

πŸ’¬ What is the purpose of using comments in your code? What are the types?  Give one example of each type.

To explain code; 

// single-line 

/* multi-line */

400

🧹 Why do we use indentation in our code?

To make the code more readable and to show structure; to show code is in a "box" of a control structure or function.  

All code in a "box" using curly braces {} should be indented by one. 

400

🧰 What’s the difference between a condition and a command in Karel? Give one example of each.

Condition: returns true/false like frontIsClear(); Command: performs an action like move();

400

🧩 What is "abstraction" and how do functions help with it?

Hiding details to focus on the bigger picture; functions let you reuse code without repeating it.  We don't need to know HOW something works to use it. 

400

βš—οΈ What is the only letter not found in the periodic table of elements? 

J

500

🧱 What is an edge case, and why should we test it when programming Karel?

An edge case is an unusual situation usually at the start or end of a algorithm.  We need to write code to handle these cases before or after a loop.  This helps ensure our code works in all scenarios

500

πŸ”€ Which syntax error is in this line: 

function moveTwice() {
    move();
    move()
 }

?

Missing semicolon after second move(); should be move();

500

πŸ’‘ Improve this code with a control structure: 

move();
move();
move();
move();

for (var i = 0; i < 4; i++) {
    move();
}

500

πŸ’ͺ What are the differences between Karel and SuperKarel? Name two commands SuperKarel can use that aren't available in Karel.

SuperKarel has extra commands built in that do not need to be built; turnRight(); and turnAround();

500

πŸ˜‹ Where were Doritos invented?

Casa de Fritos at Disneyland

M
e
n
u