We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.


+ Link For Assignments, GDBs & Online Quizzes Solution


+ Link For Past Papers, Solved MCQs, Short Notes & More

CS304 ALL Current Final Term Papers Spring 2016 And Past Final Term Papers at One Place from 20 August 2016 to 2 September 2016

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Views: 8728


Replies to This Discussion

its today my papar ....
Suppose we have a person class with an attribute age and we want another class veter with with same attribute but with retriction that age can only be greater than 18 year . both class have setage function that set their repective attribute age with passed value is fulling the class condition value is greater then the 18 is case of vector class .
You have to give the code of implementation in the term person and vector in c++.
Q. How we use the concept of overloading to convert a type according to our own requirement. Give example
Q. Using this how achieve specialization.
Private inheritance
Public inheritance
Protected inheritance
Q. What is graceful termination method error handling give example c++ code.
Q. Write the c++ code to declare the a template class ‘A’ as friend of the other template class ‘B’.
Q. While over loading the stream insertion and extraction operator a program can not declare ostream reference as constant why?
Q. Sort following data in order for .
Complete specialization ,partial specialization generic template function order

1. code was given and asked to write output.
2. Write a template function that returns the average of all elements of an array. The argument to the function should be Array name and size of an array.
3. Define public and private inheritance with examples.
4. Code was given and asked to write logical errors.
5. We can achieve specialization from which of the following
public inheritance
private inheritance
protected inheritance.
6. Can we initialize a class if a constructor and destructor are declared as private. Justify.
7. What is meant by Stack Unwinding
8. Suppose person class is an abstract class which has some specific features. Briefly describe important features of abstract class.
9. What are non type parameters for template.
10. What is anonymous base class object. Give an example.
11. If we declare a function as friend of template class then will it be a friend for particular data type or for all data type of that class. Justify

Thenx for sharing current paper

asslam o alikum! kindly tell me the answer of the following question
2:write a program where template A is the friend of template B
myra paper suba 8 bjy hai plz koe bata dy

  • One question about binding. Ask to identify the type of binding in which target function for a call selected at run time instead compile time.
  • What is meant by stack unwinding
  • Write the output…code was given (base and derived class destructor code)
  • Code was given ask to write code…(following code note that in in this code there are some errors):

1.#include <iostream>

  1. #include <stdlib.h>
  2. using namespace std;
  3. template <typename T>
  4. class MyClass{
  5. public:
  6. MyClass(){
  7. cout"This is class1"endl;
  8. }
  9. };
  10. template <typename T>

13. class MyClass<int*>{

  1. public:

15. MyClass(){

  1. cout"This is class2"endl;

17. }

  1. };


20. int main(int argc, char *argv[])

21. {

  1. MyClass<int> c1;
  2. MyClass<int*> c2;
  3. system("PAUSE");
  4. return 0;

26. }

  • Give the c++ code of case sensitive comparison function of string class.
  • Identify unary and binary operators from the following

++, --, =, /

  • 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
  • In the given program implement the set method in such a way that change the character at nth location
  • In the program given below

class Shape {


char _type;


 Shape() { }   void draw(){ cout “Shape\n”; }   int calcArea() { return 0; }   char getType() { return _type; }  };

class Line : public Shape {


 Line(Point p1, Point p2) {


 void draw(){ cout “Line\n”; }  };

class Circle : public Shape {


 Circle(Point center, double radius) {


 void draw(){ cout “Circle\n”; }   int calcArea() { … }  };

class Triangle : public Shape {


