Form 14: Loop Efficiency and Code Optimization
Questions
-
MultiChoice
What is code optimization?
-
MultiChoice
Compare Option A (5 lines of 'Move forward') vs Option B ('REPEAT 5 TIMES: [Move forward]'). Which is more efficient?
-
WordsBox
Code optimization makes algorithms more ____ and easier to ____
-
MultiChoice
Why are repetitive commands packed into loops?
-
MultiChoice
Which loop is most efficient to draw an 8-sided polygon with equal sides?
-
MultiChoice
If code has 'Move forward; Move forward; Move forward; Move forward', how to optimize?
-
WordsBox
Loops reduce duplicated code, making programs shorter and less prone to ____
-
MultiChoice
What is a redundant step in an algorithm?
-
MultiChoice
In 'Turn right 90 deg; Turn right 90 deg; Turn right 90 deg; Turn right 90 deg', what is net rotation?
-
MultiChoice
How can the above 4 turn-right commands be optimized if no movement occurs between them?
-
MultiChoice
Why do programmers care about efficiency in algorithms?
-
MultiChoice
Optimized code is usually: