gs gs128 Java Inheritance - Method Overriding in Java - Quiz No.1
gs gs128 Java Quiz
This quiz belongs to book/course code gs gs128 Java of gs organization. We have 136 quizzes available related to the book/course Java. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Java Inheritance. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: Which of this keyword can be used in a subclass to call the constructor of superclass?
super
this
extent
extends
Question 2: What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?
Method overloading
Method overriding
Method hiding
None of the mentioned
Question 3: Which of these keywords can be used to prevent Method overriding?
static
constant
protected
final
Question 4: Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?
super(void);
superclass.();
super.A();
super();
Question 5: At line number 2 in the following code, 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; }
final, native, private
final, static, protected
final, private, abstract
final, static, public
Question 6: Which of these is supported by method overriding in Java?
Abstraction
Encapsulation
Polymorphism
None of the mentioned
Question 9: What will be the output of the following Java program?
class Abc { public static void main(String[]args) { String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0]: null; } }
Compilation error
An exception is thrown at run time
The variable first is set to null
The variable first is set to elements[0]