Exam 5: Control Statements: Logical Operators
Exam 1: Introduction to Computers, the Internet and Java40 Questions
Exam 2: Introduction to Java Applications; Inputoutput and Operators33 Questions
Exam 3: Introduction to Classes, Objects, Methods and Strings32 Questions
Exam 4: Control Statements: Assignment, and Operators39 Questions
Exam 5: Control Statements: Logical Operators26 Questions
Exam 6: Methods: a Deeper Look38 Questions
Exam 7: Arrays and Arraylists46 Questions
Exam 8: Classes and Objects: a Deeper Look28 Questions
Exam 9: Object-Oriented Programming: Inheritance20 Questions
Exam 10: Object-Oriented Programming: Polymorphism and Interfaces34 Questions
Exam 11: Exception Handling: a Deeper Look27 Questions
Exam 12: Javafx Graphical User Interfaces22 Questions
Exam 13: Javafx Gui20 Questions
Exam 14: Strings, Characters and Regular Expressions26 Questions
Exam 15: Files, Inputoutput Streams, Nio and Xml Serialization30 Questions
Exam 16: Generic Collections36 Questions
Exam 17: Lambdas and Streams67 Questions
Exam 18: Recursion15 Questions
Exam 19: Searching, Sorting and Big O22 Questions
Exam 20: Generic Classes and Methods: a Deeper Look13 Questions
Exam 21: Custom Generic Data Structures17 Questions
Exam 22: Concurrency54 Questions
Exam 23: Accessing Databases With Jdbc34 Questions
Exam 24: Swing Gui Components78 Questions
Exam 25: Graphics and Java 2d19 Questions
Exam 26: Networking13 Questions
Exam 27: Java Persistence Api Jpa16 Questions
Exam 28: Javaserver Faces Web Apps15 Questions
Exam 29: Javaserver Faces Web Apps7 Questions
Exam 30: Swing Gui Components26 Questions
Select questions type
Which of the following will not help prevent infinite loops?
Free
(Multiple Choice)
4.9/5
(31)
Correct Answer:
A
Consider the classes below:
public class TestA {
Public static void main(String[] args) {
Int x = 2;
Int y = 20
Int counter = 0;
For (int j = y % x; j < 100; j += (y / x)) {
Counter++;
}
}
}
Public class TestB {
Public static void main(String[] args) {
Int counter = 0;
For (int j = 10; j > 0; --j) {
++counter;
}
}
}
Which of the following statements is true?
Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
D
Consider the following two Java code segments:
Segment 1 Segment 2
Int i = 0;
For (int i = 0; i <= 20; i++) {
While (i < 20) { System.out.println(i);
I++; }
System.out.println(i);
}
Which of the following statements are true?
Free
(Multiple Choice)
4.9/5
(34)
Correct Answer:
C
For the code segment below:
switch(q) {
Case 1:
System.out.println("apple");
Break;
Case 2:
System.out.println("orange");
Break;
Case 3:
System.out.println("banana");
Break;
Case 4:
System.out.println("pear");
Case 5:
System.out.println("grapes");
Default:
System.out.println("kiwi");
}
Which of the following values for q will result in kiwi being included in the output?
(Multiple Choice)
4.8/5
(36)
Suppose variable gender contains MALE and age equals 60, how is the expression (gender == FEMALE) && (age >= 65)
Evaluated?
(Multiple Choice)
4.7/5
(33)
Which statement prints the floating-point value 123.456 right justified with a field width of 10?
(Multiple Choice)
4.7/5
(36)
Which of the following statements about a do…while iteration statement is true?
(Multiple Choice)
4.8/5
(41)
Which of the following can be used in a switch statement in the expression after keyword case?
A. a constant integral expression.
B. a character constant.
C. a String
D. an enumeration constant.
(Multiple Choice)
4.9/5
(36)
Consider the code segment below.
if (gender == 1) {
If (age >= 65) {
++seniorFemales;
}
}
This segment is equivalent to which of the following?
(Multiple Choice)
4.8/5
(35)
Which of the following for-loop headers results in equivalent numbers of iterations:
A. for (int q = 1; q <= 100; q++)
B. for (int q = 100; q >= 0; q--)
C. for (int q = 99; q > 0; q -= 9)
D. for (int q = 990; q > 0; q -= 90)
(Multiple Choice)
4.9/5
(25)
Which case of the following would warrant using the boolean logical inclusive OR (|) rather than the conditional OR (||)?
(Multiple Choice)
4.8/5
(29)
Which of the following statements about the break statement is false?
(Multiple Choice)
4.9/5
(40)
Which of the following is not a type of iteration statement in Java?
(Multiple Choice)
4.8/5
(40)
Which formatting flag indicates that the floating-point values should be output with a thousands separator?
(Multiple Choice)
4.7/5
(33)
Which of the following is equivalent to this code segment?
int total = 0;
For (int i = 0; i <= 20; i += 2) {
Total += i;
}
(Multiple Choice)
4.8/5
(40)
Which expression is equivalent to if (!(grade == sentinelValue))?
(Multiple Choice)
4.9/5
(37)
For the two code segments below:
Segment A
Int q = 5;
Switch(q) {
Case 1:
System.out.println(1);
Case 2:
System.out.println(2);
Case 3:
System.out.println(3);
Case 4:
System.out.println(4);
Case 5:
System.out.println(5);
Default:
System.out.println("default");
}
Segment B
Q = 4;
Switch(q) {
Case 1:
System.out.println(1);
Case 2:
System.out.println(2);
Case 3:
System.out.println(3);
Case 4:
System.out.println(4);
Case 5:
System.out.println(5);
Default:
System.out.println("default");
}
Which of the following statements is true?
(Multiple Choice)
4.9/5
(39)
Which of the following statements about the switch statement is false?
(Multiple Choice)
4.8/5
(40)
Showing 1 - 20 of 26
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)