LESSONS 1-20 -CODEHS KAREL PROGRAMMING EXAM QUESTIONS, Exams of Computer Science

LESSONS 1-20 -CODEHS KAREL PROGRAMMING EXAM QUESTIONS WITH DETAILED- VERIFIED ANSWERS- ALREADY GRADED A+ || NEWLY RELEASED Computer science / programming language Examination Summary:- Section Topics Covered Questions 1 Karel Commands and Basic Syntax 1–25 2 Functions and Top-Down Design 26–50 3 For Loops 51–70 4 While Loops 71–85 5 If Statements and If/Else Statements 86–105 6 Control Structures and Problem-Solving 106–125

Typology: Exams

2025/2026

Available from 06/23/2026

Thehealthhero
Thehealthhero 🇿🇦

704 documents

1 / 79

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 79
LESSONS 1-20 -CODEHS KAREL PROGRAMMING EXAM QUESTIONS WITH DETAILED-
VERIFIED ANSWERS- ALREADY GRADED A+ || NEWLY RELEASED
Computer science / programming language
Examination Summary:-
Section Topics Covered Questions
1 Karel Commands and Basic Syntax 1–25
2 Functions and Top-Down Design 2650
3 For Loops 5170
4 While Loops 7185
5 If Statements and If/Else Statements 86105
6 Control Structures and Problem-Solving 106125
7 Debugging, Testing, and Good Programming Style 126140
8 Advanced Karel Concepts and Challenges 141150
Section 1: Karel Commands and Basic Syntax (Questions 1–25)
1. Which of the following is a valid Karel command?
A. move;
B. MOVE
C. move();
D. move()
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f

Partial preview of the text

Download LESSONS 1-20 -CODEHS KAREL PROGRAMMING EXAM QUESTIONS and more Exams Computer Science in PDF only on Docsity!

LESSONS 1- 20 - CODEHS KAREL PROGRAMMING EXAM QUESTIONS WITH DETAILED- VERIFIED ANSWERS- ALREADY GRADED A+ || NEWLY RELEASED Computer science / programming language Examination Summary:- Section Topics Covered Questions 1 Karel Commands and Basic Syntax 1 – 25 2 Functions and Top-Down Design 26 – 50 3 For Loops 51 – 70 4 While Loops 71 – 85 5 If Statements and If/Else Statements 86 – 105 6 Control Structures and Problem-Solving 106 – 125 7 Debugging, Testing, and Good Programming Style 126 – 140 8 Advanced Karel Concepts and Challenges 141 – 150 Section 1: Karel Commands and Basic Syntax (Questions 1–25)

  1. Which of the following is a valid Karel command? A. move; B. MOVE C. move(); D. move()

CORRECT ANSWER : C. move(); RATIONALE : Karel commands are case‑sensitive and must end with parentheses (). The correct syntax is move();. Commands cannot have spaces, and capitalization must match exactly.

  1. Which command does Karel use to place a tennis ball at its current location? A. addBall(); B. placeBall(); C. putBall(); D. takeBall(); CORRECT ANSWER : C. putBall(); RATIONALE : putBall(); is the Karel command used to place a ball at Karel's current location. takeBall(); removes a ball.
  2. Which of the following is a valid Karel command to remove a ball from Karel's current location? A. removeBall();

B. Move(); C. forward(); D. go(); CORRECT ANSWER : A. move(); RATIONALE : move(); is the Karel command that moves Karel forward one space in the direction it is facing.

  1. By default, Karel knows how to turn right. A. True B. False CORRECT ANSWER : B. False RATIONALE : Karel does not know how to turn right by default. Programmers must teach Karel to turn right by defining a function or using three turnLeft(); commands.
  2. If Karel is currently facing North and the code turnLeft(); turnLeft(); runs, which direction is Karel facing now? A. North

B. South C. East D. West CORRECT ANSWER : B. South RATIONALE : Each turnLeft(); command rotates Karel 90 degrees counter‑clockwise. Two turnLeft(); commands rotate Karel 180 degrees, so facing North becomes South.

  1. How many times should Karel turn left in order to turn right? A. 1 B. 2 C. 3 D. 4 CORRECT ANSWER : C. 3 RATIONALE : Three left turns (90° × 3 = 270°) is equivalent to one right turn (90° clockwise).
  2. What can be used to teach Karel to turn right?

A. 0

B. 1

C. 2

D. However many you like CORRECT ANSWER : B. 1 RATIONALE : The start(); function should be defined exactly once in a program. It is the entry point for Karel's execution.

  1. How many times should the start() function be called in a Karel program? A. 0 B. 1 C. 2 D. However many times you like CORRECT ANSWER : A. 0 RATIONALE : The start(); function is called automatically by the system; you should never call it yourself.
  1. What happens if Karel is commanded to move when there is a wall in front of it? A. Karel jumps over the wall B. Karel turns around C. Karel crashes and the program stops D. Karel ignores the command CORRECT ANSWER : C. Karel crashes and the program stops RATIONALE : If Karel tries to move into a wall, it will crash and the program will stop. Karel cannot move through walls.
  2. What is a street in a Karel world? A. Row B. Column C. Avenue D. Corner CORRECT ANSWER : A. Row RATIONALE : In Karel's world, rows are called streets, and columns are called avenues.

