UGRD-ITE6104 Computer Programming 2
Midterm Lab Exam
1. What will happen if you use JOptionPane. showInputDialog statement in your
program?
Select one:
a. The program will display message dialog box returns String value.
b. The program will display an input dialog box that allows the user to input text and
returns String value.
c. The program will display message dialog box.
d. The program will display an input dialog box that allows the user to input text and
returns the correct type value.
e. None of these
2. What is the output of the code snippet below:
void main(){
test(1.0);
test(1);}
void test(double x){
System.out.print(x); }
void test(int x){
System.out.print(x);}
Select one:
a. 1.01
b. 1.0
c. 11
d. 1.01.0
e. None of the choices
3. Which is not a decision control structure?
Select one:
,a. if else-if else
b. if
c. switch
d. if else
e. None of these
4. What will happen if you use JOptionPane.showMessageDialog statement in your
program? The program will display message dialog box.
5. Which of the following shows Overloading method?
Select one:
a. void test(int x){} void test(int y){}
b. All of these
c. void test(){} void test(){}
d. void test(int x){} void test(double x){}
6. What will be the value of x after executing this code
for(int x=0; x<=10; x++) {} is run?
Select one:
a. 1
b. 0
c. 11
d. 10
e. None of these
7. Which of the following correctly accesses the sixth element stored in an array of
10 elements?
Select one:
a. intArray[7];
b. stringArray[5];
c. intArray[10];
d. intArray[6];
, e. None of these
8. What is the output of the code snippet below:
void main(){test(“11”);test(“1”);}
void test(String x){System.out.print(x + x);}
Select one:
a. 222
b. None of the choices
c. 111111
111
d. 6
9. Which of the following is a valid nexDouble() return value?
Select one:
a. floating-point literal
b. double value
c. 12.0
d. All of these
e. 3.1416
10. Which of the following is a valid nextByte() return value?
Select one:
a. None of these
b. int value
c. 128
d. short value
e. 3
11. What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);
Select one:
Midterm Lab Exam
1. What will happen if you use JOptionPane. showInputDialog statement in your
program?
Select one:
a. The program will display message dialog box returns String value.
b. The program will display an input dialog box that allows the user to input text and
returns String value.
c. The program will display message dialog box.
d. The program will display an input dialog box that allows the user to input text and
returns the correct type value.
e. None of these
2. What is the output of the code snippet below:
void main(){
test(1.0);
test(1);}
void test(double x){
System.out.print(x); }
void test(int x){
System.out.print(x);}
Select one:
a. 1.01
b. 1.0
c. 11
d. 1.01.0
e. None of the choices
3. Which is not a decision control structure?
Select one:
,a. if else-if else
b. if
c. switch
d. if else
e. None of these
4. What will happen if you use JOptionPane.showMessageDialog statement in your
program? The program will display message dialog box.
5. Which of the following shows Overloading method?
Select one:
a. void test(int x){} void test(int y){}
b. All of these
c. void test(){} void test(){}
d. void test(int x){} void test(double x){}
6. What will be the value of x after executing this code
for(int x=0; x<=10; x++) {} is run?
Select one:
a. 1
b. 0
c. 11
d. 10
e. None of these
7. Which of the following correctly accesses the sixth element stored in an array of
10 elements?
Select one:
a. intArray[7];
b. stringArray[5];
c. intArray[10];
d. intArray[6];
, e. None of these
8. What is the output of the code snippet below:
void main(){test(“11”);test(“1”);}
void test(String x){System.out.print(x + x);}
Select one:
a. 222
b. None of the choices
c. 111111
111
d. 6
9. Which of the following is a valid nexDouble() return value?
Select one:
a. floating-point literal
b. double value
c. 12.0
d. All of these
e. 3.1416
10. Which of the following is a valid nextByte() return value?
Select one:
a. None of these
b. int value
c. 128
d. short value
e. 3
11. What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);
Select one: