Download presentation
Presentation is loading. Please wait.
1
PreAP Computer Science Quiz 05.05- 09
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 30 seconds per question.
2
Title the quiz as shown below The quiz starts in ONE minute.
Name Period Date Quiz 1. 14. 2. 15. 3. 16. 4. 17. 5. 18. 6. 19. 7. 20. 8. 21. 9. 22. 13. EC.
3
Question 01 Which of these is a real-life example of two-way selection? (a) (b) (c) (d)
4
Question 02 Which of these is a real-life example of multi-way selection? (a) (b) (c) (d)
5
Question 03 Which of these is a real-life example of fixed repetition?
(a) (b) (c) (d)
6
Question 04 Which of these is a real-life example of conditional repetition? (a) (b) (c) (d)
7
Question 05 Repetition is also called I and II Conditional Branching
Decision Making Iteration Looping I and II I and III I and IV II and III II and IV III and IV
8
Question 06 What type of control structure is used by the following
program segment? double allowance = 20.0; if (grades >= 80) allowance += 10.0; one-way selection two-way selection multiple-way selection fixed repetition conditional repetition
9
Question 07 What type of control structure is used by the following
program segment? for (int k = 1; k <= 100; k++) System.out.println("I will chew gum properly."); one-way selection two-way selection multiple-way selection fixed repetition conditional repetition
10
Question 08 What type of control structure is used by the following
program segment? int pin = 0; while (pin != 54321) { System.out.print("Enter your 5-digit PIN ===>> "); pin = Expo.enterInt(); } one-way selection two-way selection multiple-way selection fixed repetition conditional repetition
11
Question 09 What type of control structure is used by the following
program segment? switch (selection) { case 'A' : System.out.println("deposit"); break; case 'B' : System.out.println("withdrawal"); break; case 'C' : System.out.println("balance inquiry"); break; } one-way selection two-way selection multiple-way selection fixed repetition conditional repetition
12
Question 10 What type of control structure is used by the following
program segment? if (sat < 1250) System.out.println("You are not admitted"); else System.out.println("You are admitted"); one-way selection two-way selection multiple-way selection fixed repetition conditional repetition
13
Question 11 The one-way selection control structure uses
the _____ keyword. if else for while switch
14
Question 12 The two-way selection control structure uses
the _____ keyword. do else for while switch
15
Question 13 The multiple-way selection control structure uses
the _____ keyword. if else for while switch
16
Question 14 The fixed repetition control structure uses
the _____ keyword. if else for while switch
17
Question 15 The conditional repetition control structure uses
the _____ keyword. if else for while switch
18
Question 16 Which of these switch structures will have a strange output? switch (selection) // choice (a) { case 'A' : System.out.println("deposit"); case 'B' : System.out.println("withdrawal"); case 'C' : System.out.println("balance inquiry"); } switch (selection) // choice (b) case 'A' : System.out.println("deposit"); break; case 'B' : System.out.println("withdrawal"); break;
19
Question 17 True or False: One problem with the switch command
is that each case can only control a single programming statement. True False
20
Question 18 True or False: break must always be used with default.
21
Question 19 True or False:
If your switch structure does not use default, then you do not need a break after the last case. True False
22
Question 20 True or False:
In a switch structure, multiple cases can yield the same outcome. True False
23
Question 21 Which of these data types work with switch? boolean I only
char double int String I only II only II and IV only II and V only III and IV only II, IV and V only I, II, III, IV & V
24
Question 22 Which of these commands is used with switch? case I only
break default I only I and II only I and III only II and III only I, II and III
25
Question 23 How do you control multiple program statements
with an if, for or while control structure? Put the statements inside parentheses ( ). Put the statements inside brackets [ ]. Put the statements inside angle brackets < >. Put the statements inside braces { }.
26
Question 24 A for loop needs a counter.
What is technical name for this counter? Loop Counting Constant Loop Control Constant Loop Counting Variable Loop Control Variable There is none. It’s just called a counter.
27
Question 25 When creating a loop, what is the flag?
A special value that makes the loop start A special value that makes the loop stop A special value that makes the loop continue A special value that never changes in the loop
28
Extra Credit What is the output of the following segment?
int count = 100; for (int k = 1; k < 10; k++) count = count + 3; System.out.println(count); 109 110 124 127 130
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.