CodeHS Karel Programming 2025/2026
Exam Questions with 100% Correct
Answers | Latest Update
function yourFunctionName() {
} - 🧠 ANSWER ✔✔// Code that will run when you make a call to
// this function.
if (condition) {
} - 🧠 ANSWER ✔✔//code that will run if the condition is true
if (condition) {
} else {
} - 🧠 ANSWER ✔✔//code that will run if the condition is true
COPYRIGHT©NINJANERD 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
1
STATEMENT. ALL RIGHTS RESERVED
,//code that will run if condition is not true
if(frontIsClear()){
move();
} - 🧠 ANSWER ✔✔Example of if statements One
if(ballsPresent()){
takeBall();
}else{
move();
} - 🧠 ANSWER ✔✔Example of if statements Two
while (CONDITION) {
} - 🧠 ANSWER ✔✔// Code that will run while the CONDITION is true.
// Once the CONDITION is no longer true,
// it will stop.
while(frontIsClear()){
move();
COPYRIGHT©NINJANERD 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
2
STATEMENT. ALL RIGHTS RESERVED
, } - 🧠 ANSWER ✔✔Example of while loops
/* This moves Karel to a wall */
for (var i=0; i < COUNT; i++) {
} - 🧠 ANSWER ✔✔// Code that will run 'COUNT' times
for(var i = 0; i < 10; i++){
putBall();
} - 🧠 ANSWER ✔✔/* This puts down 10 balls */
for(var i = 0; i < 5; i++){
putBall();
move();
} - 🧠 ANSWER ✔✔/* This puts down five balls and
moves after each one */
println(str);
// Example:
COPYRIGHT©NINJANERD 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
3
STATEMENT. ALL RIGHTS RESERVED
Exam Questions with 100% Correct
Answers | Latest Update
function yourFunctionName() {
} - 🧠 ANSWER ✔✔// Code that will run when you make a call to
// this function.
if (condition) {
} - 🧠 ANSWER ✔✔//code that will run if the condition is true
if (condition) {
} else {
} - 🧠 ANSWER ✔✔//code that will run if the condition is true
COPYRIGHT©NINJANERD 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
1
STATEMENT. ALL RIGHTS RESERVED
,//code that will run if condition is not true
if(frontIsClear()){
move();
} - 🧠 ANSWER ✔✔Example of if statements One
if(ballsPresent()){
takeBall();
}else{
move();
} - 🧠 ANSWER ✔✔Example of if statements Two
while (CONDITION) {
} - 🧠 ANSWER ✔✔// Code that will run while the CONDITION is true.
// Once the CONDITION is no longer true,
// it will stop.
while(frontIsClear()){
move();
COPYRIGHT©NINJANERD 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
2
STATEMENT. ALL RIGHTS RESERVED
, } - 🧠 ANSWER ✔✔Example of while loops
/* This moves Karel to a wall */
for (var i=0; i < COUNT; i++) {
} - 🧠 ANSWER ✔✔// Code that will run 'COUNT' times
for(var i = 0; i < 10; i++){
putBall();
} - 🧠 ANSWER ✔✔/* This puts down 10 balls */
for(var i = 0; i < 5; i++){
putBall();
move();
} - 🧠 ANSWER ✔✔/* This puts down five balls and
moves after each one */
println(str);
// Example:
COPYRIGHT©NINJANERD 2025/2026. YEAR PUBLISHED 2025. COMPANY REGISTRATION NUMBER: 619652435. TERMS OF USE. PRIVACY
3
STATEMENT. ALL RIGHTS RESERVED