.... How to Find Your Subject Study Group & Join ....   .... Find Your Subject Study Group & Join ....  

We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Study Groups By Subject code Wise (Click Below on your university link & Join Your Subject Group)

[ + VU Study Groups Subject Code Wise ]  [ + COMSATS Virtual Campus Study Groups Subject Code Wise ]

Looking For Something at vustudents.ning.com?Search Here

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

This Content Originally Published by a member of VU Students.

Views: 3053

See Your Saved Posts Timeline

Attachments:

Replies to This Discussion

its today my papar ....
Q.5
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

Cs304(23-8-2016)
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. };

19.

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 {

protected:

char _type;

public:

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

class Line : public Shape {

public:

 Line(Point p1, Point p2) {

}

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

class Circle : public Shape {

public:

 Circle(Point center, double radius) {

}

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

class Triangle : public Shape {

public:

 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,

Shape

Shape

Shape

Shape

If we want to display the following output

Line

Circle

Triangle

Circle

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
Attachments:

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

Answer:

We can achieve specialization by using Private and Protected inheritance.

 

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

Answer:

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.

Answer:

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++

Answer:

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.

Answer:

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.

Answer:

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.

Definition:

template<class T>

T maximum(T first, T second)

{

if (first < second)

return second;

else

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.

RSS

Job's & Careers (Latest Jobs)

Admissions (Latest Admissons)

Scholarship (Latest Scholarships)

Internship (Latest Internships)

VU Study

Other Universities/Colleges/Schools Help

+ More Categorizes

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

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