Computer Programming 2 Prelim To Final Exam
Computer Programming 2 Prelim To Final Exam
1. Home
2. My courses
3. UGRD-ITE6201F-2213T
4. Final Examination
5. Final Exam
Flag question
Question text
Which of the following is true about syntax errors:
Select one:
a.
None of the choices
b.
You will have syntax errors if you misspell the Java command.
c.
All of the above.
d.
Syntax errors are usually typing errors.
e.
Incorrect capitalization leads to syntax error.
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
5
b.
4
c.
7
d.
6
Feedback
Your answer is correct.
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following scenarios where an exception may occur?
Select one:
a.
All of the choices
b.
A file that needs to be opened cannot be found.
c.
A user has entered an invalid data.
d.
A network connection has been lost in the middle of communications or the JVM has run
out of memory.
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What do you call a blueprint of an object?
Select one:
a.
Class
b.
Method
c.
one of the choice
d.
Constructor
e.
Object
Question 5
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
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.
1.01.0
d.
11
Feedback
Your answer is incorrect.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is the correct syntax to define a method?
Select one:
a.
<modifier> package <packageName>;
b.
package <packageName>;
c.
<packageName> package;
d.
<packageName>;
Feedback
Your answer is correct.
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x after you execute this statement
int z=0;
for(int x=0; x<10; x++)
for(int y=0; y<x; y++) z*=(x*y);
Select one:
a.
512
b.
128
c.
None of the Choice
d.
236
e.
1
Feedback
Your answer is correct.
Question 8
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is a valid multidimensional array?
Select one:
a.
int[][][] intArray;
b.
int[][][][] intArray;
c.
int intArray[][][];
d.
int[][] intArray;
e.
All of the choice
Feedback
Your answer is correct.
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is used to access the instance variables shadowed by the parameters.
Select one:
a.
accessor method
b.
method
c.
this
d.
mutator method
Question 10
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is a valid editor for java source code?
Select one:
a.
eclipse
b.
All of the choices
c.
NetBeans
d.
Notepad
e.
BlueJ
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What keyword is used to perform class inheritance?
Select one:
a.
None of the choices
b.
inherits
c.
implements
d.
extends
e.
derives
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){
System.out.print(intArray[x]);
}
Select one:
a.
The given code is not valid
b.
123567
c.
765321
d.
12356
Feedback
Your answer is correct.
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about constructor?
Select one:
a.
It can only be called by using the new operator during class instantiation.
b.
Constructors have the same name as the class
c.
Constructors does not have any return value
d.
All of the choices
Question 14
Correct
Mark 2.00 out of 2.00
Flag question
Question text
It used to read values from class variables?
Select one:
a.
Mutator
b.
Method
c.
None of the choices
d.
Accessor
e.
Instance Variable
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the maximum index of the array:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
4
b.
5
c.
6
d.
7
Feedback
Your answer is correct.
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to run Java program in command line?
Select one:
a.
javac HelloWorld
b.
java HelloWorld
c.
javac HelloWorld.java
d.
java HelloWorld.java
Feedback
Your answer is correct.
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the result if we execute this: “a”.equals(“a”);?
Select one:
a.
true
b.
The code is not valid
c.
“a”
d.
false
Feedback
Your answer is correct.
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a valid Float value?
Select one:
a.
all of the choices
b.
2.23
c.
1.2345E+3
d.
12345678910F
e.
3.4028235E+38F
Feedback
Your answer is correct.
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
Select one:
a.
12
b.
11
c.
1
d.
10
Feedback
Your answer is correct.
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code:
int a[] = new int[1];
System.out.println(a[1]);
Select one:
a.
It will display nothing.
b.
It will display the value of a[1].
c.
It will produce an exception.
d.
It will display “a[1]”.
Feedback
Your answer is correct.
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following does not return numeric value?
Select one:
a.
nextInt()
b.
nextShort()
c.
None of the choices
d.
nextLong()
e.
nextDouble()
Feedback
Your answer is correct.
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid nexDouble() return value?
Select one:
a.
double value
b.
12.0
c.
3.1416
d.
All of the choices
e.
floating-point literal
Feedback
Your answer is correct.
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
what will be the output if you execute this code?
int x=2;
switch(x){
case 1:
System.out.print(“1”);
case 2:
System.out.print(“1”);
case 3:
System.out.print(“1”);
default:
System.out.print(“1”);
}
Select one:
a.
display 111
b.
display 1
c.
display 1111
d.
display 1234
Feedback
Your answer is correct.
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about Runtime errors
Select one:
a.
Runtime errors occur after compilation.
b.
Runtime errors occur when there is a design flaw in your program
c.
All of the choices
d.
Runtime errors occur during run-time.
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a java keyword?
Select one:
a.
name
b.
goto
c.
None of the choices
d.
if
e.
else
Question 26
Correct
Mark 2.00 out of 2.00
Flag question
Question text
The feature of Java which makes it possible to execute several tasks simultaneously.
Select one:
a.
Multithreaded
b.
Platform independent
c.
None of the choices
d.
Code Security
e.
Robust
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have
declared scan as Scanner.
Select one:
a.
int num = scan.nextInt();
b.
short num = scan.nextShort();
c.
int num = scan.nextLong();
d.
int num = scan.getInt();
Feedback
Your answer is correct.
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows a valid Overloading method?
Select one:
a.
void test(int x){} void test(int y){}
b.
void test(){} void test(){}
c.
All of the Choices
d.
None of the choices
e.
void test(char x, int y){} void test(int x, char y){}
Feedback
Your answer is correct.
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What did java generates after compiling the java source code?
Select one:
a.
Executable file
b.
Byte Code
c.
Image file
d.
None of the choices
e.
Class Code
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return value of this method: int test(){return 1;} ?
Select one:
a.
int
b.
1
c.
test
d.
return 1
Feedback
Your answer is correct.
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the name of this method: int test(){return 1;} ?
Select one:
a.
6
b.
test
c.
int
d.
7
Feedback
Your answer is correct.
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
Select one:
a.
1
b.
3
c.
2
d.
4
Feedback
Your answer is correct.
Question 33
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to compile Java program in command line?
Select one:
a.
javac HelloWorld.java
b.
javac HelloWorld
c.
java HelloWorld.java
d.
java HelloWorld
Feedback
Your answer is correct.
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the extension name of a Java Source code?
Select one:
a.
j
b.
None of the choices
c.
javac
d.
java
e.
class
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code?
do{
System.out.println("Hello World!");
}
while(true);
Select one:
a.
The code will not run because of syntax error
b.
print "Hello World"
c.
print "Hello World" infinitely
d.
Do nothing
Feedback
Your answer is correct.
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid identifier?
Select one:
a.
public
b.
static
c.
None of the choices
d.
name
e.
true
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following class declaration is not allowed to be inherited?
Select one:
a.
public final class Person {}
b.
public abstract class Person {}
c.
public class Person {}
d.
class Person{}
Feedback
Your answer is correct.
Question 38
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is not a primitive data type?
Select one:
a.
long
b.
String
c.
none of the choices
d.
short
e.
byte
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is the method of hiding certain elements of the implementation of a certain class?
Select one:
a.
Class
b.
Encapsulation
c.
Object
d.
Object Oriented
e.
None of the choices
Question 40
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is floating-point literal?
Select one:
a.
An integer literal with decimal point.
b.
By default it is double type.
c.
All of the choices
d.
It could be double or float value.
e.
Can be express in scientific notation.
Question 41
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The Java feature, "write once, run anywhere", is termed as
Select one:
a.
Robust
b.
High Performance
c.
Platform independent
d.
Object Oriented
Feedback
Your answer is correct.
Question 42
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What was the initial name of the Java programming language?
Select one:
a.
C
b.
NetBeans
c.
Oak
d.
Javad
e.
None of the choices
Question 43
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the index number of the last element of an array with 20 elements?
Select one:
a.
0
b.
20
c.
21
d.
None of the choices
e.
19
Question 44
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the function of JVM?
Select one:
a.
Reading bytecode
b.
Interpreting bytecode
c.
Generating bytecode
Feedback
Your answer is correct.
Question 45
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows Overloading method?
Select one:
a.
. void test(int x){} void test(int y){}
b.
void test(int x){} void test(double x){}
c.
void test(){} void test(){}
d.
All of the Choices
Feedback
Your answer is correct.
Finish review
◄ Midterm Lab Exam
Jump to...
Flag question
Question text
Which of the following is not a java keyword?
Select one:
a.
None of the choices
b.
goto
c.
else
d.
if
e.
name
Question 2
Correct
Mark 2.00 out of 2.00
Flag question
Question text
The feature of Java which makes it possible to execute several tasks simultaneously.
Select one:
a.
Platform independent
b.
Multithreaded
c.
None of the choices
d.
Code Security
e.
Robust
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows a valid Overloading method?
Select one:
a.
void test(char x, int y){} void test(int x, char y){}
b.
All of the Choices
c.
void test(int x){} void test(int y){}
d.
void test(){} void test(){}
e.
None of the choices
Feedback
Your answer is correct.
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid editor for java source code?
Select one:
a.
eclipse
b.
Notepad
c.
BlueJ
d.
All of the choices
e.
NetBeans
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){
System.out.print(intArray[x]);
}
Select one:
a.
The given code is not valid
b.
123567
c.
765321
d.
12356
Feedback
Your answer is correct.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the function of JVM?
Select one:
a.
Generating bytecode
b.
Reading bytecode
c.
Interpreting bytecode
Feedback
Your answer is correct.
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It used to read values from class variables?
Select one:
a.
None of the choices
b.
Mutator
c.
Accessor
d.
Method
e.
Instance Variable
Question 8
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is true about constructor?
Select one:
a.
It can only be called by using the new operator during class instantiation.
b.
All of the choices
c.
Constructors have the same name as the class
d.
Constructors does not have any return value
Question 9
Correct
Mark 2.00 out of 2.00
Flag question
Question text
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.0
b.
11
c.
1.0
d.
1.01
Feedback
Your answer is correct.
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What did java generates after compiling the java source code?
Select one:
a.
Executable file
b.
Image file
c.
None of the choices
d.
Byte Code
e.
Class Code
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following does not return numeric value?
Select one:
a.
nextLong()
b.
None of the choices
c.
nextDouble()
d.
nextInt()
e.
nextShort()
Feedback
Your answer is correct.
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about Runtime errors
Select one:
a.
Runtime errors occur when there is a design flaw in your program
b.
Runtime errors occur after compilation.
c.
Runtime errors occur during run-time.
d.
All of the choices
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about syntax errors:
Select one:
a.
Incorrect capitalization leads to syntax error.
b.
Syntax errors are usually typing errors.
c.
None of the choices
d.
All of the above.
e.
You will have syntax errors if you misspell the Java command.
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code:
int a[] = new int[1];
System.out.println(a[1]);
Select one:
a.
It will display “a[1]”.
b.
It will produce an exception.
c.
It will display the value of a[1].
d.
It will display nothing.
Feedback
Your answer is correct.
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
what will be the output if you execute this code?
int x=2;
switch(x){
case 1:
System.out.print(“1”);
case 2:
System.out.print(“1”);
case 3:
System.out.print(“1”);
default:
System.out.print(“1”);
}
Select one:
a.
display 1
b.
display 111
c.
display 1234
d.
display 1111
Feedback
Your answer is correct.
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the result if we execute this: “a”.equals(“a”);?
Select one:
a.
“a”
b.
true
c.
false
d.
The code is not valid
Feedback
Your answer is correct.
Question 17
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is a valid nexDouble() return value?
Select one:
a.
double value
b.
12.0
c.
3.1416
d.
All of the choices
e.
floating-point literal
Feedback
Your answer is correct.
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following scenarios where an exception may occur?
Select one:
a.
A network connection has been lost in the middle of communications or the JVM has run
out of memory.
b.
All of the choices
c.
A user has entered an invalid data.
d.
A file that needs to be opened cannot be found.
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a valid Float value?
Select one:
a.
3.4028235E+38F
b.
1.2345E+3
c.
all of the choices
d.
2.23
e.
12345678910F
Feedback
Your answer is correct.
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What do you call a blueprint of an object?
Select one:
a.
Class
b.
Method
c.
one of the choice
d.
Object
e.
Constructor
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
7
b.
4
c.
5
d.
6
Feedback
Your answer is correct.
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The Java feature, "write once, run anywhere", is termed as
Select one:
a.
Object Oriented
b.
High Performance
c.
Robust
d.
Platform independent
Feedback
Your answer is correct.
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x after you execute this statement
int z=0;
for(int x=0; x<10; x++)
for(int y=0; y<x; y++) z*=(x*y);
Select one:
a.
512
b.
128
c.
1
d.
236
e.
None of the Choice
Feedback
Your answer is correct.
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
Select one:
a.
4
b.
2
c.
3
d.
1
Feedback
Your answer is correct.
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a primitive data type?
Select one:
a.
byte
b.
none of the choices
c.
short
d.
long
e.
String
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is the method of hiding certain elements of the implementation of a certain class?
Select one:
a.
Class
b.
None of the choices
c.
Encapsulation
d.
Object Oriented
e.
Object
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return value of this method: int test(){return 1;} ?
Select one:
a.
return 1
b.
int
c.
1
d.
test
Feedback
Your answer is correct.
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to run Java program in command line?
Select one:
a.
java HelloWorld.java
b.
javac HelloWorld
c.
javac HelloWorld.java
d.
java HelloWorld
Feedback
Your answer is correct.
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the maximum index of the array:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
4
b.
7
c.
6
d.
5
Feedback
Your answer is correct.
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What keyword is used to perform class inheritance?
Select one:
a.
inherits
b.
extends
c.
derives
d.
None of the choices
e.
implements
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to compile Java program in command line?
Select one:
a.
java HelloWorld.java
b.
java HelloWorld
c.
javac HelloWorld.java
d.
javac HelloWorld
Feedback
Your answer is correct.
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What was the initial name of the Java programming language?
Select one:
a.
Javad
b.
Oak
c.
None of the choices
d.
C
e.
NetBeans
Question 33
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the index number of the last element of an array with 20 elements?
Select one:
a.
0
b.
19
c.
None of the choices
d.
20
e.
21
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following class declaration is not allowed to be inherited?
Select one:
a.
public class Person {}
b.
public final class Person {}
c.
class Person{}
d.
public abstract class Person {}
Feedback
Your answer is correct.
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
Select one:
a.
11
b.
10
c.
12
d.
1
Feedback
Your answer is correct.
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
It is used to access the instance variables shadowed by the parameters.
Select one:
a.
mutator method
b.
method
c.
accessor method
d.
this
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is the correct syntax to define a method?
Select one:
a.
package <packageName>;
b.
<packageName> package;
c.
<packageName>;
d.
<modifier> package <packageName>;
Feedback
Your answer is correct.
Question 38
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid multidimensional array?
Select one:
a.
int[][][] intArray;
b.
int[][][][] intArray;
c.
int[][] intArray;
d.
int intArray[][][];
e.
All of the choice
Feedback
Your answer is correct.
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows Overloading method?
Select one:
a.
All of the Choices
b.
. void test(int x){} void test(int y){}
c.
void test(){} void test(){}
d.
void test(int x){} void test(double x){}
Feedback
Your answer is correct.
Question 40
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have
declared scan as Scanner.
Select one:
a.
int num = scan.nextInt();
b.
short num = scan.nextShort();
c.
int num = scan.getInt();
d.
int num = scan.nextLong();
Feedback
Your answer is correct.
Question 41
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid identifier?
Select one:
a.
None of the choices
b.
static
c.
name
d.
public
e.
true
Question 42
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the extension name of a Java Source code?
Select one:
a.
javac
b.
java
c.
j
d.
None of the choices
e.
class
Question 43
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the name of this method: int test(){return 1;} ?
Select one:
a.
int
b.
test
c.
6
d.
7
Feedback
Your answer is correct.
Question 44
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code?
do{
System.out.println("Hello World!");
}
while(true);
Select one:
a.
print "Hello World"
b.
Do nothing
c.
print "Hello World" infinitely
d.
The code will not run because of syntax error
Feedback
Your answer is incorrect.
Question 45
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is floating-point literal?
Select one:
a.
All of the choices
b.
By default it is double type.
c.
Can be express in scientific notation.
d.
It could be double or float value.
e.
An integer literal with decimal point.
Flag question
Question text
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
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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
Feedback
Your answer is correct.
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?
Select one:
a.
The program will display an input dialog box that allows the user to input text and returns
String value.
b.
None of these
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.
The program will display message dialog box returns String value.
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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){}
Feedback
Your answer is correct.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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
Feedback
Your answer is correct.
Question 7
Correct
Mark 2.00 out of 2.00
Flag question
Question text
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
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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
Feedback
Your answer is correct.
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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
Question 10
Correct
Mark 2.00 out of 2.00
Flag question
Question text
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
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);
Select one:
a.
The code will not run because of syntax error
b.
print "Hello World"
c.
None of these
d.
Do nothing
e.
print "Hello World" infinitely
Feedback
Your answer is correct.
Question 12
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = new int[10];
for(int x = 0; x<intArray.length; x++){System.out.print(intArray[x]);}
Select one:
a.
1235678910
b.
0000000000
c.
The given code is not valid
d.
012356789
e.
None of the choices
Feedback
Your answer is correct.
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x after you execute this statement
int z=0; for(int x=0; x<10; x++) for(int y=0; y<x; y++) z*=(x*y);
Select one:
a.
128
b.
236
c.
512
d.
1
e.
None of these
Feedback
Your answer is correct.
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows a valid Overloading method?
Select one:
a.
void test(char x, int y){} void test(int x, char y){}
b.
void test(int x){} void test(int y){}
c.
void test(){} void test(){}
d.
None of these
Feedback
Your answer is correct.
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?
Select one:
a.
7
b.
5
c.
4
d.
None of the choices
e.
6
Feedback
Your answer is correct.
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following correctly accesses the sixth element stored in an array of 10
elements?
Select one:
a.
stringArray[5];
b.
intArray[10];
c.
None of these
d.
intArray[7];
e.
intArray[6];
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which statement will check if x is less than y?
Select one:
a.
if (x<y);
b.
None of these
c.
if (x>y)
d.
if (x>y)?:
e.
if (x<>y)
Feedback
Your answer is correct.
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the index number of the last element of an array with 30 elements?
Select one:
a.
29
b.
None of these
c.
0
d.
30
e.
31
Question 19
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(true);
Select one:
a.
Do nothing
b.
The code will not run because of syntax error
c.
None of these
d.
print "Hello World"
e.
print "Hello World" infinitely
Feedback
Your answer is correct.
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
4
b.
None of the choices
c.
6
d.
7
e.
5
Feedback
Your answer is correct.
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid nextInt() return value?
Select one:
a.
long value
b.
1010
c.
floating-point literal
d.
3.1416
e.
None of these
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){System.out.print(intArray[x]);}
Select one:
a.
None of these
b.
765321
c.
12356
d.
The given code is not valid
e.
123567
Feedback
Your answer is correct.
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of the code snippet below: void main(){test();test();} void test()
{System.out.print(“1”);}
Select one:
a.
3
b.
2
c.
None of the choices
d.
1
e.
11
Feedback
Your answer is correct.
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following declares an array of int named intArray?
Select one:
a.
int[][] intArray;
b.
int[] intArray;
c.
int intArray[];
d.
All of these
e.
int intArray[][];
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return value of this method: int test(){return 1;} ?
Select one:
a.
1
b.
All of the choices
c.
test
d.
return 1
e.
int
Feedback
Your answer is correct.
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the name of this method: int test(){return 1;} ?
Select one:
a.
None of the choices
b.
int
c.
test
d.
7
e.
6
Feedback
Your answer is correct.
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid statement to accept String input?
Select one:
a.
String str = scan.nextString();
b.
string str = scan.nextShort();
c.
String str = JOptionPane.showInputDialog("");
d.
String num = scan.nextText();
e.
None of these
Question 28
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is a valid method name:
Select one:
a.
compute
b.
int
c.
compute grade
d.
final
e.
None of these
Feedback
Your answer is correct.
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which is not a repetition control structure?
Select one:
a.
None of these
b.
for
c.
switch
d.
do while
e.
while
Question 30
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the return type of this method: int test(){return 1;} ?
Select one:
a.
None of these
b.
1
c.
test()
d.
void
e.
int
Feedback
Your answer is correct.
Question 31
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
7
b.
6
c.
5
d.
4
e.
None of the choices
Feedback
Your answer is correct.
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What type of value does the nextLine() returns?
Select one:
a.
double
b.
String
c.
None of these
d.
long
e.
Line
Question 33
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have
declared scan as Scanner.
Select one:
a.
int num = scan.nextLong();
b.
short num = scan.nextInt();
c.
None of these
d.
short num = scan.nextShort();
e.
int num = scan.getInt();
Question 34
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the return value of this method: public void sum(){int x=1;} ?
Select one:
a.
None of the choices
b.
x
c.
sum
d.
void
e.
1
Feedback
Your answer is correct.
Question 35
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is a valid multidimensional array?
Select one:
a.
int intArray[][][];
b.
int[][][][] intArray;
c.
All of these
d.
int[][] intArray;
e.
int[][][] intArray;
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following does not return numeric value?
Select one:
a.
nextDouble()
b.
nextInt()
c.
nextShort()
d.
None of these
e.
nextLong()
Question 37
Correct
Mark 2.00 out of 2.00
Flag question
Question text
what will be the output if you execute this code?
int x=1;
switch(x){
case 1:
System.out.print(“1”);
case 2:
System.out.print(“1”);
case 3:
System.out.print(“1”);
default:
System.out.print(“1”);
}
Select one:
a.
None of these
b.
display 1234
c.
display 1111
d.
display nothing
e.
display 1
Feedback
Your answer is correct.
Question 38
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following has the correct form for an if statement?
Select one:
a.
boolean_expression
b.
if boolean_expression
c.
None of these
d.
if (boolean_expression)
e.
if boolean_expression
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following method reads input from the user and return String value?
Select one:
a.
nextString()
b.
nextLine()
c.
All of these
d.
nextText()
e.
nextValue()
Question 40
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which statement will check if x is equal to y?
Select one:
a.
if (x<>y)
b.
None of these
c.
if (x>y)
d.
if (x!<y)
e.
if (y>y)
Feedback
Your answer is correct.
Flag question
Question text
Which of the following is a valid nexDouble() return value?
Select one:
a.
All of these
b.
floating-point literal
c.
3.1416
d.
double value
e.
12.0
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which is not a repetition control structure?
Select one:
a.
switch
b.
for
c.
do while
d.
None of these
e.
while
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return type of this method: int test(){return 1;} ?
Select one:
a.
1
b.
void
c.
test()
d.
int
e.
None of these
Feedback
Your answer is correct.
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?
Select one:
a.
None of these
b.
The program will display message dialog box returns String value.
c.
The program will display an input dialog box that allows the user to input text and returns
String value.
d.
The program will display an input dialog box that allows the user to input text and returns
the correct type value.
e.
The program will display message dialog box.
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the output of the code snippet below: void main(){test();test();} void test()
{System.out.print(“1”);}
Select one:
a.
None of the choices
b.
2
c.
3
d.
11
e.
1
Feedback
Your answer is correct.
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows Overloading method?
Select one:
a.
void test(){} void test(){}
b.
All of these
c.
void test(int x){} void test(double x){}
d.
void test(int x){} void test(int y){}
Feedback
Your answer is correct.
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid nextByte() return value?
Select one:
a.
int value
b.
3
c.
short value
d.
None of these
e.
128
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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.
None of the choices
c.
1.0
d.
11
e.
1.01.0
Feedback
Your answer is correct.
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?
Select one:
a.
4
b.
7
c.
6
d.
5
e.
None of the choices
Feedback
Your answer is correct.
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);
Select one:
a.
print "Hello World" infinitely
b.
None of these
c.
print "Hello World"
d.
The code will not run because of syntax error
e.
Do nothing
Feedback
Your answer is correct.
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following correctly accesses the sixth element stored in an array of 10
elements?
Select one:
a.
intArray[6];
b.
None of these
c.
intArray[10];
d.
stringArray[5];
e.
intArray[7];
Question 12
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){System.out.print(intArray[x]);}
Select one:
a.
12356
b.
123567
c.
765321
d.
None of these
e.
The given code is not valid
Feedback
Your answer is correct.
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return value of this method: public void sum(){int x=1;} ?
Select one:
a.
sum
b.
x
c.
1
d.
None of the choices
e.
void
Feedback
Your answer is correct.
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following method reads input from the user and return String value?
Select one:
a.
nextText()
b.
nextLine()
c.
All of these
d.
nextString()
e.
nextValue()
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following has the correct form for an if statement?
Select one:
a.
if boolean_expression
b.
if boolean_expression
c.
boolean_expression
d.
None of these
e.
if (boolean_expression)
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the return value of this method: int test(){return 1;} ?
Select one:
a.
int
b.
All of the choices
c.
test
d.
1
e.
return 1
Feedback
Your answer is correct.
Question 17
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(true);
Select one:
a.
The code will not run because of syntax error
b.
None of these
c.
print "Hello World" infinitely
d.
print "Hello World"
e.
Do nothing
Feedback
Your answer is correct.
Question 18
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the name of this method: int test(){return 1;} ?
Select one:
a.
int
b.
6
c.
None of the choices
d.
test
e.
7
Feedback
Your answer is correct.
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What type of value does the nextLine() returns?
Select one:
a.
Line
b.
String
c.
double
d.
long
e.
None of these
Question 20
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have
declared scan as Scanner.
Select one:
a.
None of these
b.
short num = scan.nextInt();
c.
int num = scan.nextLong();
d.
int num = scan.getInt();
e.
short num = scan.nextShort();
Question 21
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = new int[10];
for(int x = 0; x<intArray.length; x++){System.out.print(intArray[x]);}
Select one:
a.
The given code is not valid
b.
012356789
c.
None of the choices
d.
1235678910
e.
0000000000
Feedback
Your answer is correct.
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following correctly accesses the sixth element stored in an array of 10
elements?
Select one:
a.
intArray[7];
b.
intArray[10];
c.
intArray[6];
d.
None of these
e.
stringArray[5];
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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
Feedback
Your answer is correct.
Question 24
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following is a valid statement to accept String input?
Select one:
a.
string str = scan.nextShort();
b.
String str = JOptionPane.showInputDialog("");
c.
String num = scan.nextText();
d.
String str = scan.nextString();
e.
None of these
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x after you execute this statement
int z=0; for(int x=0; x<10; x++) for(int y=0; y<x; y++) z*=(x*y);
Select one:
a.
None of these
b.
128
c.
236
d.
512
e.
1
Feedback
Your answer is correct.
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which statement will check if x is equal to y?
Select one:
a.
if (y>y)
b.
None of these
c.
if (x!<y)
d.
if (x>y)
e.
if (x<>y)
Feedback
Your answer is correct.
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid multidimensional array?
Select one:
a.
int intArray[][][];
b.
int[][] intArray;
c.
int[][][][] intArray;
d.
int[][][] intArray;
e.
All of these
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the index number of the last element of an array with 30 elements?
Select one:
a.
0
b.
31
c.
None of these
d.
30
e.
29
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following does not return numeric value?
Select one:
a.
nextDouble()
b.
nextShort()
c.
None of these
d.
nextLong()
e.
nextInt()
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?
Select one:
a.
The program will display an input dialog box that allows the user to input text and returns
String value.
b.
The program will display an input dialog box that allows the user to input text and returns
the correct type value.
c.
The program will display message dialog box.
d.
None of these
e.
The program will display message dialog box returns String value.
Question 31
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following declares an array of int named intArray?
Select one:
a.
int intArray[];
b.
All of these
c.
int[][] intArray;
d.
int intArray[][];
e.
int[] intArray;
Question 32
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid nextInt() return value?
Select one:
a.
1010
b.
None of these
c.
long value
d.
3.1416
e.
floating-point literal
Question 33
Correct
Mark 2.00 out of 2.00
Flag question
Question text
what will be the output if you execute this code?
int x=1;
switch(x){
case 1:
System.out.print(“1”);
case 2:
System.out.print(“1”);
case 3:
System.out.print(“1”);
default:
System.out.print(“1”);
}
Select one:
a.
display 1
b.
display nothing
c.
display 1111
d.
display 1234
e.
None of these
Feedback
Your answer is correct.
Question 34
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
None of the choices
b.
7
c.
6
d.
5
e.
4
Feedback
Your answer is correct.
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
7
b.
5
c.
None of the choices
d.
6
e.
4
Feedback
Your answer is correct.
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid method name:
Select one:
a.
None of these
b.
final
c.
int
d.
compute grade
e.
compute
Feedback
Your answer is correct.
Question 37
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which statement will check if x is less than y?
Select one:
a.
if (x>y)?:
b.
None of these
c.
if (x>y)
d.
if (x<>y)
e.
if (x<y);
Feedback
Your answer is correct.
Question 38
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following shows a valid Overloading method?
Select one:
a.
void test(int x){} void test(int y){}
b.
None of these
c.
void test(){} void test(){}
d.
void test(char x, int y){} void test(int x, char y){}
Feedback
Your answer is correct.
Question 39
Correct
Mark 1.00 out of 1.00
Flag question
Question text
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.
10
c.
None of these
d.
0
e.
11
Feedback
Your answer is correct.
Question 40
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which is not a decision control structure?
Select one:
a.
if else
b.
if else-if else
c.
switch
d.
if
e.
None of these
Flag question
Question text
Which of the following a valid Java identifier?
Select one:
a.
All of these
b.
id_1
c.
_id
d.
id
e.
$id
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Can we directly compile codes from NetBeans?
Select one:
a.
None of these
b.
Yes, because we can call Java compiler from NetBeans
c.
It depends, if there is a compiler embedded in NetBeans.
d.
No, we can only write codes in NetBeans
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What did java generates after compiling the java source code?
Select one:
a.
Byte Code
b.
Class Code
c.
Executable file
d.
Image file
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Why do we need to set the path for JavaC in command line?
Select one:
a.
To resolve syntax error
b.
It is part of the compilation process
c.
To resolve runtime error
d.
To make JavaC available or accessible in command line.
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to run Java program in command line?
Select one:
a.
java HelloWorld
b.
java HelloWorld.java
c.
javac HelloWorld
d.
javac HelloWorld.java
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What was the initial name for the Java programming language?
Select one:
a.
C
b.
NetBeans
c.
Oak
d.
Java
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)
Select one:
a.
There will be a logical error after compilation.
b.
There will be a syntax error after compilation.
c.
There will be no error after compilation.
d.
There will be a runtime error after compilation.
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not an escape sequence?
Select one:
a.
None of these
b.
\f
c.
\t
d.
\b
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the extension name of a Java Source code?
Select one:
a.
javac
b.
j
c.
class
d.
java
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following we are not allowed to write java source code?
Select one:
a.
None of these
b.
NetBeans
c.
BlueJ
d.
Notepad
e.
eclipse
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not the feature of java?
Select one:
a.
None of these
b.
Code Security
c.
Robust
d.
Static
e.
Platform independent
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to set JavaC path in command line?
Select one:
a.
< JavaC directory >
b.
C:\Program Files\Java\jdk1.6.0_23\bin
c.
All of the given choices are correct
d.
set path
e.
path C:\Program Files\Java\jdk1.6.0_23\bin
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the input for Java Compiler?
Select one:
a.
Native Code
b.
Code
c.
Byte Code
d.
Source Code
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is floating-point literal?
Select one:
a.
It could be double or float value.
b.
Can be express in scientific notation.
c.
By default it is double type.
d.
An integer literal with decimal point.
e.
All of these
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not Java Literal?
Select one:
a.
Character value
b.
Float value
c.
None of the above
d.
Integer value
e.
Boolean value
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The feature of Java which makes it possible to execute several tasks simultaneously.
Select one:
a.
Robust
b.
Multithreaded
c.
Platform independent
d.
Code Security
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
When was the officially released of Java?
Select one:
a.
1996
b.
1992
c.
1995
d.
1991
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Can we directly compile codes from notepad?
Select one:
a.
Yes, Because we can call Java compiler from notepad
b.
It depends, if there is a compiler embedded in Notepad.
c.
None of these
d.
No, We can only write codes in Notepad
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
JVM is responsible for
Select one:
a.
Generating bytecode
b.
Interpreting bytecode
c.
Reading bytecode
d.
Compiling source code
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a Java comment?
Select one:
a.
Single Line Comments
b.
Documentation Comments
c.
Declaration Comments
d.
None of these
e.
Multi-Line Comments
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to compile Java program in command line?
Select one:
a.
java HelloWorld
b.
javac HelloWorld
c.
javac HelloWorld.java
d.
java HelloWorld.java
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about syntax errors:
Select one:
a.
You will have syntax errors if you misspell the Java command.
b.
Incorrect capitalization leads to syntax error.
c.
Syntax errors are usually typing errors.
d.
All of these
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about Runtime errors:
Select one:
a.
Runtime errors occur when there is a design flaw in your program
b.
Runtime errors occur after compilation.
c.
None of these
d.
Runtime errors occur during run-time.
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a valid variable declaration in Java?
Select one:
a.
int x = 1;
b.
None of these
c.
float x = 2.0D;
d.
int x;
e.
short x;
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a valid Float value?
Select one:
a.
1.2345E+3
b.
1.23
c.
3.4028235E+38F
d.
12345678910F
e.
None of these
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a java keyword?
Select one:
a.
None of these
b.
name
c.
if
d.
goto
e.
else
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following we are not allowed to write java source code?
Select one:
a.
eclipse
b.
BlueJ
c.
NetBeans
d.
None of these
e.
Notepad
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid identifier?
Select one:
a.
static
b.
true
c.
None of these
d.
public
e.
name
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The Java feature, "write once, run anywhere", is termed as
Select one:
a.
Object Oriented
b.
Robust
c.
High Performance
d.
Platform independent
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a primitive data type?
Select one:
a.
None of these
b.
long
c.
byte
d.
String
e.
short
Flag question
Question text
Why do we need to set the path for JavaC in command line?
Select one:
a.
To make JavaC available or accessible in command line.
b.
To resolve syntax error
c.
It is part of the compilation process
d.
To resolve runtime error
Question 2
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about Runtime errors:
Select one:
a.
Runtime errors occur when there is a design flaw in your program
b.
Runtime errors occur during run-time.
c.
Runtime errors occur after compilation.
d.
None of these
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
When was the officially released of Java?
Select one:
a.
1995
b.
1992
c.
1996
d.
1991
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The Java feature, "write once, run anywhere", is termed as
Select one:
a.
Platform independent
b.
Object Oriented
c.
Robust
d.
High Performance
Question 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the extension name of a Java Source code?
Select one:
a.
j
b.
javac
c.
java
d.
class
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to set JavaC path in command line?
Select one:
a.
< JavaC directory >
b.
set path
c.
C:\Program Files\Java\jdk1.6.0_23\bin
d.
path C:\Program Files\Java\jdk1.6.0_23\bin
e.
All of the given choices are correct
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid identifier?
Select one:
a.
static
b.
name
c.
None of these
d.
true
e.
public
Question 8
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a valid Float value?
Select one:
a.
12345678910F
b.
None of these
c.
3.4028235E+38F
d.
1.23
e.
1.2345E+3
Question 9
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is floating-point literal?
Select one:
a.
It could be double or float value.
b.
By default it is double type.
c.
Can be express in scientific notation.
d.
An integer literal with decimal point.
e.
All of these
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following we are not allowed to write java source code?
Select one:
a.
eclipse
b.
NetBeans
c.
None of these
d.
BlueJ
e.
Notepad
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a Java comment?
Select one:
a.
Documentation Comments
b.
None of these
c.
Single Line Comments
d.
Declaration Comments
e.
Multi-Line Comments
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)
Select one:
a.
There will be a logical error after compilation.
b.
There will be no error after compilation.
c.
There will be a runtime error after compilation.
d.
There will be a syntax error after compilation.
Question 13
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to run Java program in command line?
Select one:
a.
java HelloWorld.java
b.
javac HelloWorld
c.
java HelloWorld
d.
javac HelloWorld.java
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to compile Java program in command line?
Select one:
a.
java HelloWorld
b.
java HelloWorld.java
c.
javac HelloWorld
d.
javac HelloWorld.java
Question 15
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following a valid Java identifier?
Select one:
a.
id_1
b.
All of these
c.
id
d.
_id
e.
$id
Question 16
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the input for Java Compiler?
Select one:
a.
Native Code
b.
Byte Code
c.
Code
d.
Source Code
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not the feature of java?
Select one:
a.
Platform independent
b.
Code Security
c.
Static
d.
Robust
e.
None of these
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Can we directly compile codes from NetBeans?
Select one:
a.
No, we can only write codes in NetBeans
b.
It depends, if there is a compiler embedded in NetBeans.
c.
Yes, because we can call Java compiler from NetBeans
d.
None of these
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following we are not allowed to write java source code?
Select one:
a.
eclipse
b.
Notepad
c.
BlueJ
d.
NetBeans
e.
None of these
Question 20
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Can we directly compile codes from notepad?
Select one:
a.
Yes, Because we can call Java compiler from notepad
b.
No, We can only write codes in Notepad
c.
It depends, if there is a compiler embedded in Notepad.
d.
None of these
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not Java Literal?
Select one:
a.
Integer value
b.
Float value
c.
Character value
d.
Boolean value
e.
None of the above
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
The feature of Java which makes it possible to execute several tasks simultaneously.
Select one:
a.
Code Security
b.
Multithreaded
c.
Robust
d.
Platform independent
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a valid variable declaration in Java?
Select one:
a.
short x;
b.
None of these
c.
int x;
d.
float x = 2.0D;
e.
int x = 1;
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a primitive data type?
Select one:
a.
byte
b.
long
c.
None of these
d.
String
e.
short
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
JVM is responsible for
Select one:
a.
Reading bytecode
b.
Compiling source code
c.
Interpreting bytecode
d.
Generating bytecode
Question 26
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not a java keyword?
Select one:
a.
name
b.
else
c.
None of these
d.
goto
e.
if
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is true about syntax errors:
Select one:
a.
Incorrect capitalization leads to syntax error.
b.
You will have syntax errors if you misspell the Java command.
c.
All of these
d.
Syntax errors are usually typing errors.
Question 28
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is not an escape sequence?
Select one:
a.
\f
b.
\b
c.
None of these
d.
\t
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What did java generates after compiling the java source code?
Select one:
a.
Byte Code
b.
Executable file
c.
Class Code
d.
Image file
Question 30
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
What was the initial name for the Java programming language?
Select one:
a.
Java
b.
Oak
c.
C
d.
NetBeans
State Finished
Marks 5.00/5.00
Question 1
Correct
Flag question
Question text
What are the Logical Operators?
a.
1. NOR
2. XOR
3. NOT
b.
1. AND
2. OR
3. NOT
c.
1. EXCLUSIVE OR
2. EXCLUSIVE AND
3. EXCLUSIVE NOT
Feedback
Your answer is correct.
Question 2
Correct
Flag question
Question text
Which among these is a Error Identifier?
a.
_For_
b.
Life
c.
1Nothing
Feedback
Your answer is correct.
Question 3
Correct
Flag question
Question text
Test this code on your device, and what is the result?
package Exam_Experiment;
public class Exam_Test{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int a=15, b=5, c=30;
double d=0;
System.out.println("a:" + a + " " + "b:" + b + " " + "c:" + c + " " + "Initial
d:" + d);
d=a+b+c;
System.out.println(d);
}
}
a.
20
b.
50
c.
-30
Feedback
Your answer is correct.
Question 4
Correct
Flag question
Question text
What is the missing from this code:
package Exam2;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println(60)____
}
a.
b.
c.
.
Feedback
Your answer is correct.
Question 5
Correct
Flag question
Question text
Match the OPERATORS of the following:
|
Bitwise Inclusive OR Answer 1
~
One's Compliment Answer 2
&
Bitwise AND Answer 3
^
Bitwise Exclusive OR Answer 4
Feedback
Your answer is correct.
State Finished
Marks 30.00/30.00
Question 1
Correct
Flag question
Question text
What is the extension name of a Java Source code?
Select one:
a.
java
b.
class
c.
d.
javac
Question 2
Correct
Flag question
Question text
Which of the following is true about Runtime errors:
Select one:
a.
None of these
b.
c.
Question 3
Correct
Flag question
Question text
What was the initial name for the Java programming language?
Select one:
a.
Oak
b.
NetBeans
c.
Java
d.
C
Question 4
Correct
Flag question
Question text
Can we directly compile codes from notepad?
Select one:
a.
b.
c.
None of these
d.
Question 5
Correct
Question text
Why do we need to set the path for JavaC in command line?
Select one:
a.
b.
c.
d.
Question 6
Correct
Flag question
Question text
What did java generates after compiling the java source code?
Select one:
a.
Executable file
b.
Image file
c.
Byte Code
d.
Class Code
Question 7
Correct
Flag question
Question text
Which of the following a valid Java identifier?
Select one:
a.
id_1
b.
id
c.
All of these
d.
$id
e.
_id
Question 8
Correct
Flag question
Question text
Can we directly compile codes from NetBeans?
Select one:
a.
b.
None of these
c.
d.
Question 9
Correct
Flag question
Question text
Which of the following is not a Java comment?
Select one:
a.
Documentation Comments
b.
Declaration Comments
c.
d.
None of these
e.
Multi-Line Comments
Question 10
Correct
Flag question
Question text
What is the correct statement to compile Java program in command line?
Select one:
a.
java HelloWorld
b.
javac HelloWorld
c.
javac HelloWorld.java
d.
java HelloWorld.java
Question 11
Correct
Flag question
Question text
Which of the following we are not allowed to write java source code?
Select one:
a.
NetBeans
b.
eclipse
c.
Notepad
d.
BlueJ
e.
None of these
Question 12
Correct
Flag question
Question text
What is the correct statement to set JavaC path in command line?
Select one:
a.
b.
set path
d.
e.
C:\Program Files\Java\jdk1.6.0_23\bin
Question 13
Correct
Flag question
Question text
Which of the following is not a java keyword?
Select one:
a.
else
b.
None of these
c.
name
d.
goto
e.
if
Question 14
Correct
Flag question
Question text
Which of the following is not a valid Float value?
Select one:
a.
None of these
b.
12345678910F
c.
3.4028235E+38F
d.
1.23
e.
1.2345E+3
Question 15
Correct
Flag question
Question text
When was the officially released of Java?
Select one:
a.
1996
b.
1991
c.
1992
d.
1995
Question 16
Correct
Flag question
Question text
JVM is responsible for
Select one:
a.
Generating bytecode
b.
Interpreting bytecode
c.
Reading bytecode
d.
Question 17
Correct
Flag question
Question text
What is the correct statement to run Java program in command line?
Select one:
a.
java HelloWorld
b.
javac HelloWorld
c.
java HelloWorld.java
d.
javac HelloWorld.java
Question 18
Correct
Flag question
Question text
What is the input for Java Compiler?
Select one:
a.
Native Code
b.
Byte Code
c.
Code
d.
Source Code
Question 19
Correct
Question text
What is floating-point literal?
Select one:
a.
b.
All of these
c.
d.
e.
Question 20
Correct
Question text
What will happen if we compile the statement below? ~System.out.println(“Hello World!”)
Select one:
a.
b.
c.
d.
Question 21
Correct
Flag question
Question text
The Java feature, "write once, run anywhere", is termed as
Select one:
a.
Platform independent
b.
High Performance
c.
Robust
d.
Object Oriented
Question 22
Correct
Flag question
Question text
Which of the following we are not allowed to write java source code?
Select one:
a.
BlueJ
b.
NetBeans
c.
Notepad
d.
eclipse
e.
None of these
Question 23
Correct
Flag question
Question text
Which of the following is not a valid variable declaration in Java?
Select one:
a.
int x;
b.
None of these
c.
short x;
d.
int x = 1;
e.
float x = 2.0D;
Question 24
Correct
Flag question
Question text
Which of the following is a valid identifier?
Select one:
a.
name
b.
static
c.
public
d.
true
e.
None of these
Question 25
Correct
Flag question
Question text
Which of the following is not a primitive data type?
Select one:
a.
long
b.
String
c.
byte
d.
None of these
e.
short
Question 26
Correct
Flag question
Question text
Which of the following is not the feature of java?
Select one:
a.
Platform independent
b.
Code Security
c.
None of these
d.
Static
e.
Robust
Question 27
Correct
Flag question
Question text
Which of the following is not an escape sequence?
Select one:
a.
\t
b.
\b
c.
None of these
d.
\f
Question 28
Correct
Flag question
Question text
Which of the following is not Java Literal?
Select one:
a.
Float value
b.
Integer value
c.
Boolean value
d.
e.
Character value
Question 29
Correct
Flag question
Question text
The feature of Java which makes it possible to execute several tasks simultaneously.
Select one:
a.
Multithreaded
b.
Platform independent
c.
Robust
d.
Code Security
Question 30
Correct
Flag question
Question text
Which of the following is true about syntax errors:
Select one:
a.
b.
You will have syntax errors if you misspell the Java command.
c.
All of these
d.
State Finished
Marks 4.00/5.00
Question 1
Correct
Flag question
Question text
Match the following:
Answer 1
Nested IF - Else Statement
Answer 2
IF - Statement
Answer 3
Sw itch Statement
Feedback
Your answer is correct.
Question 2
Incorrect
Flag question
Question text
public class Main {
public static void main(String[] args) {
String[] cars = {"Mitsubishi", "BMW", "Ford", "Mazda"};
System.out.println(cars[2]);
}
}
a.
IF
b.
Do-while
c.
For-Loop
d.
Ford
Feedback
Your answer is incorrect.
Question 3
Correct
Flag question
Question text
public class Main {
String[]
public static void main(Answer args) {
for (int i = 0; i < 5; i++) {
System.out.println(i);
}
}
}
Question 4
Correct
Flag question
Question text
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}
True
False
Question 5
Correct
Flag question
Question text
public class Main {
public static void main(String[] args) {
int number = 15;
switch (number) {
case 13:
System.out.println("Thirteen");
break;
Answer
case 15:
System.out.println("Fifteen");
_________
default:
System.out.println("Undefined");
}
}
UGRD-ITE6104 Computer Programming 2
1. Home
2. My courses
3. UGRD-ITE6104-2213T
4. Midterm Examination
5. Midterm Exam
State Finished
Marks 49.00/50.00
Question 1
Correct
Flag question
Question text
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.
b.
1.0
c.
1.01.0
d.
11
e.
1.01
Feedback
Your answer is correct.
Question 2
Correct
Flag question
Question text
Which of the following is a valid nexDouble() return value?
Select one:
a.
All of these
b.
3.1416
c.
floating-point literal
d.
12.0
e.
double value
Question 3
Incorrect
Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have
declared scan as Scanner.
Select one:
a.
b.
None of these
c.
d.
e.
Question 4
Correct
Flag question
Question text
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.
10
c.
11
d.
0
e.
None of these
Feedback
Your answer is correct.
Question 5
Correct
Question text
What is the output of the code snippet below:
int[] intArray = new int[10];
for(int x = 0; x<intArray.length; x++){System.out.print(intArray[x]);}
Select one:
a.
b.
012356789
c.
d.
1235678910
e.
0000000000
Feedback
Your answer is correct.
Question 6
Correct
Flag question
Question text
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.
b.
111111
111
c.
222
d.
6
Feedback
Your answer is correct.
Question 7
Correct
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){System.out.print(intArray[x]);}
Select one:
a.
123567
b.
765321
c.
None of these
d.
12356
e.
Question 8
Correct
Flag question
Question text
What type of value does the nextLine() returns?
Select one:
a.
String
b.
Line
c.
long
d.
None of these
e.
double
Question 9
Correct
Flag question
Question text
What is the output of the code snippet below: void main(){test();test();} void test()
{System.out.print(“1”);}
Select one:
a.
b.
11
c.
d.
e.
Question 10
Correct
Flag question
Question text
Which of the following is a valid nextInt() return value?
Select one:
a.
floating-point literal
b.
None of these
c.
3.1416
d.
1010
e.
long value
Question 11
Correct
Flag question
Question text
Which of the following method reads input from the user and return String value?
Select one:
a.
nextValue()
b.
All of these
c.
nextString()
d.
nextText()
e.
nextLine()
Question 12
Correct
Flag question
Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(true);
Select one:
a.
Do nothing
b.
c.
d.
The code will not run because of syntax error
e.
None of these
Feedback
Your answer is correct.
Question 13
Correct
Flag question
Question text
What is the return value of this method: public void sum(){int x=1;} ?
Select one:
a.
void
b.
c.
sum
d.
e.
x
Feedback
Your answer is correct.
Question 14
Correct
Flag question
Question text
Which of the following is a valid statement to accept String input?
Select one:
a.
b.
c.
None of these
d.
e.
Question 15
Correct
Flag question
Question text
what will be the output if you execute this code?
int x=1;
switch(x){
case 1:
System.out.print(“1”);
case 2:
System.out.print(“1”);
case 3:
System.out.print(“1”);
default:
System.out.print(“1”);
}
Select one:
a.
None of these
b.
display 1111
c.
display 1234
d.
display nothing
e.
display 1
Feedback
Your answer is correct.
Question 16
Correct
Question text
Which of the following shows Overloading method?
Select one:
a.
b.
All of these
c.
d.
Question 17
Correct
Flag question
Question text
Which statement will check if x is less than y?
Select one:
a.
None of these
b.
if (x<>y)
c.
if (x>y)?:
d.
if (x>y)
e.
if (x<y);
Feedback
Your answer is correct.
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following has the correct form for an if statement?
Select one:
a.
boolean_expression
b.
if boolean_expression
c.
if boolean_expression
d.
if (boolean_expression)
e.
None of these
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is a valid method name:
Select one:
a.
compute
b.
final
c.
compute grade
d.
None of these
e.
int
Feedback
Your answer is correct.
Question 20
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the name of this method: int test(){return 1;} ?
Select one:
a.
b.
c.
int
d.
e.
test
Feedback
Your answer is correct.
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
b.
c.
d.
e.
6
Feedback
Your answer is correct.
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What will be the output if you execute this code?
do{System.out.println("Hello World!");}while(false);
Select one:
a.
b.
None of these
c.
d.
e.
Do nothing
Feedback
Your answer is correct.
Question 23
Correct
Flag question
Question text
Which of the following shows a valid Overloading method?
Select one:
a.
b.
None of these
c.
d.
Flag question
Question text
What is the return type of this method: int test(){return 1;} ?
Select one:
a.
int
b.
test()
c.
None of these
d.
void
e.
1
Feedback
Your answer is correct.
Question 25
Correct
Flag question
Question text
What will be the value of x after you execute this statement
int z=0; for(int x=0; x<10; x++) for(int y=0; y<x; y++) z*=(x*y);
Select one:
a.
None of these
b.
128
c.
512
d.
236
e.
1
Feedback
Your answer is correct.
Question 26
Correct
Flag question
Question text
Which of the following is a valid multidimensional array?
Select one:
a.
int[][] intArray;
b.
int intArray[][][];
c.
int[][][][] intArray;
d.
All of these
e.
int[][][] intArray;
Question 27
Correct
Flag question
Question text
What is the maximum index of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
b.
c.
d.
7
e.
6
Feedback
Your answer is correct.
Question 28
Correct
Flag question
Question text
Which of the following is a valid nextByte() return value?
Select one:
a.
short value
b.
int value
c.
None of these
d.
3
e.
128
Question 29
Correct
Flag question
Question text
What will happen if you use JOptionPane. showInputDialog statement in your program?
Select one:
a.
b.
None of these
c.
The program will display message dialog box returns String value.
d.
The program will display an input dialog box that allows the user to input text and returns
String value.
e.
The program will display an input dialog box that allows the user to input text and returns
the correct type value.
Question 30
Correct
Flag question
Question text
Which is not a repetition control structure?
Select one:
a.
for
b.
None of these
c.
switch
d.
while
e.
do while
Question 31
Correct
Flag question
Question text
Which of the following correctly accesses the sixth element stored in an array of 10
elements?
Select one:
a.
intArray[10];
b.
intArray[7];
c.
intArray[6];
d.
None of these
e.
stringArray[5];
Question 32
Correct
Flag question
Question text
What is the index number of the last element of an array with 30 elements?
Select one:
a.
b.
30
c.
31
d.
None of these
e.
29
Question 33
Correct
Flag question
Question text
Which is not a decision control structure?
Select one:
a.
if else
b.
if else-if else
c.
if
d.
None of these
e.
switch
Question 34
Correct
Flag question
Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[3]?
Select one:
a.
b.
c.
d.
None of the choices
e.
4
Feedback
Your answer is correct.
Question 35
Correct
Flag question
Question text
Which of the following declares an array of int named intArray?
Select one:
a.
All of these
b.
int[] intArray;
c.
int intArray[][];
d.
int[][] intArray;
e.
int intArray[];
Question 36
Correct
Flag question
Question text
Which of the following correctly accesses the sixth element stored in an array of 10
elements?
Select one:
a.
intArray[10];
b.
intArray[7];
c.
stringArray[5];
d.
None of these
e.
intArray[6];
Question 37
Correct
Flag question
Question text
Which statement will check if x is equal to y?
Select one:
a.
if (x<>y)
b.
if (y>y)
c.
if (x!<y)
d.
if (x>y)
e.
None of these
Feedback
Your answer is correct.
Question 38
Correct
Flag question
Question text
What is the return value of this method: int test(){return 1;} ?
Select one:
a.
test
b.
int
c.
d.
return 1
e.
Question 39
Correct
Flag question
Question text
What will happen if you use JOptionPane.showMessageDialog statement in your program?
Select one:
a.
The program will display an input dialog box that allows the user to input text and returns
the correct type value.
b.
The program will display message dialog box.
c.
None of these
d.
The program will display an input dialog box that allows the user to input text and returns
String value.
e.
The program will display message dialog box returns String value.
Question 40
Correct
Flag question
Question text
Which of the following does not return numeric value?
Select one:
a.
nextShort()
b.
None of these
c.
nextInt()
d.
nextLong()
e.
nextDouble()
State Finished
Marks 48.00/50.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is the correct syntax to define a method?
Select one:
a.
package <packageName>;
b.
c.
<packageName>;
d.
<packageName> package;
Feedback
Your answer is correct.
Question 2
Correct
Question text
Which of the following shows Overloading method?
Select one:
a.
b.
c.
d.
Question 3
Correct
Flag question
Question text
What keyword is used to perform class inheritance?
Select one:
a.
implements
b.
derives
c.
d.
extends
e.
inherits
Question 4
Correct
Flag question
Question text
Which of the following does not return numeric value?
Select one:
a.
b.
nextInt()
c.
nextDouble()
d.
nextShort()
e.
nextLong()
Feedback
Your answer is correct.
Question 5
Correct
Flag question
Question text
Which of the following is a valid editor for java source code?
Select one:
a.
eclipse
b.
NetBeans
c.
BlueJ
d.
Notepad
e.
Question 6
Correct
Flag question
Question text
What is the function of JVM?
Select one:
a.
Generating bytecode
b.
Interpreting bytecode
c.
Reading bytecode
Feedback
Your answer is correct.
Question 7
Correct
Flag question
Question text
what will be the output if you execute this code?
int x=2;
switch(x){
case 1:
System.out.print(“1”);
case 2:
System.out.print(“1”);
case 3:
System.out.print(“1”);
default:
System.out.print(“1”);
}
Select one:
a.
display 111
b.
display 1234
c.
display 1111
d.
display 1
Feedback
Your answer is correct.
Question 8
Correct
Flag question
Question text
Which of the following is not a primitive data type?
Select one:
a.
short
b.
long
c.
byte
d.
e.
String
Question 9
Correct
Flag question
Question text
What is floating-point literal?
Select one:
a.
b.
c.
d.
e.
Question 10
Correct
Flag question
Question text
The feature of Java which makes it possible to execute several tasks simultaneously.
Select one:
a.
Code Security
b.
Robust
c.
d.
Platform independent
e.
Multithreaded
Question 11
Correct
Flag question
Question text
What is the name of this method: int test(){return 1;} ?
Select one:
a.
int
b.
c.
d.
test
Feedback
Your answer is correct.
Question 12
Correct
Flag question
Question text
What is the return value of this method: int test(){return 1;} ?
Select one:
a.
test
b.
int
c.
return 1
d.
1
Feedback
Your answer is correct.
Question 13
Correct
Flag question
Question text
Which of the following is a valid nexDouble() return value?
Select one:
a.
12.0
c.
floating-point literal
d.
3.1416
e.
double value
Feedback
Your answer is correct.
Question 14
Correct
Flag question
Question text
Which of the following scenarios where an exception may occur?
Select one:
a.
A network connection has been lost in the middle of communications or the JVM has run
out of memory.
b.
c.
d.
Question 15
Correct
Flag question
Question text
Which of the following is a valid statement to accept int input? Let us assume that we have
declared scan as Scanner.
Select one:
a.
c.
d.
Question 16
Correct
Flag question
Question text
What is the length of the array: int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
7
b.
c.
d.
5
Feedback
Your answer is correct.
Question 17
Correct
Flag question
Question text
What is the extension name of a Java Source code?
Select one:
a.
b.
class
c.
d.
javac
e.
java
Question 18
Correct
Flag question
Question text
Which of the following is true about syntax errors:
Select one:
a.
b.
d.
e.
You will have syntax errors if you misspell the Java command.
Question 19
Correct
Flag question
Question text
Which of the following is true about Runtime errors
Select one:
a.
b.
d.
Question 20
Correct
Flag question
Question text
From the array int[] intArray = { 1, 2, 3, 5, 6, 7 };, what is the value of intArray[2]?
Select one:
a.
b.
c.
4
d.
2
Feedback
Your answer is correct.
Question 21
Correct
Flag question
Question text
What will be the value of x after executing this code for(int x=0; x<=11; x++) {} is run?
Select one:
a.
12
b.
10
c.
11
d.
1
Feedback
Your answer is correct.
Question 22
Correct
Flag question
Question text
What was the initial name of the Java programming language?
Select one:
a.
Oak
b.
Javad
c.
NetBeans
d.
e.
None of the choices
Question 23
Correct
Flag question
Question text
Which of the following is not a java keyword?
Select one:
a.
name
b.
else
c.
if
d.
e.
goto
Question 24
Correct
Flag question
Question text
What will be the value of x after you execute this statement
int z=0;
for(int x=0; x<10; x++)
for(int y=0; y<x; y++) z*=(x*y);
Select one:
a.
128
b.
c.
236
d.
512
e.
Question 25
Correct
Flag question
Question text
Which of the following is true about constructor?
Select one:
a.
b.
c.
It can only be called by using the new operator during class instantiation.
d.
Flag question
Question text
It used to read values from class variables?
Select one:
a.
Instance Variable
b.
c.
Mutator
d.
Accessor
e.
Method
Question 27
Correct
Flag question
Question text
It is the method of hiding certain elements of the implementation of a certain class?
Select one:
a.
Class
b.
Encapsulation
c.
Object
d.
e.
Object Oriented
Question 28
Correct
Flag question
Question text
What did java generates after compiling the java source code?
Select one:
a.
Image file
b.
Executable file
c.
Class Code
d.
e.
Byte Code
Question 29
Correct
Flag question
Question text
What is the output of the code snippet below:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
for(int x = intArray.length-1; x>=0; x--){
System.out.print(intArray[x]);
}
Select one:
a.
765321
b.
123567
c.
d.
12356
Feedback
Your answer is correct.
Question 30
Correct
Flag question
Question text
What is the correct statement to compile Java program in command line?
Select one:
a.
javac HelloWorld
b.
javac HelloWorld.java
c.
java HelloWorld
d.
java HelloWorld.java
Feedback
Your answer is correct.
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What is the correct statement to run Java program in command line?
Select one:
a.
javac HelloWorld.java
b.
javac HelloWorld
c.
java HelloWorld
d.
java HelloWorld.java
Feedback
Your answer is correct.
Question 32
Correct
Question text
Which of the following is a valid identifier?
Select one:
a.
public
b.
static
c.
name
d.
true
e.
Question 33
Correct
Question text
What will be the output if you execute this code?
do{
System.out.println("Hello World!");
}
while(true);
Select one:
a.
Do nothing
b.
c.
d.
Question 34
Correct
Question text
What is the maximum index of the array:
int[] intArray = { 1, 2, 3, 5, 6, 7 };
Select one:
a.
b.
c.
d.
6
Feedback
Your answer is correct.
Question 35
Correct
Question text
Which of the following is not a valid Float value?
Select one:
a.
3.4028235E+38F
b.
c.
12345678910F
d.
1.2345E+3
e.
2.23
Feedback
Your answer is correct.
Question 36
Correct
Question text
What is the index number of the last element of an array with 20 elements?
Select one:
a.
19
b.
21
c.
d.
e.
20
Question 37
Correct
Question text
The Java feature, "write once, run anywhere", is termed as
Select one:
a.
Object Oriented
b.
Robust
c.
Platform independent
d.
High Performance
Feedback
Your answer is correct.
Question 38
Correct
Flag question
Question text
What is the result if we execute this: “a”.equals(“a”);?
Select one:
a.
“a”
b.
c.
false
d.
true
Feedback
Your answer is correct.
Question 39
Correct
Flag question
Question text
What do you call a blueprint of an object?
Select one:
a.
Object
b.
Class
c.
Method
d.
Constructor
e.
Question 40
Incorrect
Flag question
Question text
What will be the output if you execute this code:
int a[] = new int[1];
System.out.println(a[1]);
Select one:
a.
b.
c.
d.
Question 41
Correct
Flag question
Question text
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.
11
b.
1.0
c.
1.01.0
d.
1.01
Feedback
Your answer is correct.
Question 42
Correct
Flag question
Question text
Which of the following shows a valid Overloading method?
Select one:
a.
b.
c.
d.
e.
Question 43
Correct
Flag question
Question text
Which of the following is a valid multidimensional array?
Select one:
a.
int intArray[][][];
b.
int[][][] intArray;
c.
int[][] intArray;
d.
e.
int[][][][] intArray;
Feedback
Your answer is correct.
Question 44
Correct
Flag question
Question text
Which of the following class declaration is not allowed to be inherited?
Select one:
a.
class Person{}
b.
c.
d.
Question 45
Incorrect
Flag question
Question text
It is used to access the instance variables shadowed by the parameters.
Select one:
a.
mutator method
b.
method
c.
accessor method
d.
this
State Finished
Marks 5.00/5.00
Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text
What do you called a problem that arises during the execution of a program?
exception
Answer:
Question 2
Correct
Flag question
Question text
Finally block defines following a try block or a catch block?
Select one:
True
False
Question 3
Correct
Flag question
Question text
What is the short Object-Oriented Programming?
OOP
Answer:
Question 4
Correct
Flag question
Question text
class Mathematics {
public void math() {
System.out.println("Mathematics Symbol");
}
}
class Main {
public static void main(String[] args) {
Mathematics myMath = new Mathematics(); // Create a Animal object
Mathematics myAdd = new Add(); // Create a Pig object
Mathematics mySubtract = new Subtract(); // Create a Dog object
myMath.____();
myAdd.____();
mySubtract.____();
}
}
Question 5
Correct
Flag question
Question text
Match the following:
Inheritance Class Hierarchy
Answer 1
Feedback
Your answer is correct.