Comprog 2 Finals
Comprog 2 Finals
Select one:
a. public abstract class Person {}
b. class Person{}
c. public class Person {}
Question 2
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. 10
c. 11
d. 1
Feedback
Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the choices
b. void test(char x, int y){} void test(int x, char y){}
c. void test(int x){} void test(int y){}
d. All of the Choices
Question 4
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 5
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Reading bytecode
b. Interpreting bytecode
c. Generating bytecode
Feedback
Question 6
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the choices
b. Incorrect capitalization leads to syntax error.
c. You will have syntax errors if you misspell the Java command.
d. All of the above.
e. Syntax errors are usually typing errors.
Question 7
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. java HelloWorld
b. javac HelloWorld
c. javac HelloWorld.java
d. java HelloWorld.java
Feedback
Question 8
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. It will display the value of a[1].
b. It will produce an exception.
c. It will display “a[1]”.
Question 9
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Select one:
a. It can only be called by using the new operator during class instantiation.
b. Constructors does not have any return value
c. All of the choices
d. Constructors have the same name as the class
Question 10
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. It could be double or float value.
b. An integer literal with decimal point.
c. Can be express in scientific notation.
d. By default it is double type.
e. All of the choices
Question 11
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. package <packageName>;
b. <packageName> package;
c. <modifier> package <packageName>;
d. <packageName>;
Feedback
Question 12
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. All of the choices
b. A user has entered an invalid data.
c. A network connection has been lost in the middle of communications or the JVM has run
out of memory.
d. A file that needs to be opened cannot be found.
Question 13
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. Platform independent
c. Multithreaded
d. Code Security
e. None of the choices
Question 14
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. int
b. test
c. return 1
d. 1
Feedback
Question 15
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Select one:
a. 765321
b. The given code is not valid
c. 12356
d. 123567
Feedback
Question 16
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. 1.0
b. 1.01
c. 1.01.0
d. 11
Feedback
Question 17
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Constructor
b. one of the choice
c. Class
d. Object
e. Method
Question 18
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Platform independent
b. Robust
c. Object Oriented
d. High Performance
Feedback
Question 19
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Runtime errors occur when there is a design flaw in your program
b. Runtime errors occur after compilation.
c. All of the choices
d. Runtime errors occur during run-time.
Question 20
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. print "Hello World"
b. print "Hello World" infinitely
c. The code will not run because of syntax error
d. Do nothing
Feedback
Question 21
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. nextDouble()
b. nextLong()
c. nextShort()
d. nextInt()
Question 22
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 6
b. test
c. int
d. 7
Feedback
Question 23
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Encapsulation
b. Class
c. Object Oriented
d. None of the choices
e. Object
Question 24
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. implements
b. None of the choices
c. inherits
d. derives
e. extends
Question 25
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. void test(){} void test(){}
b. void test(int x){} void test(double x){}
c. All of the Choices
Question 26
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. 21
b. 0
c. None of the choices
d. 19
e. 20
Question 27
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. all of the choices
b. 1.2345E+3
c. 3.4028235E+38F
d. 12345678910F
e. 2.23
Feedback
Flag question
Question text
Select one:
a. floating-point literal
b. 3.1416
c. double value
d. 12.0
Question 29
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. String
b. none of the choices
c. short
d. byte
e. long
Question 30
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Instance Variable
b. Accessor
c. Method
d. None of the choices
e. Mutator
Question 31
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the Choice
b. 512
c. 128
d. 1
e. 236
Feedback
Question 32
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. display 1
b. display 111
c. display 1234
d. display 1111
Feedback
Question 33
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. NetBeans
b. All of the choices
c. eclipse
d. BlueJ
e. Notepad
Question 34
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 7
b. 5
c. 6
d. 4
Feedback
Question 35
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. goto
b. None of the choices
c. if
d. else
e. name
Question 36
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. true
b. false
c. “a”
Question 37
Not answered
Marked 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.getInt();
b. short num = scan.nextShort();
c. int num = scan.nextInt();
Question 38
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Select one:
a. javac
b. j
c. java
d. class
e. None of the choices
Question 39
Incorrect
Mark 0.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. 4
d. 2
Feedback
Question 40
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. this
b. accessor method
c. mutator method
d. method
Question 41
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Select one:
a. 7
b. 4
c. 5
d. 6
Feedback
Question 42
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. int[][][][] intArray;
b. All of the choice
c. int[][] intArray;
d. int intArray[][][];
e. int[][][] intArray;
Feedback
Question 43
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. javac HelloWorld
b. java HelloWorld.java
c. java HelloWorld
d. javac HelloWorld.java
Feedback
Question 44
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Question 45
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Oak
b. C
c. None of the choices
d. Javad
e. NetBeans