Object Oriented Programming Using Java - Bca

25 Questions | Total Attempts: 54

SettingsSettingsSettings
Programming Quizzes & Trivia

.


Questions and Answers
  • 1. 
    Which of these package is used for graphical user interface?
    • A. 

      java.applet

    • B. 

      java.awt

    • C. 

      java.awt.image

    • D. 

      java.io

  • 2. 
    Which of these access specifiers can be used for an interface?
    • A. 

      Public

    • B. 

      Protected

    • C. 

      private

    • D. 

      All of the mentioned

  • 3. 
    Which of these keywords is used by a class to use an interface defined previously?
    • A. 

      import

    • B. 

      Import

    • C. 

      implements

    • D. 

      Implements

  • 4. 
    What is debugging an application which runs on another java virtual machine on another machine?
    • A. 

      virtual debugging

    • B. 

      remote debugging

    • C. 

      machine debugging

    • D. 

      compiling debugging

  • 5. 
    What happens when the value of variable change?
    • A. 

      changed value pop on the screen

    • B. 

      variable changes are printed in logs

    • C. 

      dump of variable changes are printed on the screen on end of execution

    • D. 

      variable tab shows variables highlighted when values change

  • 6. 
    Which of the following contains both date and time?
    • A. 

      java.io.date

    • B. 

      java.sql.date

    • C. 

      java.util.date

    • D. 

      java.util.dateTime

  • 7. 
    Which of the following is the correct way of importing an entire package ‘pkg’?
    • A. 

      import pkg.

    • B. 

      Import pkg.

    • C. 

      import pkg.*

    • D. 

      Import pkg.*

  • 8. 
    Which of the following is an incorrect statement about packages?
    • A. 

      Package defines a namespace in which classes are stored

    • B. 

      A package can contain other package within it

    • C. 

      Java uses file system directories to store packages

    • D. 

      A package can be renamed without renaming the directory in which the classes are stored

  • 9. 
    Which attribute is used to specify initialization method?
    • A. 

      init

    • B. 

      init-method

    • C. 

      initialization

    • D. 

      initialization-method

  • 10. 
    Which attribute is used to specify destroy method?
    • A. 

      destroy

    • B. 

      destroy-method

    • C. 

      destruction

    • D. 

      destruction-method

  • 11. 
    Which of these instance cannot be created?
    • A. 

      Integer instance

    • B. 

      Generic class instance

    • C. 

      Generic type instance

    • D. 

      Collection instances

  • 12. 
    Which of these data type cannot be type parameterized?
    • A. 

      Array

    • B. 

      List

    • C. 

      Map

    • D. 

      Set

  • 13. 
    What are generic methods?
    • A. 

      Generic methods are the methods defined in a generic class

    • B. 

      Generic methods are the methods that extend generic class methods

    • C. 

      Generic methods are methods that introduce their own type parameters

    • D. 

      Generic methods are methods that take void parameters

  • 14. 
    Which of these Exception handlers cannot be type parameterized?
    • A. 

      catch

    • B. 

      throw

    • C. 

      throws

    • D. 

      all of the mentioned

  • 15. 
    Which of the following cannot be Type parameterized?
    • A. 

      Overloaded Methods

    • B. 

      Generic methods

    • C. 

      Class methods

    • D. 

      Overriding methods

  • 16. 
    What should the return type of method where there is no return value?
    • A. 

      Null

    • B. 

      Empty collection

    • C. 

      Singleton collection

    • D. 

      Empty String

  • 17. 
    What data structure should be used when number of elements is fixed?
    • A. 

      Array

    • B. 

      Array list

    • C. 

      Vector

    • D. 

      Set

  • 18. 
    What causes the program to exit abruptly and hence its usage should be minimalistic?
    • A. 

      Try

    • B. 

      Finally

    • C. 

      Exit

    • D. 

      Catch

  • 19. 
    Which one of the following causes memory leak?
    • A. 

      Release database connection when querying is complete

    • B. 

      Use Finally block as much as possible

    • C. 

      Release instances stored in static tables

    • D. 

      Not using Finally block often

  • 20. 
    Which of the following is a best practice to measure time taken by a process for execution?
    • A. 

      System.currentTimeMillis()

    • B. 

      System.nanoTime()

    • C. 

      System.getCurrentTime()

    • D. 

      System.getProcessingTime()

  • 21. 
    Which of the below is true about java class structure?
    • A. 

      The class name should start with lowercase

    • B. 

      The class should have thousands of lines of code

    • C. 

      The class should only contain those attribute and functionality which it should; hence keeping it short

    • D. 

      The class attributes and methods should be public

  • 22. 
    Which of the below is false about java coding?
    • A. 

      variable names should be short

    • B. 

      variable names should be such that they avoid ambiguity

    • C. 

      test case method names should be created as english sentences without spaces

    • D. 

      class constants should be used when we want to share data between class methods

  • 23. 
    Which is better in terms of performance for iterating an array?
    • A. 

      for(int i=0; i

    • B. 

      for(int i=99; i>=0; i--)

    • C. 

      for(int i=100; i

    • D. 

      for(int i=99; i>0; i++)

  • 24. 
    Which of the following is not introduced with Java 8?
    • A. 

      Stream API

    • B. 

      Serialization

    • C. 

      Spliterator

    • D. 

      Lambda Expression

  • 25. 
    What does Files.lines(Path path) do?
    • A. 

      It reads all the files at the path specified as a String

    • B. 

      It reads all the lines from a file as a Stream

    • C. 

      It reads the filenames at the path specified

    • D. 

      It counts the number of lines for files at the path specified

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.