Sunday, 9 November 2014

Java Quiz Question and Answers - Part 3

                          Java Quiz Exam Oriented

Question 1: Which of these is data type long literal?
Select one:
a. ABCDEFG
b. 99671246
c. 0x99fffa
d. 0x99fffL

Question 2: JIT stands for
Select one:
a. Java Interpreter Time
b. Just In Time
c. Just In Text  
d. Job In Time

Question 3:  You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
Select one:
a. public
b. private
c. transient
d. protected

Question 4:  What is stored in the object obj in following lines of code?
                    box obj;
 Select one:
a. garbage
b. Any arbitrary pointer
c. Memory address of allocated memory of object.
d. null

Question 5: What is the output for the below code?
public class A {
int k;
boolean istrue;
static int p;
public void printValue() {
System.out.print(k);
System.out.print(istrue);
System.out.print(p);
}
}
public class Test{
public static void main(String argv[]){
A a = new A();
a.printValue();
}
}
Select one:

a. 0 0 0
b. Compile error ­ static variable must be initialized before use
c. 0 true 0
d. 0 false 0

Question 6:
we can't write constructor explicitly in the class.
Select one:

True
False

Question 7: Which four options describe the correct default values for array elements of the types indicated?
int -> 0
String ­-> "null"
Dog ­-> null
char ­-> '\u0000'
float ­-> 0.0f
boolean ­-> true
Select one:
a. 2, 4, 5, 6
b. 3, 4, 5, 6
c. 1, 3, 4, 5
d. 1, 2, 3, 4

Question 8: jvm is machine dependent.
Select one:
True
False

Question 9: Which of the following statements is correct?
Select one:
a. public method is accessible to all other classes in the hierarchy
b. public method is accessible only to subclasses of its parent class
c. public method can be accessed by calling object of the public class. Incorrect
d. public method can only be called by object of its class.

Continued...





0 comments:

Post a Comment