Exam 5: Control Statements: Part 2
Exam 1: Introduction to Computers and Java24 Questions
Exam 2: Introduction to Java Applications23 Questions
Exam 3: Introduction to Classes and Objects18 Questions
Exam 4: Control Statements: Part 141 Questions
Exam 5: Control Statements: Part 225 Questions
Exam 6: Methods: a Deeper Look42 Questions
Exam 7: Arrays and Arraylists41 Questions
Exam 8: Classes and Objects: a Deeper Look31 Questions
Exam 9: Object Oriented Programming: Inheritance23 Questions
Exam 10: Object-Oriented Programming: Polymorphism25 Questions
Exam 11: Exception Handling28 Questions
Exam 12: Atm Case Study,part 1: Object-Oriented Design With the Uml18 Questions
Exam 13: Atm Case Study,part 2: Implementing an Object-Oriented Design4 Questions
Exam 14: Gui Components: Part 177 Questions
Exam 15: Graphics and Java 2d15 Questions
Exam 16: Strings26 Questions
Exam 17: Files,streams and Object Serialization22 Questions
Exam 18: Recursion14 Questions
Exam 19: Searching, Sorting and Big O14 Questions
Exam 20: Generic Collections41 Questions
Exam 21: Generic Classes and Methods13 Questions
Exam 22: Custom Generic Data Structures16 Questions
Exam 23: Applets and Java Web Start12 Questions
Exam 24: Multimedia: Applets and Applications12 Questions
Exam 25: Gui, Part 225 Questions
Exam 26: Multithreading25 Questions
Exam 27: Networking15 Questions
Exam 28: Accessing Databases With Jdbc35 Questions
Exam 29: Java Server Faces Web Applications15 Questions
Exam 30: Ajax-Enabled Jsf Web Applications7 Questions
Exam 31: Web Services27 Questions
Select questions type
Which of the following is equivalent to this code segment? int total = 0;
For ( int i = 0;i <= 20;i += 2 )
Total += i;
Free
(Multiple Choice)
4.7/5
(44)
Correct Answer:
B
Which formatting flag indicates that the floating-point values should be output with a thousands separator?
Free
(Multiple Choice)
4.8/5
(31)
Correct Answer:
C
To exit out of a loop completely,and resume the flow of control at the next line in the method,use _______.
Free
(Multiple Choice)
4.8/5
(33)
Correct Answer:
B
The first statement in every paintComponent method should be a call to ________.
(Multiple Choice)
5.0/5
(36)
The boolean values can be displayed with the ________ format specifier.
(Multiple Choice)
4.9/5
(35)
Consider the classes below: public class TestA
{
Public static void main( String args[] )
{
Int x = 2,y = 20,counter = 0;
For ( int j = y % x;j < 100;j += ( y / x ))
Counter++;
} // end main
} // end class TestA
Public class TestB
{
Public static void main(String args[])
{
Int counter = 0;
For ( int j = 10;j > 0;--j )
++counter;
} // end main
} // end class TestB
Which of the following statements is true?
(Multiple Choice)
4.8/5
(37)
Which statement prints the floating-point value 123.456 right justified with a field width of 10?
(Multiple Choice)
4.9/5
(42)
Which of the following statements about a do…while repetition statement is true?
(Multiple Choice)
4.9/5
(39)
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" );
} // end switch
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" );
} // end switch
Which of the following statements is true?
(Multiple Choice)
5.0/5
(31)
Which of the following is not a type of repetition statement in Java?
(Multiple Choice)
4.8/5
(33)
Which of the following statements about the switch statement (as used in Java SE 7)is false?
(Multiple Choice)
4.8/5
(44)
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 (but only in Java SE 7).
d)an enumeration constant.
(Multiple Choice)
4.8/5
(31)
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?
(Multiple Choice)
4.9/5
(34)
Consider the code segment below. if ( gender == 1 )
{
If ( age >= 65 )
++seniorFemales;
} // end if
This segment is equivalent to which of the following?
(Multiple Choice)
4.8/5
(31)
Which case of the following would warrant using the boolean logical inclusive OR (|)rather than the conditional OR (||)?
(Multiple Choice)
4.7/5
(40)
Which of the following statements about the continue statement is true?
(Multiple Choice)
4.8/5
(33)
Which of the following will count down from 10 to 1 correctly?
(Multiple Choice)
4.7/5
(44)
Which of the following for-loop control 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.8/5
(32)
Showing 1 - 20 of 25
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)