TATA ELXSI Previous Years Solved Sample Placement Papers
-
What is an interface in Java?
A: A class
B: A data type
C: A blueprint for a class
D: A data structure
Ans: C -
Which keyword is used to implement an interface?
A: extends
B: new
C: interface
D: implements
Ans: D -
Can an interface extend another interface in Java?
A: No
B: Yes
Ans: B -
Can an interface have a constructor?
A: Yes
B: No
Ans: B -
Which of the following access modifiers are implicitly applied to variables in an interface?
A: private
B: protected
C: public
D: default
Ans: C -
Is it possible to create an instance of an interface?
A: Yes
B: No
Ans: B -
How many interfaces can a Java class implement?
A: None
B: Only one
C: Two
D: As many as needed
Ans: D -
Can an interface inherit from a class?
A: Yes
B: No
Ans: B -
Which of the following can be used to create a custom checked exception?
A: Extending the Exception class
B: Extending the Error class
C: Extending the RuntimeException class
D: None of the above
Ans: A -
Which of these is an unchecked exception?
A: ClassNotFoundException
B: SQLException
C: IOException
D: ArithmeticException
Ans: D -
Which keyword is used to manually throw an exception in Java?
A: new
B: throw
C: throws
D: Throwable
Ans: B -
Which of these classes is the superclass of all Exception and Error classes?
A: Exception
B: Error
C: Throwable
D: Object
Ans: C -
What does the finally block do?
A: Catches any exception
B: Executes whether an exception is thrown or not
C: Executes only when an exception is thrown
D: Executes only when an exception is not thrown
Ans: B -
Which keyword in Java is used for constant variables?
A: const
B: static
C: constant
D: final
Ans: D -
In Java, what is the primary purpose of the Thread class?
A: File handling
B: String operations
C: Network operations
D: Creating and executing threads
Ans: D -
Which method is used to start the execution of a thread?
A: run()
B: start()
C: execute()
D: go()
Ans: B