Exam 4: Control Structures I: Selection
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of Java50 Questions
Exam 3: Introduction to Objects and Inputoutput50 Questions
Exam 4: Control Structures I: Selection50 Questions
Exam 5: Control Structures II: Repetition50 Questions
Exam 6: Graphical User Interface Gui and Object-Oriented Design OOD50 Questions
Exam 7: User-Defined Methods50 Questions
Exam 8: User-Defined Classes and Adts50 Questions
Exam 9: Arrays50 Questions
Exam 10: Inheritance and Polymorphism50 Questions
Exam 11: Handling Exceptions and Events50 Questions
Exam 12: Advanced Guis and Graphics49 Questions
Exam 13: Recursion50 Questions
Exam 14: Searching and Sorting50 Questions
Select questions type
The execution of a break statement in a switch statement terminates the switch statement.
(True/False)
4.9/5
(30)
Based on the code above, what is the output if lastInitial = 'E'?
(Multiple Choice)
4.7/5
(39)
Suppose x = 10 and y = 20. The value of the expression ((x >= 10) && (y <= 20)) is true.
(True/False)
4.8/5
(30)
In Java, case and switch are reserved words, but break is not a reserved word.
(True/False)
4.8/5
(41)
The output of the Java code: int alpha = 5; int beta = 4; switch (beta) {case 2: alpha = alpha + 2; case 4: alpha = alpha + 4; break; case 6: alpha = alpha + 6; default: alpha = alpha + 10;} System.out.print(alpha); is: 9
(True/False)
4.8/5
(30)
After the execution of the following code, what will be the value of num if the input values are 0 3? (Assume that console is a Scanner object initialized to the standard input device.) int num = console.nextInt(); if (num > 0) num = num + 13; else if (num >= 3) num = num + 15;
(Multiple Choice)
4.8/5
(34)
In a ____ control structure, the computer executes particular statements depending on some condition(s).
(Multiple Choice)
4.8/5
(42)
Based on the code above, which part of the expression is not evaluated?
(Multiple Choice)
4.9/5
(30)
Which of the following is NOT a relational operator in Java?
(Multiple Choice)
4.8/5
(37)
Suppose str1 and str2 are String variables. The expression (str1 == str2) determines whether str1 and str2 point to the same String object.
(True/False)
4.9/5
(37)
When one control statement is located within another, it is said to be a controlled statement.
(True/False)
4.7/5
(35)
The expression !(x <= 0) is true only if x is a positive number.
(True/False)
4.7/5
(30)
Suppose that the input is 6 and console is a Scanner object initialized to the standard input device. Consider the following code. int alpha = 7; int beta = console.nextInt(); switch (beta) {case 5: alpha = alpha + 1; case 6: alpha = alpha + 2; case 7: alpha = alpha + 3; default: alpha = alpha + 5;} System.out.print(alpha); The output of this code is 9.
(True/False)
4.8/5
(33)
Suppose that you have the following statements. String str1 = "cat"; String str2 = "cats"; The statement str1.equals(str2); is true.
(True/False)
4.9/5
(35)
What is the output of the following Java code? int x = 0; if (x > 0) System.out.println("positive "); System.out.println("zero "); System.out.println("negative");
(Multiple Choice)
4.8/5
(30)
Showing 21 - 40 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)