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
Based on the code above, what is the value of x?
Free
(Multiple Choice)
4.8/5
(46)
Correct Answer:
C
Suppose that x is an int variable. Which of the following expressions always evaluates to false?
Free
(Multiple Choice)
4.9/5
(35)
Correct Answer:
C
Based on the code above, what is the output if lastInitial = 'C'?
Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
C
What is the output of the following Java code? int x = 57; int y = 3; switch (x % 9) {case 0: case 1: y++; case 2: y = y - 2; break; case 3: y = y + 2; case 4: break; case 5: case 6: y = y + 3;} System.out.println(y);
(Multiple Choice)
5.0/5
(35)
A computer program will recognize both = and == as the equality operator.
(True/False)
5.0/5
(40)
Suppose that you have the following statements. int score; String grade; if (score >= 65) grade = "pass"; else grade = "fail"; If score is equal to 75, the value of grade is pass.
(True/False)
4.8/5
(37)
Suppose P and Q are logical expressions. The logical expression P && Q is false if both P and Q are false.
(True/False)
4.8/5
(37)
The expression 'A' <= 'B' evaluates to false while the expression 'A' < 'B' evaluates to true.
(True/False)
4.9/5
(31)
Suppose that you have the following code. int num = 10; if (num > 10) System.out.println(num); else System.out.println(num + 5); The output of this code is 5.
(True/False)
4.8/5
(38)
Which of the following will cause a syntax error, if you are trying to compare x to 5?
(Multiple Choice)
4.8/5
(35)
Showing 1 - 20 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)