Class And Object In Java Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Alfredhook3
A
Alfredhook3
Community Contributor
Quizzes Created: 2940 | Total Attempts: 2,607,946
Questions: 10 | Attempts: 2,415

Class And Object In Java Quiz - Quiz

Java is a class-based, object-based programming language that is designed to create desktop and mobile apps. Along with that, it is also used for big data processing and system embedding. Know the java equations and array better in this test about java language.


Questions and Answers
  • 1. 

    Which of the following is true about private constructor?

    • A.

       Private constructor makes sure only one instance of a class exists at any time

    • B.

      Private constructor makes sure multiple instances of a class exist at any time

    • C.

      Private constructor ensures the instantiation of a class with ease

    • D.

      Private constructor facilitates creation of objects in other classes

    Rate this question:

  • 2. 

    What will be the behavior of Java script if this() and super() used in the same method?  

    • A.

      Runtime error

    • B.

      Runtime error

    • C.

      Throws exception

    • D.

      Runs successfully

    Rate this question:

  • 3. 

    In Java, which of these operators is used to place memory to array variable?  

    • A.

      Malloc

    • B.

      Alloc

    • C.

      New

    • D.

      New malloc

    Rate this question:

  • 4. 

    What is true about protected constructor?

    • A.

      It can be called directly

    • B.

      It can only be called using super()  

    • C.

      It can be used outside package  

    • D.

      It can be instantiated even if the child is in a completely different package

    Rate this question:

  • 5. 

    Abstract class cannot have a constructor.

    • A.

      True

    • B.

      False

    Rate this question:

  • 6. 

    If the constructor has a return type, what will be its behavior?

    • A.

      Compilation error

    • B.

       Runtime error

    • C.

      Compilation and runs successfully

    • D.

      Only String return type is allowed

    Rate this question:

  • 7. 

    Which one of the following is not a correct array declaration?  

    • A.

      Int arr[] = int [5] new

    • B.

      Int [] arr = new int[5]

    • C.

      Int arr[] = new int[5]

    • D.

      Int arr[] = new int[5]

    Rate this question:

  • 8. 

    Which of these class can be used to make an object whose character sequence is mutable?

    • A.

      String()

    • B.

      String() & StringBuffer()

    • C.

      StringBuffer()

    • D.

      None of the mentioned

    Rate this question:

  • 9. 

    If one has to extract a single character from a String object, which of these method of class String can be used?

    • A.

      CHARAT()

    • B.

      Chatat()

    • C.

      CharAt()

    • D.

      ChatAt()

    • E.

      Option 5

    Rate this question:

  • 10. 

    Which of these is an incorrect statement?

    • A.

      String objects are immutable, they can never be changed  

    • B.

      String object usually point to another reference of a string variable

    • C.

      StringBuffer class can be used to store string in a buffer to be used later

    • D.

      None of the mentioned

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Nov 30, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 16, 2021
    Quiz Created by
    Alfredhook3
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.