gs gs128 Java Inheritance - Java Abstract Class and Super - 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 9 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 these keywords are used to define an abstract class?
abst
abstract
Abstract
abstract class
Question 2: Which of these is not abstract?
Thread
AbstractList
List
None of the Mentioned
Question 3: If a class inheriting an abstract class does not define all of its function then it will be known as?
Abstract
A simple class
Static class
None of the mentioned
Question 4: Which of these is not a correct statement?
Every class containing abstract method must be declared abstract
Abstract class defines only the structure of the class not its implementation
Abstract class can be initiated by new operator
Abstract class can be inherited
Question 5: Which of these packages contains abstract keyword?
java.lang
java.util
java.io
java.system
Question 6: What will be the output of the following Java code?
class A { public int i; private int j; } class B extends A { void display() { super.j = super.i + 1; System.out.println(super.i + " " + super.j); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }
2 2
3 3
Runtime Error
Compilation Error
Question 7: What will be the output of the following Java code?
class A { public int i; public int j; A() { i = 1; j = 2; } } class B extends A { int a; B() { super(); } } class super_use { public static void main(String args[]) { B obj = new B(); System.out.println(obj.i + " " + obj.j) } }
1 2
2 1
Runtime Error
Compilation Error