Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

Question 

1
Complete
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. 765321
b. The given code is not valid
c. 123567

d. 12356
Feedback

Your answer is correct.

Question 2
Complete
Mark 1.00 out of 1.00

Flag question

Question text

What is floating-point literal?

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

What is the result if we execute this: “a”.equals(“a”);?

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

What is the function of JVM?

Select one:
a. Generating bytecode
b. Reading bytecode

c. Interpreting bytecode
Feedback

Your answer is correct.

Question 5
Complete
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. Object
c. one of the choice
d. Constructor
e. Method

Question 6
Complete
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. 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

Which of the following class declaration is not allowed to be inherited?

Select one:
a. class Person{}
b. public abstract class Person {}
c. public class Person {}

d. public final class Person {}


Feedback

Your answer is correct.

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

e. The code is not valid.


Feedback

Your answer is correct.

Question 9
Complete
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. name
d. true
e. None of the choices

Question 10
Complete
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 the choices
b. short
c. byte
d. long
e. String

Question 11
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is the correct way to define an interface?

Select one:
a. public interface [InterfaceName] {}
b. interface: [InterfaceName]
c. public class interface [InterfaceName] {}

d. public [InterfaceName] {}
Feedback

Your answer is correct.

Question 12
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following method is allowed to be overriden?

Select one:
a. public no_override void setName(){}
b. None of the choices
c. public static void setName(){}
d. public final void setName(){}

e. public void setName(){}


Feedback

Your answer is correct.

Question 13
Complete
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. test
c. int

d. return 1
Feedback

Your answer is correct.

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

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 produce an exception.
b. It will display “a[1]”.
c. It will display nothing.

d. It will display the value of a[1].


Feedback

Your answer is incorrect.

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

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
Feedback

Your answer is incorrect.

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();

d. int num = scan.nextInt();


Feedback

Your answer is correct.

Question 19
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following class declaration is not allowed to be instantiated?

Select one:
a. class Person{}
b. public class Person {}
c. None of the choices
d. public final class Person {}

e. public abstract class Person {}


Feedback
Your answer is correct.

Question 20
Complete
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. 7
b. 6
c. int

d. test
Feedback

Your answer is correct.

Question 21
Complete
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. Platform independent
c. Robust

d. High Performance
Feedback

Your answer is correct.

Question 22
Complete
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 23
Complete
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 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

Which of the following is a valid nexDouble() return value?

Select one:
a. 12.0
b. All of the choices
c. 3.1416
d. floating-point literal

e. double value
Feedback

Your answer is correct.

Question 25
Complete
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. <packageName>;
b. package <packageName>;
c. <modifier> package <packageName>;

d. <packageName> package;
Feedback

Your answer is correct.

Question 26
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is a valid multidimensional array?

Select one:
a. All of the choice
b. int[][][][] intArray;
c. int intArray[][][];
d. int[][] intArray;

e. int[][][] intArray;
Feedback

Your answer is correct.

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

e. String str = new String();


Feedback

Your answer is correct.

Question 28
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is the correct way to use an interface?

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] {}

e. None of the choices


Feedback

Your answer is correct.

Question 29
Complete
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. None of the choices
b. class Person{}
c. public final class Person {}
d. public class Person {}

e. public abstract class Person {}


Feedback

Your answer is correct.

Question 30
Complete
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. None of the Choice
c. 1
d. 236

e. 512
Feedback

Your answer is correct.

Question 31
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about syntax errors:

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

What is the result if we execute this: “a”.equals(“a”);?

Select one:
a. true
b. “a”
c. false

d. The code is not valid


Feedback

Your answer is correct.

Question 33
Complete
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. Constructor
c. Object
d. Method
e. None of the choices

Question 34
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is not a java keyword?

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

It is the method of hiding certain elements of the implementation of a certain class?

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

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. None of the choices
e. All of the choices

Question 37
Complete
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(){} void test(){}
c. None of the choices
d. All of the Choices

e. void test(int x){} void test(int y){}


Feedback

Your answer is correct.

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

Which of the following will do implicit cast? 

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

e. Object obj = new Object();


Feedback

Your answer is correct.

Question 40
Complete
Mark 0.00 out of 1.00

Flag question

Question text

Which of the following is a valid editor for java source code?

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

What is the result if we execute this: “a” instanceof String; ?

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

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.0
b. 11
c. 1.01.0

d. 1.01
Feedback

Your answer is incorrect.

Question 43
Complete
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. 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

Your answer is correct.

Question 45
Complete
Mark 1.00 out of 1.00

Flag question

Question text

What do you call a variable that belong to the whole class?

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){}

d. . void test(int x){} void test(int y){}


Feedback

Your answer is correct.

Question 47
Complete
Mark 0.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 1234

d. display 1111
Feedback

Your answer is incorrect.

Question 48
Complete
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. 6
c. 4

d. 7
Feedback

Your answer is correct.

Question 49
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following show casting object?


Select one:
a. SuperClass sc = new SuperClass(); SubClass sbc = new SubClass(); sbc = (SubClass) sc;
b. (className)     object;
c. Employee emp = new Employee(); VicePresident veep = new VicePresident(); veep =
(VicePresident)emp;

d. All of the choices


Feedback

Your answer is correct.

Question 50
Complete
Mark 1.00 out of 1.00

Flag question

Question text

Which of the following is true about constructor?

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

You might also like