














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Explore karel programming with this comprehensive question and answer guide. Covering fundamental concepts, commands, and problem-solving techniques, this resource is designed to enhance understanding and proficiency in karel. From basic commands to advanced control structures, this guide provides clear explanations and practical examples to support learners in mastering karel programming. It includes key concepts such as functions, loops, and conditional statements, making it an invaluable tool for students and educators alike. Useful for university and high school students.
Typology: Exams
1 / 22
This page cannot be seen from the preview
Don't miss anything!















Who/What is Karel? .....ANSWER.....Karel is a dog who listens to your commands What do you do with Karel? .....ANSWER.....You move Karel around the world and put down tennis balls Karel Commands .....ANSWER.....move(); turnLeft(); putBall(); takeBall(); Commands have .....ANSWER.....No spaces Exact capitalization (); at end Rows in Karel's world are called .....ANSWER.....Streets
Columns in karel's world are called .....ANSWER.....Avenues If Karel is facing North and the code turnLeft(); turnLeft(); What is a function? .....ANSWER.....A function is a way to teach Karel a new word Writing turnRight .....ANSWER.....functiuon turnRight(){ turnLeft(); turnLeft(); turnLeft(); }
//your code here } How many times should a start function be called in a program .....ANSWER..... How many times should a start function be defined in a program .....ANSWER..... What is top down design? .....ANSWER.....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. Why do we use functions in programming? .....ANSWER.....Break down our program into smaller parts Avoid repeating code
Make our program more readable What is a code comment? .....ANSWER.....A way to give notes to the reader to explain what your code is doing What commands does SuperKarel know that regular Karel does not? .....ANSWER.....turnAround() and turnRight() What is the best way for Karel to move 10 times? .....ANSWER.....for (var i = 0; i < 10; i++) { move(); } Which general if statement definition is written correctly? .....ANSWER.....if(condition) { //code } Why do we use if statements in JavaScript? .....ANSWER.....To do something only if a condition is true
Examples of control structures .....ANSWER.....if if/else while for What do we use control structures for in JavaScript? .....ANSWER.....Control the flow of the program; how the commands execute. Why should a programmer indent their code? .....ANSWER.....Helps show the structure of the code Easier for other people to understand Indenting is a key part of good programming style
Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs? move(); move(); turnRight(); move(); .....ANSWER.....Karel will crash into a wall Karel starts at Street 1, Avenue 1, facing East in a 5x5 world. What will happen after this code runs? move(); putball(); move(); move();
Call a Function .....ANSWER.....Telling the computer that it is time to run the command you have defined. newCommand(); Curly Bracket .....ANSWER.....Used to mark the beginning and end of function definitions, loops, if-statements, etc {} Read Like a Story .....ANSWER.....Functions and variables should be named in order to make the resulting code is easy to understand. function start(){ } .....ANSWER.....This function is automatically called when you click run. This is the only function that is only defined and not called. It should be the very first function in your code. No commands should be outside this. Indentation .....ANSWER.....The outline - Code INside a function, loop, or if-statement gets INdented with TAB.
The end of the code .....ANSWER.....Where all of your function definitions go. Comment .....ANSWER...../* A message in your code that explains what is going on to humans without giving the computer any instructions. Kind of like a sticky note that the computer can't read */ //A single line can be indicated like this. Loop .....ANSWER.....A way to repeat code in your program. Can be done a set number of times or can be done based on a condition. For Loop .....ANSWER.....Lets us repeat code a fixed number of times.
While Loop .....ANSWER.....Lets us repeat code while a condition is true. A way to teach Karel to be smarter. The condition will be checked, then the code is run, then the condition will be checked and the cycle repeats as long as the condition is true. If, when the condition is checked, it is false, the code inside no longer runs and the code after the loop will run.. Unlike an IF statement, this will run until the condition is no longer true. May never run if the condition is false on the first loop. Computers are dum .....ANSWER.....Can only follow directions. Need very specific instructions. 4 things that all computers do .....ANSWER.....Input Storage
Processing Output Exercise Tab .....ANSWER.....Where the directions for the exercise are. Syntax .....ANSWER.....Punctuation, spelling, spaces, symbols, and order of these. Your program will not run with messed up syntax. What goes at the end of every command .....ANSWER.....(); Highlight Blocks to move, copy, or delete them. .....ANSWER.....Click and drag a box around the blocks. Copy the name of a block. .....ANSWER.....Single click on the block. Computers are good at .....ANSWER.....Precision and Speed - Repetitive Tasks Humans are good at .....ANSWER.....Creativity and Uniqueness - Abstract Thinking
We have problems that computers can solve, BUT... .....ANSWER.....We need to know how to use and program computers in order to solve them and shape the future. While Loop vs If-Statement .....ANSWER.....While loop repeats while the condition is true and an if-statement only runs once IF the condition is true. Why make and use functions in programming? .....ANSWER.....To make your code easier to read and shorter. Who/What is Karel? .....ANSWER.....a dog who listens to your commands What are some commands Karel knows? .....ANSWER.....move(); turnLeft(); putBall(); takeBall(); How many spaces are in a command? .....ANSWER.....none
What does every command end in? .....ANSWER.....(); What can Karel not do? .....ANSWER.....turn right What is a function? .....ANSWER.....a way to teach Karel a new command Why do we use functions? .....ANSWER.....-they allow us to break down the program into smaller parts
Why do we use if statements in JavaScript? .....ANSWER.....To do something only if a condition is true Which general if statement definition is written correctly? .....ANSWER.....if(condition) { //code } Why do we use if/else statements in JavaScript? .....ANSWER.....To either do something if a condition is true or do something else What does an if/else statement look like in JavaScript? .....ANSWER.....if (condition) { //code } else { //code }
Why do we use while loops in JavaScript? .....ANSWER.....To repeat some code while a condition is true Which general while loop definition is written correctly? .....ANSWER.....while (condition) { //code } What are examples of control structures? .....ANSWER.....if if/else while for 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? .....ANSWER.....While Loop