Core Java Interview Questions
Below are some important interview questions. Choose the correct answer from the list of options.h
1) In an array, there will be —————-.
A) Collection of similar data types
B) Collection of dissimilar data types
C) Collection of Objects
D) Collection of methods
Click here for the Answer
Ans. A
2) Secondly, which of the following is a primitive data type?
A. byte
B. String
C. integer
D. class
Click Here for the Answer
Ans. A
3) What is the range of the char type?
A) 0 to 2^16
B) 0 to 2^15
C) 0 to 2^16-1
D) 0 to 2^15-1
Click Here for the Answer
Ans. C
Interview Questions on Core Java
4) What is the result of expression 5.45+ “3,2”?
A) The double value 8.6
B) The string “8.6.”
C) The long value 8.
D) The string “5.453,2.”
Click Here for the Answer
Ans. D
5) Which of the following is true?
1. wait() and notifyAll() are defined as final and can be called only from within a synchronized method.
2. Among wait(), notify(), notifyAll() the wait() method only throws IO Exception
3. wait(), notifyAll() & sleep() are methods of the object class.
A. 1
B. 2
C. 3
D. 1&2
E. 1, 2 & 3
Click Here for the Answer
Ans. A
6) Which three are true?
A) A static method cannot be synchronized
B) if a class has synchronized code, multiple threads can still access the non-synchronized code
C) Variables can be protected from concurrent access problems by making them with the synchronized keyword.
D) When a thread sleeps, it releases its locks.
E) When a thread invokes wait(), it releases its locks.
Click Here for the Answer
Ans. A, B, E
A Quick Look into Some Basic Questions on Java Programming
7) What is an example of polymorphism?
A) Inner class
B) Anonymous Classes
C) Method Overloading
D) Method Overriding
Click Here for the Answer
Ans. C, D
8) Which two of the following methods are defined in the class thread?
A) start()
B) wait()
C) notify()
D) run()
E) terminate ()
Click Here for the Answer
Ans. A, D
9) Among the following, which statements are true?
A) Memory is reclaimed by calling Runtime.gc().
B) Collection of objects is possible if they are accessible from live threads.
C) Objects with finalize() methods never generate garbage collection.
D) An OutOfMemory error occurs if it cannot find a single block of memory large enough for a specific requirement.
Click Here for the Answer
Ans. A
10) Moreover, due to ————–, Java exhibits different behavior.
A) Polymorphism
B) Inheritance
C) Serializable
D) Encapsulation
Click Here for the Answer
Ans. A
11) Lastly, which Of the following statements is true?
A) catch(X x) catches subclasses of X.
B) RuntimeException of the Error class.
C) All the statements that throw an Error should be enclosed within the try block.
D) All the statements that throw a RuntineException should be enclosed within the try block.
Click Here for the Answer
Ans. D
Importantly, to know more about Core Java Interview Questions, CLICK HERE.