Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

1-If 1 class inherits from the other class, how many functions will the derived class have now?

2-Explain the statement below,

vector<int> ivec(4, 3);


3-write an abstract class sport make a function of this class Player as pure virtual. Now derive 2 classes Tennis and volleytation oball from it. Give implementation of this function in both classes. Now declare a poiter of base class in main and call player() polymorphically.


4-Make Vector class. Declare an object of vector class and take words from user as input. Now sort the words and dispaly them on the screen.


5-If we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class.


6-Suppose the base class and the derived class each have a member function with the same signature. When you have a pointer to a base class object and call a function member through the pointer, discuss what determines which function is actually called, the base class member function or the derived-class function.


7-Consider the following class,

class Base


            char * p;


            Base() { p = new char[10]; }


            ~Base() { delete [] p; }


class Derived : public Base


            char * q;


            Derived() { q = new char[20]; }


            ~Derived() { delete [] q; }


void foo()


            Base* p = new Derived();

            delete p;


8-With this program, every time function too is called, some memory will leak.

Explain why memory will leak. Also, explain how to fix this problem.


9-Create a vector array of  length 8,and also initialize the elements of this array with  values 0 1 2 3 4 5 6 7     (5 mrk)


10-suppose base class and derive class have a member  function with same signature. Now call that  member function  throw pointer to a base class  object.Now  what determines that the    base class member function or derived class will be called? (mrk 5)



11-Find and correct  the error(s) in the code  below

Class counter





Int increment data()const{return++vali}

Static int get count()


Cout”data is “Valend;




Int val;

Static in count;


12-suppose there is a class Doctor with data member.Name Department and Doctor. you are required to write default copy constructor as well as deep copy constructor in order to initialize object and explain the difference with the help of main() function. only write up to constructor code and main() function 5 marks


13-Two problems to check while overloading assignment operator ” = ”


14-Can constructor through exception? How to handle error?


15-Write a template function that takes one template parameter and always return value that is always equal to double of its parameter value (parameter *2).


16-You are required to list down default access specifier for c++ class and c structure.


17-In both virtual inheritance and multiple inheritance copy/copies of base class are created, List down how many copy/copies are created for:

Virtual inheritance

Multiple inheritances



18- Do you think that encapsulation is used to cope with complexity and simplifies the model and provide better understand? Explain the said perceptively with one real word example.



19-Write the average function that returns the average of all the element of an array. The argument to the function should be array name and the size of the array (type int)


20-How can we specialize a template class for any particular data type? Give C++ syntax.          2marks


21-Non-static variable of a class are created when object of the class is initialized. What about static variable of the class. Justify your answer.             


22-Write a function template named maximum. The function takes two values of the same type as its arguments and returns the larger of two arguments (or either value if they are equal). Give the function prototype and definition for the template.


23-Write C++ code for declaring the following                                       




          Name of type string

          Code of type string


          Get code()



24-Write C++ code for copy constructor of following template vector class.                     

Template<class T>

Class vector {



          int size;

          int index;


          Vector (const vector<T>&);    //copy constructor




25-Write the code for setindex and getindex in following program?

Template <class T>

Class Vector

{ int index;

   Int size;


Int getIndex( )const{};

Void setIndex( int i);




26-In hospital beds are assigned to patients by administration write its OO model and identify objects and their interaction?



27-How do compilers handle all the virtual function calls? Why virtual functions can’t be run within constructor?


28-Why template parameters are used?


29-What about static variable when non-static variable are initialize?


30-Write a template function maximum which takes two arguments of same type that returns the larger number


31-Write a template function which gives average having its name and proper size of array. 


32-Can we make constructor Virtual?


33-Write C++ Code for student class which shows how exceptions are thrown in initialization list?


34-Write a template function that returns the average of all the elements of an array. The arguments and size of the array (type int)


35-Write the order in which the objects are initialized and also write down the initialized values

class Doctor{

int empID;

int salary;

char * name;

char * qualification;

char * address;

Doctor(): qualification('MBBS'),salary('36000'),address('LHR'),name('Ali')




Views: 885


Replies to This Discussion

- What is nested function and also give the syntax?
. Write the average function that returns the average of all the element of an array. The argument to the function should be array name and the size of the array (type int)

What is the output produced by the following program?


void sample_function(double test) throw (int);

int main()




cout ”Trying.\n”;


cout “Trying after call.\n”;




cout “Catching.\n”;


cout “End program.\n”;

return 0;


void sample_function(double test) throw (int)


cout “Starting sample_function.\n”;

if(test < 100)

throw 42;         


8.       write a template function maximum which takes two arguments of same type, that returns the larger number

9.       write a template function which gives average having it’s name and proper size of array. 

1.       How can we specialize a template class for any particular data type? Give C++ syntax.   PLZZZZZZZZZZZZZZZZZ ANYBODY EXPLAIN THESE TOPIC

nice work Little Chef 

Thanks brother

Outstanding work done by Little chef. We appreciate your work. Jazakallah

Little Chef ..Can you please send your email address at Thanks 

@Little Chef G , kindly inko our jo current papers guys share kar rahy hain ,solve kar ke aik file mein share karain .....thanks


© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service