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 the following is a valid declaration of an object of class Box? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
2. |
Which of the following is a method having same name as that of it’s class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: A constructor is a method that initializes an object immediately upon creation. It has the same name as that of class in which it resides. |
3. |
Which of the following is a method having same name as that of its class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: A constructor is a method that initializes an object immediately upon creation. It has the same name as that of class in which it resides. |
4. |
Which of these is correct about passing an argument by call-by-value process? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: When we pass an argument by call-by-value a copy of argument is made into the formal parameter of the subroutine and changes made on parameters of subroutine have no effect on original argument, they remain the same. |
5. |
Which of these is used as default for a member of a class if no access specifier is used for it? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: When we pass an argument by call-by-value a copy of argument is made into the formal parameter of the subroutine and changes made on parameters of subroutine have no effect on original argument, they remain the same. |
6. |
Which of these cannot be declared static? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: static statements are run as soon as class containing then is loaded, prior to any object declaration. |
7. |
Which of these keywords is used to refer to member of base class from a sub class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Whenever a subclass needs to refer to its immediate superclass, it can do so by use of the keyword super. |
8. |
A class member declared protected becomes member of subclass of which type? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: A class member declared protected becomes private member of subclass. |
9. |
Which of these keywords can be used to prevent Method overriding? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: To disallow a method from being overridden, specify final as a modifier at the start of its declaration. Methods declared as final cannot be overridden. |
10. |
Which of these method of Object class is used to obtain class of an object at run time? |
|||||||||||||||||||
|