Page 319 - CA_Blue( J )_Class10
P. 319
Answers
1. a 2. c 3. a 4. c 5. a 6. c 7. a 8. b 9. c 10. d
B. Fill in the blanks.
1. Constructor is a member method with ………………… name of the class.
2. A ………………… constructor is used to initialize the instance variables automatically with default values.
3. A ………………… constructor is a type of constructor without parameters.
4. A ………………… constructor duplicates an object.
5. Constructor ………………… is a technique of using a number of constructors in a class with different number of parameters or
different types of parameters.
Answers
1. same 2. default 3. non-parameterised 4. copy 5. overloading
C. Answer the following questions:
1. What is a constructor?
Ans. A constructor is a member method with same name of the class that is used to initialize the instance variables of the class.
2. Write down the syntax of defining a constructor.
Ans. class <name of class>
{
//Data members……
<name of class>() //constructor
{ job of the constructor i.e. initializing the data members}
<member methods>()
{ Job of the method }
public static void main()
{
<name of class> <name of object> = new <name of class>();
<name of object>.<member method>();
}
}
3. Write any four characteristics of constructors.
Ans. The four characteristics of constructors are as follows:
i. Name of the constructor must be same as the name of the class.
ii. Constructors are used to initialize the instance variables of the class.
iii. Constructor do not have any return type, not even void.
iv. Constructors are always public as they can be called from outside the class while creating the object of the class.
4. Name any two types of constructors.
Ans. The two types of constructors are:
i. Non-Parameterised constructor ii. Parameterised constructor
5. Why is default constructor used?
Ans. A default constructor is used to initialize the instance variables automatically with the default values.
6. Define parameterised constructor.
Ans. A parameterised constructor is a type of constructor with parameters.
7. Define constructor overloading.
Ans. Constructor overloading is a technique of using a number of constructors in a class with different number of parameters or
different types of parameters.
8. Write any two differences and two similarities between constructor and method.
Ans. The differences between constructor and method are:
317
Constructors 317

