Last Name: First Name: Class Section: Matching Part 1 Type the letter of the term which best matches the following descriptions:
16. Which order is correct for a for loop: a. loop condition, init expression, body of loop, loop expression b. init expression, body of loop, loop condition, loop expression c. init expression, loop condition, body of loop, loop expression d. loop condition, loop expression, body of loop, init expression e. none of the above. Answer: 17. A for loop can be rewritten as a while loop: a. always b. when speed is a concern c. never Answer: 18. A while loop can be rewritten as a do loop: a. always b. when speed is a concern c. never Answer: 19. A while loop can be rewritten as a for loop: a. always b. when speed is a concern c. never Answer: 20. Which order is correct for a do loop: a. boolean expression, body of loop b. body of loop, boolean expression c. init expression, body of loop d. init expression, boolean expression, body of loop e. none of the above Answer: 21. An if statement is used: a. to repeat a portion of code b. to either execute or skip a portion of code c. to either execute or repeat a portion of code d. none of the above Answer: 22. An if else construct is used: a. to either execute or skip a portion of code b. to repeat certain protions of code c. to execute either one portion of code or another. d. none of the above Answer: 23. A switch is used: a. when execution needs to switch from one portion of the program to another. b. when there is a choice of several possible portions of code to execute, depending on the value of a boolean expression. c. when there is a choice of several possible portions of code to execute, depending on the value of a constant expression. d. none of the above. Answer: