Page 318 - CA_Blue( J )_Class10
P. 318
MIND DRILL
Solved Questions
A. Tick ( ) the correct answer.
1. Which of the following type of constructor contains parameters?
a. Parameterised b. Non-Parameterised
c. Default d. None of these
2. Constructors are mainly used for initializing the ………………… of the objects with its default values.
a. literals b. separators
c. instance variables d. method
3. Constructors are always ………………….
a. public b. private
c. protected d. secure
4. Which of the following is the correct syntax to create a parameterised constructor?
a. public int pco(int i) { } b. public pco() { }
c. public pco(int i) { } d. private int pco(int i) { }
5. Which of the following is a default constructor?
a. public local() { } b. public local(int a) { }
c. public local(int a) { a1 = a;} d. private local(int a) { }
6. What is the purpose of a constructor in Java?
a. To create a new class b. To create new instance variables
c. To initialize the state of an object d. To define methods
7. Which of the following is true about default constructors in Java?
a. They are provided automatically if no constructors are defined by the programmer
b. They can take parameters
c. They must be defined explicitly
d. They cannot initialize object variables
8. Which of the following statements is true about constructors in Java?
a. Constructors can return a value b. Constructors have the same name as the class
c. Constructors can be static d. Constructors can be abstract
9. What is the output of the following code?
class program
{
program()
{
System.out.println("Constructor called");
}
public static void main() {
program obj = new program();
}
}
a. Compilation error b. No output
c. Constructor called d. Runtime error
10. Which of the following is true about the `this` keyword in Java constructors?
a. It refers to the current object.
b. It refers to the superclass object.
c. It can be used to call another constructor in the same class.
d. Both a and c
316316 Touchpad Computer Applications-X

