Consider the following code snippet. Assuming that the user enters first 20 and then 12 as the two input values, what is the output of the code snippet?
Int num1 = 0;
Int num2 = 0;
Int num3 = 0;
Int num4 = 0;
Int num5 = 0;
Scanner in = new Scanner(System.in) ;
System.out.print("Enter a number: ") ;
Num1 = in.nextInt() ;
System.out.print("Enter a number: ") ;
Num2 = in.nextInt() ;
If (num1 < num2)
{
Num3 = num1;
}
Else
{
Num3 = num2;
}
If (num1 < num2 + 10)
{
Num4 = num1;
}
Else if (num1 < num2 + 20)
{
Num5 = num1;
}
System.out.println("num1 = " + num1 + " num2 = " + num2
+ " num3 = " + num3 + " num4 = " + num4
+ " num5 = " + num5) ;
A) num1 = 20 num2 = 12 num3 = 20 num4 = 20 num5 = 0
B) num1 = 20 num2 = 12 num3 = 12 num4 = 0 num5 = 20
C) num1 = 20 num2 = 12 num3 = 12 num4 = 20 num5 = 0
D) num1 = 20 num2 = 12 num3 = 20 num4 = 0 num5 = 20
Correct Answer:
Verified
Q54: Which of the following expressions represents a
Q55: What is the value of the price
Q56: Assuming that a user enters 64 as
Q57: Consider the following code snippet: boolean attendance
Q59: Assuming that a user enters 56 for
Q61: A store applies a 15 percent service
Q62: What is the output of the following
Q63: Which of the following options correctly represents
Q90: Which of the following expressions represents a
Q93: Which of the following variables is used
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