Paper Tayyari

Lecture 39: Copy Constructor

MCQs, short and long questions from lecture 39.Lecture 39 ki MCQs, short aur long sawal.

6 MCQs · 1 short question · 6 MCQs from past papers6 MCQs · 1 short sawal · 6 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/6
– correctsahi
1.
★ Final term 2017 (paper 1)

A constructor will create a new object with a full copy of the other object, this type of copy is known as ________.

  1. ADeep copy
  2. BShallow copy
  3. CConstructor copy
  4. 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 ;

  1. AAssignment operator is being used
  2. BCopy constructor is being used
  3. CStatement has syntax error
  4. 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.

  1. ATrue
  2. 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.

  1. ATrue
  2. 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.

  1. ATrue
  2. BFalse

The compiler-generated copy constructor copies each member.

6.
★ Final term Spring 2005

A copy constructor

  1. Atakes no arguments
  2. Btakes an arbitrary number of arguments
  3. Ccreates a new object that later may be assigned the data of an existing object
  4. 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.