TATA ELXSI Previous Years Solved Sample Placement Papers
-
What does the join() method do when called on a thread object?
A: Terminates the thread
B: Pauses the thread
C: Forces the current executing thread to wait until the thread it's called on completes
D: Checks the status of a thread
Ans: C -
Which method can be used to momentarily pause the execution of the current thread?
A: sleep()
B: wait()
C: pause()
D: stop()
Ans: A -
Which interface provides an alternative to extending the Thread class?
A: Runnable
B: Callable
C: Executor
D: Parallel
Ans: A -
What is a daemon thread in Java?
A: A thread that monitors and logs other threads
B: A thread that runs continuously in the background
C: A thread that manages memory usage
D: A thread that is part of the Java virtual machine
Ans: B -
Which interface represents a collection of objects in which duplicate values can be stored?
A: List
B: Set
C: Map
D: ListMap
Ans: A -
What is the purpose of the "super" keyword in Java?
A: To refer to the current object
B: To invoke the superclass constructor or methods
C: To create multiple instances of a class
D: To hide data and methods within a class
Ans: B -
What is the purpose of the "this" keyword in Java?
A: To refer to the superclass
B: To create multiple instances of a class
C: To hide data and methods within a class
D: To refer to the current object
Ans: D -
What is the purpose of the "final" keyword in Java?
A: To prevent the inheritance of a class
B: To prevent overriding of a method
C: To prevent modification of a variable's value
D: All of the above
Ans: D -
Can an interface method be declared as final?
A: Yes
B: No
Ans: B -
In Java 9, which type of methods can be added to interfaces to share code between methods?
A: Static
B: Private
C: Final
D: Protected
Ans: B -
An interface with no methods is known as?
A: Abstract Interface
B: Marker Interface
C: Empty Interface
D: Functional Interface
Ans: B -
Which keyword is used to define a default method in an interface?
A: static
B: default
C: final
D: abstract
Ans: B -
Are all methods in an interface abstract?
A: Yes
B: No
Ans: B