If statements DRILL

If statements DRILL

Assessment

Flashcard

Computers

8th Grade

Hard

Created by

Quizizz Content

FREE Resource

Student preview

quiz-placeholder

5 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the primary purpose of using if statements in Karel's programming?

Back

To allow Karel to make decisions based on conditions

2.

FLASHCARD QUESTION

Front

If Karel encounters a wall, which code snippet correctly uses an if statement to respond? Options: `if(frontIsBlocked()) {turnLeft();}` , `if(turnLeft()) {move();}` , `if(move()) {frontIsClear();}` , `if(ballsPresent()) {move();}`

Back

`if(frontIsBlocked()) {turnLeft();}`

3.

FLASHCARD QUESTION

Front

Which of the following conditions can be used to check if Karel is facing north? Options: `if(facingWest()) {move();}` , `if(facingSouth()) {turnRight();}` , `if(facingEast()) {turnLeft();}` , `if(facingNorth()) {move();}`

Back

`if(facingNorth()) {move();}`

4.

FLASHCARD QUESTION

Front

What happens if Karel executes a move command when the front is blocked?

Back

Karel will crash and stop.

5.

FLASHCARD QUESTION

Front

How can Karel check if there are no tennis balls present on the current corner?

Back

`if(noBallsPresent()) {move();}`