Instruction
- Total number of questions : 10.
- Time alloted : 10 minutes.
- Each question carry 1 mark.
- No Negative marks
- DO NOT refresh the page.
- All the best :-).
1. |
Which of these statement is incorrect? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Every class does not need to have a main() method, there can be only one main() method which is made public. |
2. |
Which of these statement is incorrect? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: All object of class share a single copy of methods defined in a class, Methods are allotted memory only once. All the objects of the class have access to methods of that class are allotted memory only for the variables not for the methods. |
3. |
Which function is used to perform some action when the object is to be destroyed? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
4. |
What is the output of the following code? class San { public void m1 (int i,float f) { System.out.println(" int float method"); } public void m1(float f,int i); { System.out.println("float int method"); } public static void main(String[]args) { San s=new San(); s.m1(20,20); } } |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: While resolving overloaded method, compiler automatically promotes if exact match is not found. But in this case, which one to promote is an ambiguity. |
5. |
Which of the following statements are incorrect? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: private members of a class can not be inherited by a sub class. |
6. |
Which of the following statements are incorrect? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
7. |
Which of the following statements are incorrect? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Strings in Java are immutable that is they can not be modified. |
8. |
What is the output of this program? class A { public int i; protected int j; } class B extends A { int j; void display() { super.j = 3; System.out.println(i + " " + j); } } class Output { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } } |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Both class A & B have member with same name that is j, member of class B will be called by default if no specifier is used. I contains 1 & j contains 2, printing 1 2. |
9. |
At line number 2 below, choose 3 valid data-type attributes/qualifiers among “final, static, native, public, private, abstract, protected” public interface Status { /* insert qualifier here */ int MY_VALUE = 10; } |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: Every interface variable is implicitly public static and final. |