Interview Questions

Q:

Default constructor accepts how many arguments?

A) one B) two
C) three D) None
 
Answer & Explanation Answer: D) None

Explanation:

Default constructors has no arguments

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3488
Q:

What could be the bucket size if collision and overlapping occur at same time?

A) 2 B) 0
C) 1 D) 4
 
Answer & Explanation Answer: C) 1

Explanation:

One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 4612
Q:

In an AVL tree the balancing is to be done when the pivotal value is in range of

A) greater than 1 and less than -1 B) greater than -1 and less than 1
C) greater than 1 D) less than -1
 
Answer & Explanation Answer: A) greater than 1 and less than -1

Explanation:

Difference between the heights of left and Right subtrees in an AVL tree can never be greater than +1

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 5073
Q:

Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent  Postfix notations.

A) AC + B * DE - FG +^- B) AB + C * DE - FG + ^-
C) AC + B* DE - FG -+ ^ D) AB + C * DE - FG -+ ^
 
Answer & Explanation Answer: B) AB + C * DE - FG + ^-

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Java

4 4112
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 1642
Q:

try { int x = Integer.parseInt("two"); }

Which could be used to create an appropriate catch block?

A) ClassCastException B) IllegalStateException
C) NumberFormatException D) None
 
Answer & Explanation Answer: C) NumberFormatException

Explanation:

C is correct. 'Integer.parseInt' can throw a NumberFormatException, and IllegalArgumentException is its superclass 

Report Error

View Answer Report Error Discuss

Filed Under: Java

3 27638
Q:

class Hell {

public static void main(String[] args) {

Integer i = 42;

String s = (i<40)?"life":(i>50)?"base":"ball";

System.out.println(s);

}

}

A) null B) ball
C) base D) None
 
Answer & Explanation Answer: B) ball

Explanation:

D is correct. This is a ternary nested in a ternary with a little unboxing thrown in.Both of the ternary expressions are false.

Report Error

View Answer Report Error Discuss

Filed Under: Java

1 32009
Q:

Which method names follow the JavaBeans standard?

A) addSize B) putDimensions
C) getCust D) deleteRep
 
Answer & Explanation Answer: C) getCust

Explanation:

C use the valid prefixes 'get' and 'is

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 7454