Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Multiple Choice Questions

Q551: Which of the following exceptions is automatically thrown by the JVM in case of an out-of-bounds error?
  • A: RuntimeException
  • B: Error
  • C: IOException
  • D: Exception
View Answer
B

Q552: Which of the following is NOT a valid reason to use the 'throws' clause in Java?
  • A: To declare that a method can throw checked exceptions
  • B: To declare that a method will handle exceptions
  • C: To allow exceptions to propagate to the caller
  • D: To specify the exceptions that a method can throw
View Answer
B

Q553: What is true about multiple inheritance in Java?
  • A: Java supports multiple inheritance via classes
  • B: Multiple inheritance can only be achieved using interfaces
  • C: Java allows classes to implement only one interface
  • D: Multiple inheritance is not supported in Java classes
View Answer
B

Q554: What happens if a subclass does not define the body for an abstract method?
  • A: The subclass will be abstract
  • B: The subclass will be instantiated
  • C: The abstract method will be skipped
  • D: The superclass method will be inherited
View Answer
A

Q555: Which of the following is a characteristic of public methods in Java?
  • A: They are accessible only within the same class
  • B: They must have a method body
  • C: They can be overridden in a subclass
  • D: They are only accessible in the same package
View Answer
C

Q556: What is the role of the 'super' keyword in Java constructors?
  • A: It calls the constructor of a subclass
  • B: It invokes a method of the superclass
  • C: It is used to access superclass fields
  • D: It is used to call the superclass constructor
View Answer
D

Q557: What happens if a method is defined as 'final' in a superclass?
  • A: The method cannot be inherited
  • B: The method cannot be overridden
  • C: The method cannot be accessed
  • D: The method cannot be executed
View Answer
B

Q558: Which keyword is used to prevent a method from being overridden in Java?
  • A: static
  • B: final
  • C: abstract
  • D: private
View Answer
B

Q559: What happens if a 'final' class is extended in Java?
  • A: Compilation error occurs
  • B: The subclass inherits all methods from the final class
  • C: The final class can be instantiated
  • D: Only final methods can be inherited
View Answer
A

Q560: Which class type can contain only method signatures but no method bodies?
  • A: Abstract class
  • B: Interface
  • C: Final class
  • D: Concrete class
View Answer
B

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now