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.

CS304 ALL Current Final Term Papers Fall 2016 & Past Final Term Papers at One Place from 25 February 2017 to 08 March 2017

CS304 ALL Current Final Term Papers Fall 2016 & Past Final Term Papers at One Place from 25 February 2017 to 08 March 2017

Views: 2755

Replies to This Discussion

CS304 (7-3-2017)
MCQS 1to all were from WAQAR SINDHU files.
Subjective was also from past papers. Only two questions were new. (1 yad nh araha sory)

1) Consider the following snippets and identify errors:
Snippet no:1:
Template ˂class T˃
class A { };
template ˂class T˃
class B: public A ˂T*˃
Snippet No: 2
class B: public A˂T*˃ 
2) Consider the following nested try…catch blocks and give the order in which catch blocks will be executed when exception is thrown from innermost catch block (given in bold).
int main( ) {
try {
try {
try {
catch( char ) { } //THIS WAS IN BOLD
catch( float ) { }
catch( int ) { }
return 0; }
3) User defined types cannot be passed as an argument to the templates.
Identify this statement as correct or incorrect.
4) Write C++ code for the getIdex() and setIndex() and method of the following template vector class.
template <class T>
class vector{
T* ptr;
int size;
int index;
int get index() const
void setIndex(int i); };
5) Describe a way to declare a template function as a friend of any other class.
6) Using which of the following we can achieve specialization
Private Inheritance
Public Inheritance
Protected Inheritance
7) Name the technique which is used to implement Generic Algorithms in C++
8) Give the names of two types of containers basically known as first class containers.
9) 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; }
After compiling this code we will see the following output,
Shape …
If we want to display the following output
How can we achieve this?
10) Consider the following code,
class Base{private:
void base1();
void base2();
void base3();};
class Derived: public Base{
void derived1();
void derived2();
void derived3();};
int main(){
Base * base = new Derived();
return 0; }
Fill in the following table to tell which member functions of Base and Derived classes we can access using the Base pointer in the code indicated in bold?
Function                 Name Availability (Yes / No)?
base2()                  ?
base3()                  ?
derived1()              ?
derived2()              ?
derived3()              ?
11) Suppose a programmer is confuse to select a proper and suitable techniques for the following scenario
a) there are different types and he need similar operations on data types
b) there are different types and he needs identical operations on data types.


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

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