Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Multiple Choice Questions

Q541: Which of the following cannot be instantiated in Java?
  • A: Abstract class
  • B: Concrete class
  • C: Interface
  • D: Package
View Answer
A

Q542: What does the 'extends' keyword signify in Java?
  • A: It creates a subclass
  • B: It makes a method final
  • C: It allows multiple inheritance
  • D: It imports methods from other packages
View Answer
A

Q543: Which of the following is true about abstract methods in Java?
  • A: They must have a method body
  • B: They are defined in abstract classes
  • C: They can be implemented in any class
  • D: They can only be used in interfaces
View Answer
B

Q544: What is the main difference between an interface and a class in Java?
  • A: An interface can have fields and methods
  • B: A class can only have methods
  • C: An interface can have only abstract methods
  • D: An interface has no constructors
View Answer
C

Q545: Which of the following is true about interfaces in Java?
  • A: An interface cannot have constructors
  • B: An interface can have both instance and static methods
  • C: An interface can have a constructor but not methods
  • D: An interface can be instantiated
View Answer
A

Q546: What is the purpose of the 'throws' clause in a method declaration?
  • A: It declares that a method can throw exceptions
  • B: It declares the method's return type
  • C: It defines the method's parameters
  • D: It handles exceptions
View Answer
A

Q547: Which of the following is true about exception handling in Java?
  • A: Exceptions are only handled during runtime
  • B: Every catch block must specify an exception class
  • C: Exceptions are never thrown by JVM
  • D: Only checked exceptions need to be handled
View Answer
B

Q548: Which of the following is an unchecked exception in Java?
  • A: NullPointerException
  • B: IOException
  • C: SQLException
  • D: InterruptedException
View Answer
A

Q549: What is the difference between checked and unchecked exceptions in Java?
  • A: Checked exceptions are not related to JVM errors
  • B: Unchecked exceptions must be caught in a try block
  • C: Checked exceptions are caught only in runtime
  • D: Unchecked exceptions do not require handling by the compiler
View Answer
A

Q550: What is the significance of the 'finally' block in Java exception handling?
  • A: It is executed only if no exception occurs
  • B: It is executed only if an exception occurs
  • C: It is always executed after the try block
  • D: It is used to declare exceptions
View Answer
C

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now