Robot Programming Basics
שאלות 10
מפתח התשובות מוצג למורים מחוברים.
-
-
Repeating Actions with a Loop
A programmer wants a robot to draw a square by moving forward and turning 90 degrees four times. Which programming construct avoids writing the same two instructions four times?
A conditional statement
A loop
A sensor reading
A comment
Look for a structure that runs a block of instructions a set number of times. -
Making Decisions with Conditions
A robot should stop when its distance sensor detects an obstacle closer than 5 cm, and otherwise keep moving. Which construct allows the robot to choose between these two behaviours?
A variable declaration
A repeat loop without a stop
A single forward command
A condition (if-else statement)
The robot must check something and pick one of two paths depending on the result. -
Loops and Conditions Together
A robot repeats the instruction 'move forward' inside a loop, and within each repetition checks whether the line sensor sees black. The loop should stop when the robot reaches the black line. Which loop type is most suitable for this task?
A loop that runs a fixed 10 times
A loop that runs only once
A loop that repeats until a condition becomes true
A loop with no commands inside
The number of repetitions is not known in advance; it depends on what the sensor detects. -
-
-
-
Endless loops
A loop that has no way to end runs forever and is called an ___________ loop. If a robot program contains such a loop, the robot will keep ___________ its commands until it is turned off.
countedrepeatingskippingstoringsingleinfinitenestedConsider what a loop does when its repetition never stops, and what that kind of loop is named. -
Sequence of Commands with a Repeat
A robot must follow a path that goes forward 20 cm and then turns right 90 degrees, and this pattern must be done exactly 3 times to form a triangle-like route. Explain how a loop can be used to write this program instead of repeating the same instructions three times, and name the parts of the loop you would write.
Think about a construct that runs the same block of commands a set number of times, and what goes inside its body. -
Condition Checked in a Loop
A robot moves along a line and, in each step, checks a light sensor. Describe how a while loop with a condition can keep the robot moving until it reaches a black line, and explain what happens to the loop once the condition becomes false.
Focus on when the loop repeats and when it stops, based on whether the condition is true or false at each check.
פרטים
- מקצועות
- מדעי המחשב נוסף על ידי AI שפות תכנות
- תגיות
- נוסף על ידי AI while loop נוסף על ידי AI infinite loop נוסף על ידי AI if-else statement נוסף על ידי AI robot sensors נוסף על ידי AI loop conditions
- קהל יעד
- חטיבת ביניים · כיתות ח׳–ט׳
- רמת קושי
- 5 מתוך 10
- שפה
- אנגלית
- מי יכול לראות
- כולם
- הושלם על ידי AI
- מה שמסומן בניצוץ נוסף על ידי AI.
- נוצר באמצעות AI
- Claude Haiku 5.5
- נוצר
תגובות