Quiz About Java Abstract Class and Interface
Quiz About Java Abstract Class and Interface
Neither I nor II
Both I and II
Discuss it
Question 1 ‒ Explanation
Abstract data class is not used to create objects in Java and it is design
ed only to act as a base class to be inherited by other classes. Both Stat
ement are correct. For more information Refer:Abstract Classes in Java
Option (D) is correct.
Question 2
Discuss it
Question 2 ‒ Explanation
An abstract class is a class that is designed to be specifically used as
a base class. An abstract class contains at least one pure virtual funct
ion. A pure virtual function can be declared by using a pure specifier
( = 0 ) in the declaration of a virtual member function in the class de
claration. Option (C) is correct.
Question 3
Discuss it
Question 3 ‒ Explanation
Making atleast one member function as pure virtual function is the met
hod to make abstract class. For more information on Abstract Class Ref
er:Pure Virtual Functions and Abstract Classes in C++ Option (A) is corre
ct.
Question 4
which translates JDBC function calls into API not native to DBMS
Discuss it
Question 4 ‒ Explanation
JDBC type 4 driver,works directly by connecting to the database serv
er through socket connections and converts JDBC calls to vendor-sp
ecific database protocols.These drivers don\'t require any intermedia
te layer. So, option (C) is correct.
Question 5
Predict the output of the following program.
Java
a = 10
a = 20
Compilation error
Discuss it
Question 5 ‒ Explanation
Final method can’t be overridden. Thus, an abstract function can’t b
e final.
Question 6
Discuss it
Question 7
1, 3 and 4
1, 2 and 4
2, 3 and 4
1, 2, 3 and 4
Discuss it
Question 7 ‒ Explanation
Answer: (A)