3rd year online test: Object Oriented Technology

Technical Grooming session for 3rd  year

Quiz1 on Object oriented technology

Which statement is not true in java language?

  • A public member of a class can be accessed in all the packages
  • private member of a class cannot be accessed by the methods of the same class.
  • A private member of a class cannot be accessed from its derived class.
  • A protected member of a class can be accessed from its derived class.

Multiple inheritance means,

  • one class inheriting from more super classes
  • more classes inheriting from one super class
  • more classes inheriting from more super classes
  • None of the above

To prevent any method from overriding, we declare the method as,

The fields in an interface are implicitly specified as,

Which of the following is not true?

  • An interface can extend another interface.
  • A class which is implementing an interface must implement all the methods of the interface.
  • An interface can implement another interface
  • An interface is a solution for multiple inheritance in java.

Which of the following is true?

  • A finally block is executed before the catch block but after the try block.
  • A finally block is executed, only after the catch block is executed.
  • A finally block is executed whether an exception is thrown or not.
  • A finally block is executed, only if an exception occurs.

Which of these keyword can be used in subclass to call the constructor of superclass?

  • super
  • this
  • extent
  • extends

What is the process of defining a method in subclass having same name & type signature as a method in its superclass?

Which of these is supported by method overriding in Java?

  • Abstraction
  • Encapsulation
  • Polymorphism
  • None of the mentioned

Which of these access specifiers must be used for main() method?

  • private
  • public
  • protected
  • None of the mentioned

Private members of class can be inherited by a sub class, and become protected members in sub class.

  • False
  • True

Which of these is correct way of inheriting class A by class B?

  • class B + class A {}
  • class B inherits class A {}
  • class B extends A {}
  • class B extends class A {}

Which of these is a mechanism for naming and visibility control of a class and its content?

  • Object
  • Packages
  • Interfaces
  • None of the Mentioned.

Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?

  • Public
  • Protected
  • No Modifier
  • All of the mentioned

Which of the following is correct way of importing an entire package ‘pkg’?

  • import pkg.
  • Import pkg.
  • import pkg.*
  • Import pkg.*