Compr2 Final Exam
Compr2 Final Exam
Compr2 Final Exam
1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 765321
b. The given code is not valid
c. 123567
d. 12356
Feedback
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Can be express in scientific notation.
b. By default it is double type.
c. An integer literal with decimal point.
d. It could be double or float value.
e. All of the choices
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. false
b. true
c. “a”
d. The code is not valid
e. None of the choices
Question 4
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Generating bytecode
b. Reading bytecode
c. Interpreting bytecode
Feedback
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Class
b. Object
c. one of the choice
d. Constructor
e. Method
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Encapsulation
b. Object
c. Object Oriented
d. None of the choices
e. Class
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. class Person{}
b. public abstract class Person {}
c. public class Person {}
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
What will be the value of x if we execute this: String s = "25"; int x = Integer.parseInt(s); ?
Select one:
a. None of the choices
b. int 25
c. String 25
d. 0
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. public
b. static
c. name
d. true
e. None of the choices
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. none of the choices
b. short
c. byte
d. long
e. String
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. public interface [InterfaceName] {}
b. interface: [InterfaceName]
c. public class interface [InterfaceName] {}
d. public [InterfaceName] {}
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. public no_override void setName(){}
b. None of the choices
c. public static void setName(){}
d. public final void setName(){}
Question 13
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 1
b. test
c. int
d. return 1
Feedback
Question 14
Complete
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. Class Code
d. None of the choices
e. Byte Code
Question 15
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. It will produce an exception.
b. It will display “a[1]”.
c. It will display nothing.
Question 16
Complete
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. 19
b. 20
c. 0
d. 21
e. None of the choices
Question 17
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. java HelloWorld
b. javac HelloWorld
c. java HelloWorld.java
d. javac HelloWorld.java
Feedback
Question 18
Complete
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.nextShort();
c. int num = scan.getInt();
Question 19
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. class Person{}
b. public class Person {}
c. None of the choices
d. public final class Person {}
Question 20
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 7
b. 6
c. int
d. test
Feedback
Question 21
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Object Oriented
b. Platform independent
c. Robust
d. High Performance
Feedback
Question 22
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. javac HelloWorld.java
b. javac HelloWorld
c. java HelloWorld.java
d. java HelloWorld
Feedback
Question 23
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. A user has entered an invalid data.
b. A file that needs to be opened cannot be found.
c. All of the choices
d. A network connection has been lost in the middle of communications or the JVM has run
out of memory.
Question 24
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 12.0
b. All of the choices
c. 3.1416
d. floating-point literal
e. double value
Feedback
Question 25
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. <packageName>;
b. package <packageName>;
c. <modifier> package <packageName>;
d. <packageName> package;
Feedback
Question 26
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. All of the choice
b. int[][][][] intArray;
c. int intArray[][][];
d. int[][] intArray;
e. int[][][] intArray;
Feedback
Question 27
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following creates an instance of a class?
Select one:
a. Test t = new Test();
b. String str = new String();
c. Object obj = new Object();
d. All of the choices
Question 28
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. public class Person use [InterfaceName] {}
b. public class Person apply [InterfaceName] {}
c. public class Person implements [InterfaceName] {}
d. public class Person extends [InterfaceName] {}
Question 29
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the choices
b. class Person{}
c. public final class Person {}
d. public class Person {}
Question 30
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 128
b. None of the Choice
c. 1
d. 236
e. 512
Feedback
Question 31
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Syntax errors are usually typing errors.
b. Incorrect capitalization leads to syntax error.
c. All of the above.
d. None of the choices
e. You will have syntax errors if you misspell the Java command.
Question 32
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. true
b. “a”
c. false
Question 33
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Class
b. Constructor
c. Object
d. Method
e. None of the choices
Question 34
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. if
b. None of the choices
c. else
d. name
e. goto
Question 35
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Object
b. Encapsulation
c. Class
d. Object Oriented
e. None of the choices
Question 36
Complete
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. Runtime errors occur during run-time.
d. None of the choices
e. All of the choices
Question 37
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. void test(char x, int y){} void test(int x, char y){}
b. void test(){} void test(){}
c. None of the choices
d. All of the Choices
Question 38
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Which of the following is the correct way to call the constructor of the parent class?
Select one:
a. super()
b. this()
c. super.call()
d. this.call()
Question 39
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. String x = “0”; int y = x;
b. None of the choices
c. short x=1; int y = x;
d. All of the choices
Question 40
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. All of the choices
b. BlueJ
c. Notepad
d. eclipse
e. NetBeans
Question 41
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. “a”
b. false
c. None of the choices
d. The code is not valid
e. true
Question 42
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. 1.0
b. 11
c. 1.01.0
d. 1.01
Feedback
Question 43
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. C
b. NetBeans
c. Javad
d. Oak
e. None of the choices
Question 44
Complete
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. 1
d. 11
Feedback
Question 45
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Class Method
b. Object Variable
c. Class Variable
d. None of the choices
e. Static Variable
Question 46
Complete
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(){} void test(){}
c. void test(int x){} void test(double x){}
Question 47
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Select one:
a. display 111
b. display 1
c. display 1234
d. display 1111
Feedback
Question 48
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. 5
b. 6
c. 4
d. 7
Feedback
Question 49
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question 50
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. Constructors does not have any return value
b. It can only be called by using the new operator during class instantiation.
c. All of the choices
d. Constructors have the same name as the class
Finish review