gs gs128 Java Inheritance - Object Class 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 these class is superclass of every class in Java?
String class
Object class
Abstract class
ArrayList class
Question 2: Which of these method of Object class can clone an object?
Objectcopy()
copy()
Object clone()
clone()
Question 3: Which of these method of Object class is used to obtain class of an object at run time?
get()
void getclass()
Class getclass()
None of the mentioned
Question 4: Which of these keywords can be used to prevent inheritance of a class?
super
constant
class
final
Question 5: Which of these keywords cannot be used for a class which has been declared final?
abstract
extends
abstract and extends
none of the mentioned
Question 6: Which of these class relies upon its subclasses for complete implementation of its methods?
Object class
abstract class
ArrayList class
None of the mentioned
Question 7: What will be the output of the following Java program?
abstract class A { int i; abstract void display(); } class B extends A { int j; void display() { System.out.println(j); } } class Abstract_demo { public static void main(String args[]) { B obj = new B(); obj.j=2; obj.display(); } }
0
2
Runtime Error
Compilation Error
Question 9: What will be the output of the following Java code?
class Output { public static void main(String args[]) { Object obj = new Object(); System.out.print(obj.getclass()); } }
Object
class Object
class java.lang.Object
Compilation Error
Question 10: What will be the output of the following Java code?
class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); System.out.print(obj1.toString()); } }
true
false
String associated with obj1
Compilation Error