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?
A) The output for Segment A is: default
B) The output for Segment B is: 4
C) The output for Segment B is: 45default
D) The output for Segment A is: 5
Default
Correct Answer:
Verified
Q2: Which of the following statements about the
Q3: Which formatting flag indicates that the floating-point
Q6: Which of the following statements about the
Q8: Consider the code segment below.
If (gender ==
Q9: For the code segment below:
Switch(q)
{
Case 1:
System.out.println("apple");
Break;
Case 2:
System.out.println("orange");
Break;
Case
Q12: Which of the following will count down
Q13: Which of the following will not help
Q14: Which of the following for-loop headers results
Q16: The control variable of a counter-controlled loop
Q21: Suppose variable gender contains MALE and age
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents