UTA018
UTA018
NOTE: Attempt ALL questions. It is COMPULSORY to write your GROUP Name (with
SUBGROUP No) (like A2, 13, E5, P4 etc.) at the top of the answer sheet(s).
Q 1. a) Define a class and explain its role by creating suitable object(s) of the class. (2)
b) Differentiate between dot member selection operator and arrow member selection operator, with
suitable example(s). (2)
c) Can we pass object(s) as arguments to (i) member functions? (ii) non member functions? Give
examples supporting your answers. (2)
Q2. a) What is scope resolution operator? Explain its three different usages with example for each. (1,3)
b) What is the output of the following code? (2)
#include<iostream>
using namespace std;
int main()
{
int x;
int *p:
int *q;
p=new int(10];
c1=1);
*p=4;
for (int j=0;j<10;j++)
Q3. a) Define multiple inheritance. What is the crder of calling the constructor(s) and destructor(s) in
multiple inheritance? Explain with the help of suitablc example.
b) What is the need of access specifier "protected" in C-ffF?
c) Write the output for following codes with appropriate explanations.
(ii) #i nclud,,,:,,treAm›
using namespace std;
Q4. a) Write a program in C++ to calculate the total number of objects created in a program.
[Suggestions: Take the name of class as "test"; Use Constructor to increment the count of objects
created; create three objects in main function; display count using showCount() method once after the
creation of 2nd object and next after the 3rd object.] (2)