 Triangle(Line l1, Line l2, double angle)  {


 void draw(){ cout “Triangle\n”; }   int calcArea() { … }


int main() {

 Shape* _shape[ 10 ];

Point p1(0, 0), p2(10, 10);   shape[1] = new Line(p1, p2);  shape[2] = new Circle(p1, 15);

 void drawShapes( shape, 10 );  return 0;


/*Function drawShapes()*/

void drawShapes(Shape* _shape[],  int size) {

 for (int i = 0; i < size; i++) {  _shape[i]->draw();



After compiling this code we will see the following output,





If we want to display the following output





How can we achieve this?

  • Catch block statement that can use any type in member initialization list
  • Can a derived template class can have number of parameters other than the parent template class
  • See the code and fill in the table that the derived pointer given in bold text format can access the base or derived data and method of the above classes or not

Today Paper Long Questions CS304:

Tried to solve them also please mark if anything wrong. 

 Q. Using which of the following we can achieve specialization
            Private Inheritance
            Public Inheritance
            Protected Inheritance


We can achieve specialization by using Private and Protected inheritance.


Q. Describe three properties necessary for a container to implement generic algorithms.


We claimed that this algorithm is generic, because it works for any aggregate object (container) that defines following three operations.

 a. Increment operator (++)
 b. Dereferencing operator (*)
 c. Inequality operator (!=)


Q. List down any three cases in which copy constructors are called.


1. When instantiating one object and initializing it with values from another object.                        

2. When passing an object by value.                        

3. When an object is returned from a function by value.


Q. Name the technique which is used to implement Generic Algorithms in C++


Generic algorithms in C++ are written using C++ templates



Q. Binding is the process that connects the function call to function implementation you are required to name the type of binding in which this process is done at run time instead of compile time.


The simplest form of run-time binding is polymorphism. In context of C++ polymorphism is achieved through virtual functions.


Q. While Overloading stream insertion and extraction operators a programmer cannot declare ostream and istream referenced as a constant why?

Answer: istream cannot be constant and istream buffer will change as we will get data from it and assign it to complex reference similarly Complex object cannot be constant for stream extraction operator as well because we will add data to it and hence its state will change.


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


Function declaration:

template<class T>

T maximum(T first, T second);

//Precondition: The operator < is defined for the type T.

//Returns the maximum of first and second.


template<class T>

T maximum(T first, T second)


if (first < second)

return second;


return first;


A template is not a class or a function.
A template is a “pattern” that the compiler uses to generate a family of classes or functions

Please point out if the answers are wrong.

cs101-cs201-cs301-cs304-cs-601-cs504 past papers



Looking For Something? Search Below

Latest Activity

Rabia liked + M.Tariq Malik's discussion BIF401 Bioinformatics I GDB Fall 2020 Solution / Discussion
18 minutes ago
Rabia liked + M.Tariq Malik's profile
19 minutes ago
★彡[ꜱʜʏɴᴀ]彡★ liked + ! ! hคຖiค khคຖ ! ! ! +'s discussion 'Ghar Se Hum Ghar Talak Gaye Honge, Apne Hee Aap Tak Gaye Honge',
6 hours ago
+ ! ! hคຖiค khคຖ ! ! ! + liked + M.Tariq Malik's discussion Free Download Solved MCQs of Pakistan Affairs - Everyday Science - Current Affairs For MCQs for CSS, NTS, FTS, ETEA, OTS, UTS, FPSC, PPSC, SPSC, PMS, PSC, KPKPSC, AJKPSC, SOPE Exam
6 hours ago
+ ! ! hคຖiค khคຖ ! ! ! + liked + ! ! hคຖiค khคຖ ! ! ! +'s discussion 'Ghar Se Hum Ghar Talak Gaye Honge, Apne Hee Aap Tak Gaye Honge',
6 hours ago
+ ! ! hคຖiค khคຖ ! ! ! + posted a discussion
6 hours ago
VU AHMED replied to + M.Tariq Malik's discussion PHY301 Fall 2017 Final Term Papers Pattern & Questions 17 Feb 2018 to 28 Feb 2018 & Helping Material in the group PHY301 Circuit Theory
6 hours ago
+ ! ! hคຖiค khคຖ ! ! ! + updated their profile
6 hours ago
+ M.Tariq Malik liked + + + + " Tw!nkle "'s discussion Happy HAppy birthday !! FIYA
8 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion EDU410 Teaching of Literacy Skills Assignment 01 Fall 2020 Solution / Discussion in the group EDU410 Teaching of Literacy Skills
8 hours ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion EDU410 Teaching of Literacy Skills Assignment 01 Fall 2020 Solution / Discussion in the group EDU410 Teaching of Literacy Skills
8 hours ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion EDU410 Teaching of Literacy Skills Assignment 01 Fall 2020 Solution / Discussion
8 hours ago

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

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