JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Java interview questions part 1
Java interview questions part 1
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. Graphics class is available in _________package.
A. javax.swing
B. java.awt
C. java.io
D. java.lang
Show Correct Answer
Correct Answer is :
java.awt
2. Which of the following statements is true?
A. all methods are constructor
B. all constructor are method
C. Some constructor are method
D. no constructor is method
Show Correct Answer
Correct Answer is :
all constructor are method
3. Container is the __________ for component class.
A. base class
B. derived class
C. interface
D. None of these
Show Correct Answer
Correct Answer is :
base class
4. uppercase() and lowercase() methods are accessed by using ______ method .
A. object
B. class
C. interface
D. all of these
Show Correct Answer
Correct Answer is :
class
5. The methods and data of class Character are defined in the ____________ file
A. ASCII
B. UnicodeData
C. Txt file
D. Jar file
Show Correct Answer
Correct Answer is :
UnicodeData
6. Autocloseable was introduced in which Java version?
A. java SE 7
B. java SE 8
C. java SE 6
D. java SE 4
Show Correct Answer
Correct Answer is :
java SE 7
7. What is the alternative of using finally to close resource?
A. catch block
B. autocloseable interface to be implemented
C. try block
D. throw Exception
Show Correct Answer
Correct Answer is :
autocloseable interface to be implemented
8. Which of the below is a child interface of Autocloseable?
A. Closeable
B. Close
C. Auto
D. Cloneable
Show Correct Answer
Correct Answer is :
Closeable
9. It is a good practise to not throw which exception in close() method of autocloseable?
A. IOException
B. CustomException
C. InterruptedException
D. CloseException
Show Correct Answer
Correct Answer is :
InterruptedException
10. What is the output of below snippet?
A. Runtime Error
B. IOException
C. Compilation Error
D. Runs successfully
Show Correct Answer
Correct Answer is :
Runs successfully
11. What is the difference between AutoCloseable and Closeable?
A. Closeable is an interface and AutoCloseable is a concrete class
B. Closeable throws IOException; AutoCloseable throws Exception
C. Closeable is a concept; AutoCloseable is an implementation
D. Closeable throws Exception; AutoCloseable throws IOException
Show Correct Answer
Correct Answer is :
Closeable throws IOException; AutoCloseable throws Exception
12. What is the use of Flushable interface?
A. Flushes this stream by writing any buffered output to the underlying stream
B. Flushes this stream and starts reading again
C. Flushes this connection and closes it
D. Flushes this stream and throws FlushException
Show Correct Answer
Correct Answer is :
Flushes this stream by writing any buffered output to the underlying stream
13. Which version of java added Flushable interface?
A. java SE 7
B. java SE 8
C. java SE 6
D. java SE 5
Show Correct Answer
Correct Answer is :
java SE 5
14. Does close() implicitly flush() the stream.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
15. AutoCloseable and Flushable are part of which package?
A. Autocloseable java.lang; Flushable java.io
B. Autocloseable java.io; Flushable java.lang
C. Autocloseable and Flushable java.io
D. Autocloseable and Flushable java.lang
Show Correct Answer
Correct Answer is :
Autocloseable java.lang; Flushable java.io
16. What are the components of a marker interface?
A. Fields and methods
B. No fields, only methods
C. Fields, no methods
D. No fields, No methods
Show Correct Answer
Correct Answer is :
No fields, No methods
17. Which of the following is not a marker interface?
A. Serializable
B. Cloneable
C. Remote
D. Reader
Show Correct Answer
Correct Answer is :
Reader
18. What is not the advantage of Reflection?
A. Examine a class’s field and method at runtime
B. Construct an object for a class at runtime
C. Examine a class’s field at compile time
D. Examine an object’s class at runtime
Show Correct Answer
Correct Answer is :
Examine a class’s field at compile time
19. How private method can be called using reflection?
A. getDeclaredFields
B. getDeclaredMethods
C. getMethods
D. getFields
Show Correct Answer
Correct Answer is :
getDeclaredMethods
20. How private field can be called using reflection?
A. getDeclaredFields
B. getDeclaredMethods
C. getMethods
D. getFields
Show Correct Answer
Correct Answer is :
getDeclaredFields
Similar Interview Questions
Search for latest jobs
Find Jobs