1.★ Final term 2017 (paper 4)
When we define an array of objects then ______________.
- AConstructor will never call
- BDepends on the size of array
- CConstructor will be called once for whole array
- DConstructor will be called for each object of the array
Each element of an array of objects is a separate object, so the constructor runs once per element.
2.★ Final term solved MCQs (Moaaz & Asad)
When an array of object is created dynamically then there is no way to provide parameterized constructors for array of objects.
- ATrue
- BFalse
With new Class[n] (classic C++) each element is built with the default constructor.
3.★ Final term solved MCQs (Moaaz & Asad)
If text is a pointer of class String then what is meant by the following statement?
text = new String [5];
- ACreates an array of 5 string objects statically
- Bcreates an array of 5 string objects dynamically
- CCreates an array of pointers to string
- DCreates a string Object
new String[5] allocates five String objects on the free store at run time.
4.★ Final term solved MCQs (Moaaz & Asad)
We can also create an array of user define data type.
- ATrue
- BFalse
Arrays of structures or class objects are allowed.
5.★ Final term solved MCQs (Moaaz & Asad)
When we define an array of objects then,
- ADestructor will call once for whole array
- BDestructor will call for each object of the array
- CDestructor will never call
- DDepends on the size of array
Every object in the array is destroyed separately, so the destructor runs once per object.