Java Interviews MCQs - Quiz

  • A Object cloning is the process of creating an exact copy of an object.
  • B Object cloning is the process of creating a new object using a copy constructor.
  • C Object cloning is the process of creating a new object with the same reference as the original object.
  • D Object cloning is not supported in Java.
  • A Yes, private methods can be overridden in Java.
  • B No, private methods cannot be overridden in Java.
  • C Private methods can be overridden but only within the same class.
  • D Private methods cannot be overridden but can be accessed using reflection.
  • A Yes, the main() method can be overloaded in Java.
  • B No, the main() method cannot be overloaded in Java.
  • C Overloading the main() method is possible, but it is considered bad practice.
  • D Overloading the main() method is possible, but it will cause a runtime error.
  • A It refers to the current instance of the class.
  • B It refers to the superclass of the current class.
  • C It refers to the static context of the class.
  • D It refers to the object being passed as a parameter to a method.
  • A Java objects are stored in a stack memory.
  • B Java objects are stored in a heap memory.
  • C Java objects are stored in a separate memory space called the "object memory."
  • D Java objects are stored in a cache memory.
  • A An abstract class is a class that cannot be instantiated and can only be inherited.
  • B An abstract class is a class that can be instantiated but cannot be inherited.
  • C An abstract class is a class that can only contain abstract methods.
  • D An abstract class is a class that can only contain static methods.
  • A It would lead to ambiguity and confusion during method resolution.
  • B It violates the principles of object-oriented programming.
  • C Java does not support dynamic dispatch based on return types.
  • D All of the above.
  • A Multiple inheritance and operator overloading
  • B Garbage collection and exception handling
  • C Polymorphism and encapsulation
  • D Dynamic memory allocation and function templates
  • A The "super" keyword is used to refer to the immediate subclass of a class.
  • B The "super" keyword is used to invoke the superclass constructor or method.
  • C The "super" keyword is used to specify a superclass in a multiple inheritance scenario.
  • D The "super" keyword is used to define static variables in a class.
  • A The program will fail to compile.
  • B The program will compile and run, but the main method will not be executed.
  • C The program will compile and run, but it will generate a runtime error.
  • D The program will compile and run normally.