Reference no: EM132057172
Refer to the attached Java program. Walk through the program. Do not compile or run it! You may use any text as a reference.
1. What value will be output first?
a. Odd
b. Even
c. OOPS
d. 10
e. none of the above
2. What value will be output second?
a. Odd
b. Even
c. OOPS
d. 5
e. none of the above
3. What value will be output third?
a. Odd
b. Even
c. OOPS
d. 5
e. none of the above
4. What value will be output fourth?
a. Odd
b. Even
c. OOPS
d. 0
e. none of the above
5. What value will be output fifth?
a. Odd
b. Even
c. OOPS
d. 6
e. none of the above
6. What value will be output sixth?
a. Odd
b. Even
c. OOPS
d. 3
e. none of the above
7. What value will be output seventh?
a. 4
b. 5
c. 6
d. 7
e. none of the above
8. What value will be output eighth?
a. 4
b. 4.0
c. 4.8
d. 8.4
e. none of the above
9. What value will be output ninth?
a. 0
b. 3
c. 6
d.10
e. none of the above
10. What value will be output tenth?
a. 1
b. 3
c. 5
d. 10
e. none of the above
Data for Quiz# 11
Input from the following collection in order as required: {10, 5, 0, 6, 3, 4, 1, 7}
Import.java.io.*;
Public class Quiz11Driver
{
Public static void main (string args []) throws IOException
{
Quiz 11 app;
App = new Quiz11();
App.appMain();
}
}
Class Quiz11
{
BufferedReader stdin;
Int count, tot, min, x, y, mincount;
Float avg;
Public void appMain() throws IOException
{
rptInit();
for (count = 1; count <-5; count++)
{
loopA();
}
--count;
Avg = total/count;
rptOut();
}
void rptInit()
{
Stdin = new BufferedReader (new InputStreamReader (system.in));
Tot = 0;
Min = 100;
}
void loopA() throws IOException
{
Getinput();
Y = x%2;
updateLoop();
checkIn();
}
Void getInput () throws IOException
{
System.out.print("Enter a whole number:");
X = Integer.parseInt(stdin.readLine());
}
Void updateLoop()
{
Tot += x;
If (x < min)
{
min = x;
minCount = count;
}
}
Void checkIn()
{
Switch (y)
{
Case 0:
System.out.println("Even");
break;
Case 1:
System.out.println("Odd");
break;
default:
System.out.println("OOPS");
break;
}
}
Void rptOut()
{
System.out.println(tot);
System.out.println(count);
System.out.println(avg);
System.out.println(min);
System.out.println(minCount);
}
}