Unique 25 MCQ Questions on ICSE X Computer Applications - Chapter Constructor

 Unique 25 MCQ Questions on ICSE X Computer Applications - Chapter Constructor 


1. What is a constructor in Java?

   A. A method that returns a value

   B. A special method used for object initialization

   C. A method that is static

   D. A method that is abstract


2. Which of the following is true about constructors?

   A. They are inherited

   B. They are used for destroying objects

   C. They have a return type

   D. They have the same name as the class


3. How is a constructor different from a regular method?

   A. Constructors cannot be overloaded

   B. Constructors have a return type

   C. Constructors are called explicitly

   D. Constructors have the same name as the class


4. Which keyword is used to invoke the superclass constructor?

   A. this

   B. super

   C. base

   D. parent


5. What is the purpose of a parameterized constructor?

   A. To create an object

   B. To initialize object properties with provided values

   C. To destroy an object

   D. To return a value


6. How many times can a constructor be called during the creation of an object?

   A. Once

   B. Twice

   C. Multiple times

   D. Depends on the class


7. Which of the following is true about a default constructor?

   A. It has parameters

   B. It is provided by the compiler if no constructor is defined

   C. It cannot be used

   D. It is called explicitly


8. What is the role of the 'this' keyword in a constructor?

   A. Refers to the current class instance

   B. Calls another constructor in the same class

   C. Refers to the superclass instance

   D. Initializes a static variable


9. Can a constructor have a return type?

   A. Yes

   B. No

   C. Only for parameterized constructors

   D. Depends on the class


10. Which of the following is invoked implicitly when an object is created?

    A. Default constructor

    B. Parameterized constructor

    C. Static constructor

    D. Final constructor



11. How can constructor overloading be achieved in Java?

    A. By defining multiple constructors with the same name but different parameters

    B. By using the 'overload' keyword

    C. By defining multiple constructors with different return types

    D. By using the 'overloaded' modifier


12. What happens if a constructor is not defined in a class?

    A. Compilation error

    B. The program will not run

    C. A default constructor is provided by the compiler

    D. It is not possible to create objects of that class


13. Which constructor is called when an object is cloned in Java?

    A. Default constructor

    B. Parameterized constructor

    C. Copy constructor

    D. Clone constructor


14. What is the purpose of the 'finalize' method in Java?

    A. To destroy objects explicitly

    B. To perform cleanup operations before an object is garbage-collected

    C. To invoke the superclass constructor

    D. To initialize object properties


15. Inheritance in constructors is achieved using which keyword?

    A. this

    B. super

    C. extends

    D. inherit



16. Which of the following statements is true about the 'super()' keyword?

    A. It is used to call a method in the superclass

    B. It is used to invoke the superclass constructor

    C. It is used to access a static variable

    D. It is used to create an object of the superclass


17. What is the output of the following code snippet?

    public class Test {

        Test() {

            System.out.println("Default constructor");

        }


        Test(int x) {

            this();

            System.out.println("Parameterized constructor");

        }


        public static void main(String[] args) {

            new Test(10);

        }

    }


    A. Default constructor

    B. Parameterized constructor

    C. Default constructor Parameterized constructor

    D. Parameterized constructor Default constructor


18. Which type of constructor can be used to create an exact copy of an object?

    A. Copy constructor

    B. Duplicate constructor

    C. Clone constructor

    D. Replica constructor


19. Can constructors be inherited in Java?

    A. Yes

    B. No

    C. Only default constructors can be inherited

    D. Constructors are not inherited


20. What is the purpose of the 'static' keyword in a constructor?

    A. To make the constructor private

    B. To initialize a static variable

    C. To make the constructor public

    D. To create an object of the class



21. What is the difference between the 'this' and 'super' keywords in a constructor?

    A. 'this' refers to the current class instance, while 'super' refers to the superclass instance

    B. 'this' is used to invoke the superclass constructor, while 'super' refers to the current class instance

    C. 'this' is used to access static variables, while 'super' refers to instance variables

    D. 'this' and 'super' are interchangeable in constructors


22. Which of the following statements is true about the 'finalize' method?

    A. It is called explicitly in the code

    B. It is used for object initialization

    C. It is automatically called by the garbage collector

    D. It is used to create a copy of an object


23. What is the purpose of a copy constructor?

    A. To create a new class

    B. To copy the content of one object into another

    C. To destroy an object

    D. To initialize a static variable


24. In Java, can a class have more than one constructor with the same number and type of parameters?

    A. Yes

    B. No

    C. Only if the class is abstract

    D. Only if the constructors are static


25. Which of the following is true about the 'this' keyword in a constructor?

    A. It refers to the superclass instance

    B. It can only be used in parameterized constructors

    C. It refers to the current class instance

    D. It is used to destroy objects















1.   (B)

2.   (D)

3.   (D)

4.   (B)

5.   (B)

6.   (A)

7.   (B)

8.   (A)

9.   (B)

10.    (A)

11.    (A)

12.    (C)

13.    (C)

14.    (B)

15.    (B)

16.    (B)

17.    (C)

18.    (A)

19.    (B)

20.    (A)

21.    (A)

22.    (C)

23.    (B)

24.    (A)

25.    (C)


Comments