Constructors and Constructor Overloading

POST TEST :


Question 1:
For constructor overloading, each constructor must differ in ___________ and __________

Number of arguments and type of arguments
Number of arguments and return type
Return type and type of arguments
Return type and definition


Question 2:
Which among the following is correct for the class defined below?
class student{
int marks;
public: student(){}
student(int x){
marks=x;
}
};
main(){
student s1(100);
student s2();
student s3=100;
return 0;

Object s3, syntax error
Only object s1 and s2 will be created
Program runs and all objects are created
Program will give compile time error


Question 3:
Which object will be created first?
class student {
int marks;
};
student s1, s2, s3;

s1 then s2 then s3
s3 then s2 then s1
s2 then s3 then s1
none of the above


Question 4:
How many types of constructors are available for use in general (with respect to parameters)?
2
3
4
5


Question 5:
Which among the following is correct?
class student{ public: int student(){} };
class student{ public: void student (){} };
class student{ public: student{}{} };
class student{ public: student(){} };


Question 6:
In multiple inheritance, if class C inherits two classes A and B as follows, which class constructor will be called first:
class A{ };
class B{ };
class C: public A, public B{ };

A()
B()
C()
Recursion


Question 7:
Which among the following is called first, automatically, whenever an object is created?
Class
Constructor
New
Trigger


Number of score out of 7 = Score in percentage =