RATIONALE : Starting at (1,1) facing East, Karel moves to (1,2), then (1,3), then turns left to face North, then attempts to move to Street 2, Avenue 3. In a 5× world, this is valid. However, if the world has a wall at the top, Karel may crash. The CORRECT ANSWER depends on the specific world setup.

  1. If Karel starts at Street 1, Avenue 3 facing East, what street and avenue will Karel be on after this code runs? move(); move(); move(); turnLeft(); move(); A. Street 1, Avenue 6 B. Street 2, Avenue 6 C. Street 2, Avenue 3 D. Street 1, Avenue 4 CORRECT ANSWER : B. Street 2, Avenue 6 RATIONALE : Starting at (1,3) facing East, three moves puts Karel at (1,6). turnLeft(); faces North. One move puts Karel at (2,6). So Street 2, Avenue 6.
  2. Which function will teach Karel how to spin in a circle one time? A. function spin() { turnRight(); } B. function spin() { turnLeft(); turnLeft(); turnLeft(); turnLeft(); } C. function spin() { turnLeft(); turnLeft(); } D. function spin() { move(); move(); move(); move(); }

CORRECT ANSWER : B. function spin() { turnLeft(); turnLeft(); turnLeft(); turnLeft(); } RATIONALE : To spin in a circle, Karel must turn 360 degrees, which requires four turnLeft(); commands.

  1. Which of the following is NOT true about a Karel command? A. Command names can only be made up of one word B. Commands do not have any spaces C. Capitalization has to match exactly D. Every command ends in (); CORRECT ANSWER : A. Command names can only be made up of one word RATIONALE : Command names can be made up of multiple words (e.g., turnLeft(); has two words combined). However, they cannot have spaces.
  2. All commands must be inside of a function. A. True B. False

D. buildTower CORRECT ANSWER : B. buildTower(); RATIONALE : To call a function, you use the function name followed by parentheses ().

  1. When defining a function, what symbols are used to mark the beginning and end of the function body? A. ( ) B. [ ] C. { } D. < > CORRECT ANSWER : C. { } RATIONALE : Curly braces { } are used to mark the beginning and end of function definitions, loops, if‑statements, etc.
  2. What does Karel do when it executes turnLeft(); while facing East? A. Faces North B. Faces South

C. Faces West D. Faces East CORRECT ANSWER : A. Faces North RATIONALE : Turning left from East rotates Karel 90 degrees counter‑clockwise to North.

  1. What does Karel do when it executes turnLeft(); while facing West? A. Faces North B. Faces South C. Faces East D. Faces West CORRECT ANSWER : B. Faces South RATIONALE : Turning left from West rotates Karel 90 degrees counter‑clockwise to South. Section 2: Functions and Top-Down Design (Questions 26–50)
  2. What is a function in Karel programming? A. A way to store data

A. 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 B. A way to create designs on a computer to put on a web page C. A way of designing your programs starting with the individual commands first D. A way to use loops and classes to decompose the problem CORRECT ANSWER : A. 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 RATIONALE : Top‑down design is a problem‑solving approach that breaks a large problem into smaller, manageable subproblems.

  1. What is a code comment? A. A way to teach Karel a new word B. A way to give notes to the reader to explain what your code is doing C. A message to your teacher in code D. A place to write whatever you want in your code CORRECT ANSWER : B. A way to give notes to the reader to explain what your code is doing

RATIONALE : Comments are notes in the code that explain what the code does. They are ignored by the computer.

  1. What is the correct syntax for a single‑line comment in JavaScript? A. // This is a comment B. /* This is a comment / C. # This is a comment D. CORRECT ANSWER : A. // This is a comment RATIONALE : In JavaScript, single‑line comments begin with //. Multi‑line comments use / */.
  2. Why should a programmer indent their code? A. Helps show the structure of the code B. Easier for other people to understand C. Indenting is a key part of good programming style D. All of the above CORRECT ANSWER : D. All of the above

RATIONALE : turnAround(); makes Karel face the opposite direction by turning 180 degrees.

  1. What is the purpose of abstraction in programming? A. To hide complex details and show only essential features B. To make code longer and more complex C. To increase the number of lines of code D. To make code harder to understand CORRECT ANSWER : A. To hide complex details and show only essential features RATIONALE : Abstraction simplifies complex systems by hiding unnecessary details and focusing on the essential features.
  2. Which of the following is an example of abstraction in Karel programming? A. Writing move(); four times to move four spaces B. Writing a moveFour(); function that contains four move(); commands C. Writing a comment explaining what the code does D. Writing a for loop to repeat moves

CORRECT ANSWER : B. Writing a moveFour(); function that contains four move(); commands RATIONALE : Creating a function to hide the details of four moves is an example of abstraction.

  1. A programmer wants Karel to move to a specific location. Which approach demonstrates top‑down design? A. Write all commands in one function B. Break the problem into smaller functions like moveToCorner(); and turnAround(); C. Use only while loops D. Write no functions and use only comments CORRECT ANSWER : B. Break the problem into smaller functions like moveToCorner(); and turnAround(); RATIONALE : Top‑down design involves breaking a large problem into smaller, more manageable functions.
  2. What is the purpose of the start(); function in a Karel program? A. It is the entry point where Karel begins execution B. It is called at the end of the program