A constructor will create a new object with a full copy of the other object, this type of copy is known as ________.
ADeep copy
BShallow copy
CConstructor copy
DObject copy
A deep copy duplicates the pointed-to data too, giving a full independent copy.
2.
★ Final term 2017 (paper 4)
In statement Matrix m2 = m1 ;
AAssignment operator is being used
BCopy constructor is being used
CStatement has syntax error
DStatement has logical error
m2 is being created and initialized from m1 in its declaration, which calls the copy constructor, not operator=.
3.
★ Final term solved MCQs (Moaaz & Asad)
Assignment operator is used to initialize a newly declared object from existing object.
ATrue
BFalse
Initializing a new object from an existing one uses the copy constructor, not the assignment operator.
4.
★ Final term solved MCQs (Moaaz & Asad)
The compiler does not provide a copy constructor if we do not provide it.
ATrue
BFalse
The compiler generates a default member-wise copy constructor when none is written.
5.
★ Solved MCQs collection
The default copy constructor provides member wise assignment.
ATrue
BFalse
The compiler-generated copy constructor copies each member.
6.
★ Final term Spring 2005
A copy constructor
Atakes no arguments
Btakes an arbitrary number of arguments
Ccreates a new object that later may be assigned the data of an existing object
Dcreates an object initialized with the same data as an existing object
A copy constructor builds a new object as a copy of an existing object of the same class.
No MCQs match this filter.Is filter mein koi MCQ nahi.
1.
★ Final term subjective (Moaaz)Lecture 393 marks
Which one (copy constructor or assignment operator) will be called in each of the following code segment?
1) Matrix m1 (m2);
2) Matrix m1, m2;
m1 = m2;
3) Matrix m1 = m2;
Show answerJawab dekhein
1) Matrix m1(m2); - copy constructor (new object created from an existing one).
2) Matrix m1, m2; m1 = m2; - assignment operator (both objects already exist).
3) Matrix m1 = m2; - copy constructor (this is initialisation of a new object, not assignment).
No long questions added yet.Abhi koi long sawal shamil nahi.