Question: 1 . The logical structure in which one instruction occurs after another with no branching is a _ _ _ _ _ _ _ _

1. The logical structure in which one instruction occurs after another with no branching is a ____________.
A. sequence
B. selection
C. loop
D. case
3. Which of the following is not a type of if statement?
A. single-alternative
B. dual-alternative
C. reverse
D. nested
5. In Java, the value of (14>7) is ____________.
A. true
B. false
C.14
D.7
7. What is the output of the following code segment?
Details - Program code. Line 1. T =10, semicolon. Line 2. If, left parenthesis, t, right angle bracket, 7, right parenthesis. Line 3. Left brace. Line 4, indented once. System, dot, out, dot, print, left parenthesis, open quotes, A A A, close quotes, right parenthesis, semicolon. Line 5, indented once. System, dot, out, dot, print, left parenthesis, open quotes, B B B, close quotes, right parenthesis, semicolon. Line 6. Right brace.
A. AAA
B. BBB
C. AAABBB
D. nothing
9. What is the output of the following code segment?
Details - Program code. Line 1. T =7, semicolon. Line 2. If, left parenthesis, t, right angle bracket, 7, right parenthesis. Line 3. Left brace. Line 4, indented once. System, dot, out, dot, print, left parenthesis, open quotes, A A A, close quotes, right parenthesis, semicolon. Line 5, indented once. System, dot, out, dot, print, left parenthesis, open quotes, B B B, close quotes, right parenthesis, semicolon. Line 6. Right brace.
A. AAA
B. BBB
C. AAABBB
D. nothing
11. The operator that combines two conditions into a single Boolean value that is true only when both of the conditions are true is ____________.
A. $$
B. &&
C.||
D.!!
13. Assuming a variable f has been initialized to 5, which of the following statements sets g to 0?
A. if(f >6|| f !=5) g =0;
B. if(f <3|| f >9) g =0;
C. if(f >=0|| f <2) g =0;
D. if(f ==0|| f ==2) g =0;
15. Which of the following statements correctly outputs the names of voters who live in district 6 and voters who live in district 7?
A. Details - Program code. In the code, the words in the variable names are merged. Line 1. if, left parenthesis, district, equals, equals, 6, double pipeline, 7, right parenthesis. Line 2. indented once, System, period, out, period, print l n, left parenthesis, left double quotation mark, Name is, right double quotation mark, plus, name, right parenthesis, semi-colon.
B. Details - Program code. In the code, the words in the variable names are merged. Line 1. if, left parenthesis, district, equals, equals, 6, double pipeline, district, equals, equals, 7, right parenthesis. Line 2. indented once, System, period, out, period, print l n, left parenthesis, left double quotation mark, Name is, right double quotation mark, plus name, right parenthesis, semi-colon.
C. Details - Program code. In the code, the words in the variable names are merged. Line 1. if, left parenthesis, district, equals, equals, 6, double pipeline, district, equals, equals, 7, right parenthesis. Line 2. indented once, System, period, out, period, print l n, left parenthesis, left double quotation mark, Name is, right double quotation mark, plus name, right parenthesis, semi-colon.
D. Details - Program code. In the code, the words in the variable names are merged. Line 1. if, left parenthesis, district, exclamation mark, equals, 6, ampersand, ampersand, district, exclamation mark, equals, 7, right parenthesis. Line 2. indented once, System, period, out, period, print l n, left parenthesis, left double quotation mark, Name is, right double quotation mark, plus, name, right parenthesis, semi-colon.
17. You can use the ____________ statement to terminate a switch statement.
A. switch
B. break
C. case
D. end
19. Assuming a variable w has been assigned the value 15, what does the following statement do?
Details - Program code. In the code, the words in the variable names are merged. Line 1. W, equals, equals, 15, question mark, x, equals, 2, colon, x, equals, 0, semi-colon.
A. assigns 15 to w
B. assigns 2 to x
C. assigns 0 to x
D. nothing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!