Interview Questions

Q:

What is the difference between throw and throws clause?

Answer

A throw is used to throw an exception manually, where as throws is used in the case of checked exceptions, to tell the compiler that we haven't  handled the exception, so that the exception will be handled by the calling function.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1562
Q:

What are the various elements of OOPS?

Answer

Various elements of OOP are:


• Object


• Class


• Method


• Encapsulation


• Information Hiding


• Inheritance


• Polymorphism

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1644
Q:

A lock can be acquired on a class.

The above statement is

A) True B) False
C) Both A and B D) None
 
Answer & Explanation Answer: A) True

Explanation:

A lock can be acquired on a class. This lock is acquired on the class's Class object.

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 12749
Q:

Which of the following modifiers can be used with Local inner class?

A) Final or Abstract B) Final or Transcient
C) Abstract or Transcient D) Final or public
 
Answer & Explanation Answer: A) Final or Abstract

Explanation:

It can either be Final or Abstract

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 2606
Q:

How many types of classes are there in Java?

Answer

Two types of classes:


1) Top Level Class


2) Classes within Class


       i) member classes


             a) static member class


             b) non static member class


      ii) local classes


      iii) anonymous classes

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1568
Q:

If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

Answer

The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 7894
Q:

What is Overloading Polymorphism?

Answer

Overloading allows multiple functions to exist with same name but different parameters. Again if you take bike as an example, it has a function “Start” with two forms i.e. ’Auto Start’ and ’kick start’.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2154
Q:

In RDBMS, what is the efficient data structure used in the internal storage representation?

A) Stack B) Queue
C) B+ tree structure D) AVL tree Structure
 
Answer & Explanation Answer: C) B+ tree structure

Explanation:

B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 6175