JAVA Practical Quiz Ans

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Roll No.

_______________ Name: _________________________________

JAVA Practical Quiz

Max Marks: 15 Time: 15 mins

1. The ___new______ operator creates a single instance of a named class, returning a reference to that
object.

2. The memory available for the objects is called a_______heap_______.

3. To convert a larger value into smaller value, the _______explicit________ cast must be used.

4. Constructors can not be overridden. True/False true

5. When a program does not want to handle exceptions, the ______ throws____ clause is used.

6. The ________read()_______ method without any parameters returns an integer representation of the next
available byte of input.

7. Any method belonging to an interface, which is implemented within a class should be declared
as____public___.

8. Which of the following manages a list of database drivers in JDBC?


A - DriverManager ans B - JDBC driver C - Connection D - Statement
9. What is an Interface?
A - An interface is a collection of abstract methods. B - Interface is an abstract class.
C - Interface is an concrete class. Ans D - None of the above.
10. Which of the following is not a keyword in java?
A - static B - exit ans C - void C - private
11. Can we have two public classes in one java file? True/False ans
12. When finally block gets executed?
A - Always when try block get executed, no matter exception occured or not. ans
B - Always when a method get executed, no matter exception occured or not.
C - Always when a try block get executed, if exception do not occur.
D - Only when exception occurs in try block code.
13. If I don't provide any arguments on the command line, then the String array of Main method will be
empty or null? It is empty. But not null.

14. Can you declare the main method as final? Yes, such as, public static final void main(String[] args){}.

15.  Can you achieve Runtime Polymorphism by data members? Yes/ No

No.

You might also like