VUDESK

¤Virtual University Of Pakistan Network¤



Welcome Visitors to VUDESK Family .Join VUDESK For Free to Get more Access to study material and lot of infotainment stuff. Stay Connected!!

VUDESk ALL Subject CODES
Find Your Subject Code , Join Group And You Will Get ALL related Data
ACC - Fundamentals of auditing and business
ACC311ACC501
ACF - (Accounting And Finance Related)
ACF619ACFI619
COM - (Commerce Related)
COM619COMI619
ECO - (Economics Related)
ECO401 ECO402 ECO403 ECO404
ENG - (English Related)
ENG001 ENG101 ENG201 ENG301 ENG401
ETH201 - Ethics (for Non-Muslims)
ETH201
ISL201 - Islamic Studies
ISL201
IT - (Info Tech Related
IT000IT0001IT430IT619ITI619
MIS - (Project And Internship Report)
MIS619 MISI619MIS620 MISI620
PAD - (Public Administration Related)
PAD619 PADI619
PAK301 - Pakistan Studies
PAK301PAK302
PHY - (Physics Related)
PHY101 PHY301
PSC201 - International Relations
PSC201PSC401
SOC - (Socialogy Related)
SOC101 SOC401
STA - (Statistics and Research)
STA301 STA630
URDU - (Urdu Related)
URD101

Assalam o Alikum!

Shere here current Final term papers from 16 to 27 july 2012 

Tags: 16, 2012, 27, Final, Shere, current, from, here, july, papers, More…term, to

Views: 137

Replies to This Discussion

Advertise Here

what is iterator? and what is output and input iterator? marks 5

dynamic and static binding marks 2

 Can a constructor throw an exception? How to handle the errors, when the constructor fails? marks 3

describe a way to declare a template function as a friend of any other class. marks 2

There are some errors in the code given below, you have to Indicate the line no. with error/s Give the reason for error/s Correct the error/s.      marks 5
1. #include <iostream>
2. #include <stdlib.h>
3. using namespace std;
4. template <typename T>
5. class MyClass{
6. public:
7. MyClass(){
8. cout"This is class1"endl;
9. }
10. };

12. template <typename T>
13. class MyClass<int*>{
14. public:
15. MyClass(){
16. cout"This is class2"endl;
17. }
18. };
19.
20. int main(int argc, char *argv[])
21. {
22. MyClass<int> c1;
23. MyClass<int*> c2;
24. system("PAUSE");
25. return 0;
26.}

Give three advantages that Iterators provide over Cursors.  marks 3

There are some errors in the code given below, you have to 1. Indicate the line no. with error/s 2. Give the reason for error/s 3. Correct the error/s. 1. #include (header extension is missing 2. #include 3. using namespace std; 4. template 5. class MyClass{ 6. public: 7. MyClass(){ 8. cout"This is class1"endl; 9. } 10. }; 11. template 12. class MyClass{ 13. public: 14. MyClass(){ 15. cout"This is class2"endl; 16. } 17. }; 18. int main(int argc, char *argv[]) 19. { 20. MyClass c1; 21. MyClass c2; 22. system("PAUSE"); 23. return 0; }   marks 5

Consider the code below, template< typename T > class T1 { public: T i; protected: T j; private: T k; friend void Test();}   This code has a template class T1 with three members i,j and k and a friend function Test(), you have to describe which member/s of T1 will be available in function Test().    marks 3

What will be the output after executing the following code?

class c1{ public: virtual void function(){ cout”I am in c1”endl; } }; class c2: public c1{ public: void function(){ cout”I am in c2”endl; } }; class c3: public c1 { public: void function(){ cout”I am in c3”endl; } }; int main(){ c1 * test1 = new c2(); c1 * test2 = new c3(); test1->function(); test2->function(); system(“PAUSE”); return 0;}     marks 3




question # 1

A programmer implements virtual functions by the use of virtual keyword, like:

virtual void display(){
.................
}
but how the virtual functions are implemented by compiler?

=========================================
Question # 2
Consider the following complex class,
class Complex{
private:
      double real, img;
public:
    ........
        };
we want to overload subtraction(-) operator for our complex class such that
we can subtract any double value from our complex class object using any one
of the statements given below,
Complex c1;
complex c2 = 1.546-c1;
complex c3 = c1-2.456;
you have to give the c++ code of overloaded subtraction (-) operator to
perform thesekind of operations.

=============================
Question # 3
What are Iterators? explain input iterator and output iterator.

Ans:iterators are internal data member of container. That can traverse

a container without exposing its internal representation. Iterators are for
containers exactly like pointers are for ordinary data structures.

Input Iterators:

Using input iterators we can read an element, and we can only move in forward

direction one element at a time, these can be used in implementing those
algorithms that can be solved in one pass e.g moving container once in single
direction from start to end like find algorithm.

Output Iterators :

Using output iterators we can read an element, and we can only move in forward

direction one element at a time, these can be used in implementing those
algorithms that can be solved in one pass e.g moving container once in single
direction from start to end like find algorithm .

Question # 4
Consider the code below, 
1. Template<typename T> class Test {
2. T value;
3. public:
4. Test( T val) : value(val) {}
5 Test (Const Test<T>& C): value (c.value) {}
6. }:
7. int main() {
8. Test<int> t1(0), t2(0);
9. Test<float> t3 =t1;
10. system("pause");
11. Return 0;
12. }

Given line number having any error/errors in this code ecplain the reason fro
error/s and give corrected code as well

Next quesiton 

What ll be output after excuting following line of code, ( suppose there is no
error and code will be executed correctely, justify your answer as well, 
class student{
      static int noOf students;
     int rollNo;
public:
      student::Student(){
                 noOfStudents++;
}
Student::~Student(){
        NoOfStudents--;
}
     static int getTotalStudent(){
               return noOfStudents;
}
};
int Student::noOfStudents=0;
int main(){
 Student obj1, obj2;
 {
      student obj3;
}
coutstudent::getTotalstudent();
}

Next question, 

Write c++ code that uses try catch block in member initialization list of any
class.
Ans:
Student::Student (String aName)
try : name(aName) {
...
}
catch(…) {
}

next question 
Give the difference between virtual inheritance and multiple inheritance.
Ans:

Multiple Inheritance is bassically a process , The process when a child can be derived from
more than one parent class. And If more than one base class have a function with same
signature then the child will have two copies of that function; Calling such function will
result in ambiguity.
Example of multiple inheritance:
Suppose we have a changeGearmethod in Vehicle class that is applicable to bothwater and
land vehicle, we also have Float and Move methods in water and land vehicles respectively
then our amphibious vehicle will have all these methods,

While in In virtual inheritance there is exactly one copy of the anonymous base class object

Example of virtual inheritance:
class Vehicle{
protected:
int weight;
};
class LandVehicle :
public virtual Vehicle{
};
class WaterVehicle :
public virtual Vehicle{
};
Example
class AmphibiousVehicle:
public LandVehicle,
public WaterVehicle{
public:
AmphibiousVehicle(){
weight = 10;
}

};

=====================================
next question 
Differentiate between specialization and sub-typing by giving most important
reson/s
Ans:

Specialization means that derived class is behaviorally incompatible with
the base class Behaviorally incompatibility means that base class can’t always
be replaced by the derived class Derived class has some different of restricted
characteristics than of base class.
Example: Suppose we want to add one more class of Adult for some special
requirement like for ID card generation such that it is a person but its age is greater than
18 and having all other behavior of that of person class.in this case the best solution is
that we derive adult class from person class and restrict age in that class.

Sub-typing means that derived class is behaviorally compatible with the
base class Derived class has all the characteristics of base class plus some extra
characteristics Behaviorally compatible means that base class can be replaced by the
derived class.
Example:
Student has two extra attributes program and studyYear Similarly it has extended
behaviour by adding study and takeExam.

==============================
next question explain the statment below

vector<int>ivec(4.3);

Ans:
in this case Vector instance will store our data .integers 4.3

next question 
give at least one advantage and on disadvantage of templates.
Advantage:

can drastically reduce development time using templates in combination with STL. On a more
fundamental level, templates allow you to write a single algorithm and use it across different data
types.

Disadvantage: templates can't be linked and distributed as a library. They must be compiled at

compile time, and, therefore, all implementations of a template algorithm must be included in the
header files in their entirety. 

next qustion

what do you know about function templates? describe in berefly.

Ans:
We can use Function Templates where we want to write general
function like
printArray. It can be parameterized to operation different types of
data types.

Declaration:
template< class T >
void funName( T x );

Example:
template< typename T>
void printArray( T*array, int size )
{
for ( int i = 0; i < size; i++ )
cout array[ i ] “, ”; // here data type of array is T
}

next question 

find out adn correct the syntax error(s) in the given code snippet?
template<classname T>
class Template_class{
private:
T data;
//...
Public:
///...
Void input ();
};
Template<class T>
void Template_class::input(){
cin>>data;

}void main()
{
Template_class<int>obj;
obj.input();
}

thanks a lot...

40 mcqs some from past and some new

 

Total 52 questions

4 questions of 2 marks

4 questions of 3 marks

4 questions of 5 marks

advantage and disadvantage of template 

There are some errors in the code given below, you have to Indicate the line no. with error/s Give the reason for error/s Correct the error/s.      marks 5
1. #include <iostream>
2. #include <stdlib.h>
3. using namespace std;
4. template <typename T>
5. class MyClass{
6. public:
7. MyClass(){
8. cout"This is class1"endl;
9. }
10. };

12. template <typename T>
13. class MyClass<int*>{
14. public:
15. MyClass(){
16. cout"This is class2"endl;
17. }
18. };
19.
20. int main(int argc, char *argv[])
21. {
22. MyClass<int> c1;
23. MyClass<int*> c2;
24. system("PAUSE");
25. return 0;
26.}

2.   Explain the statement vector <int> ivec (4,3)
difference b/w multiple and virtual inheritance
abstract and concrete class with real world example
some question are about code writting

Describe the way to declare a template function as a friend of any class
Can a constructor throw an exception? How to handle the errors, when the constructor fails
Abstract class ke silent feature btane thae
Template di hoe thi btana tha thk hai ke nae

1. What is graceful termination method of Error handling; give its example using C++.

2. How can you describe Virtual destructor? Why Virtual destructor is used?

3. Give the C++ code of template function to print the values of any type of array I int.this function will take 2 parameters one will be pointer and other will be will be size of array

4. ak statement ko justify krna tha

5 Marks

1.The code given below has one template function as a friend of a template class,

1. You have to identify any error/s in this code and describe the reason for error/s.

2. Give the correct code after removing the error/s.

templatevoid Test(U);

template< class T >

class B

{ int data;

public:

friend void Test<>( T ); }; templatevoid Test(U u)

{

B < int> b1;

b1.data = 7;

}

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

{

char i;

Test(i);

system("PAUSE");

return 0;

}

Ak vector array create karna tha jis ko 0,1,2,3,4,5,6,7 values initialize karne thi
Question mai classes di hoe thi or bta tha abstract class or concrete class kun si hain
code likhna tha inline ka

1.  define static and dynamic binding.

2.what is differnce b/w virtual inheritence and multiple

3.  what are container requirements (5)

4.What are the container requirements? Write details. ye 5 number ka tha

5.two types of containers basically known as first class containers.(2 Marks)

6.Describe the way to declare a template function as a friend of any class.

7 writte three  iteratre advantage

Current paper of Cs304

Total 52 questions:

4 questions of 2 marks

4 questions of 3 marks

4 questions of 5 marks.

2 mark Questions:

1. Write down a list of four intangible objects?

2. Describe three properties necessary a container to implement generic algorithms.

Answer:- (Page 301) from mooaz file

3. Write three important features of virtual functions

4.

Give the C++ code of template function to print  the values of any type of array I int.this function will take   2 parameters one will be pointer and other will be  will be size of array  ?

3 mark Questions:

1. Describe the salint feature of abstract class (mrk3)

2. define composition and give its example with coding

Answer:- (Page 53)

3. define static and dynamic binding.

Answer:- (Page 227)

4. what is constructor?

Answer:- (Page 74)

5 mark Questions:

1. What is the difference (if any) between the two types of function declarations?

template function_declaration;

template function_declaration;

2. Give three advantages that Iterators provide over Cursors.

Answer: - (Page 311)

3. What are container requirements (5)

4. What is random iterator? What is its relation with vectors?




Current paper of Cs304

Total 52 questions:

4 questions of 2 marks

4 questions of 3 marks

4 questions of 5 marks.

2 mark Questions:

1. Write three important features of virtual functions

2 Give the name of three operation that a cursor or iterate generally provide?

3. What do you know about function Template? Answer in two line.

4. What is a Virtual Destructor?

3 mark Questions:

1.define static and dynamic binding.

Answer:- (Page 227)

2. What are container requirements?

3. Sort data in the order in which compiler searches a function. Complete specialization, generic

template, Partial specialization, Ordinary function.

4. what is constructor?

5 mark Questions:

1. Describe problems with multiple inheritances?

2.Consider the code below,

template< typename T >

class T1 {

   public:

   T i;

   protected:

   T j;

   private:

   T k;

   friend void Test();

   };

 

This code has a template class T1 with three members i,j and k and a friend function Test(), you have to

describe which member/s of T1 will be available in function Test().

3. Give the c++ code of case sensitive comparison function of string class.

Answer:- (Page 265)

4. 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




Total 52 questions:

4 questions of 2 marks

4 questions of 3 marks

4 questions of 5 marks.

2 mark Questions:

1.Give two uses of a destructor.

2. Write the syntax of declaring a pure virtual function in a class?

3. What is the purpose of template parameter?

4. Give the names of three ways to handle errors in a program.

3 mark Questions:

1. Describe the way to declare a template class as a friend class of any other class.

2. What is the purpose of template parameter?

3. What is meant by direct base class?

4. State any conflict that may rise due to multiple inheritance?

5 mark Questions:

1. 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

2. What are container requirements (5)

3. Tell the logical error/s in the code given below with reference to resource management; also describe how we

can correct that error/s.

class Test{

public:

int function1(){

                  try{

                        FILE *fileptr = fopen(“filename.txt”,“w”);

                         throw exception();

                         fclose(fileptr);

                         return 0;

                         }

                         catch(Exception e){

                         ...

                         }

}

};

4. In which situation do we need to implement Virtual inheritance? explain with an example




Total 52 questions:

4 questions of 2 marks

4 questions of 3 marks

4 questions of 5 marks.

2 mark Questions:

1.Give two uses of a destructor.

2. Write the syntax of declaring a pure virtual function in a class?

3. What is the purpose of template parameter?

4. Give the names of three ways to handle errors in a program.

3 mark Questions:

1. Describe the way to declare a template class as a friend class of any other class.

2. What is the purpose of template parameter?

3. What is meant by direct base class?

4. State any conflict that may rise due to multiple inheritance?

5 mark Questions:

1. 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

2. What are container requirements (5)

3. Tell the logical error/s in the code given below with reference to resource management; also describe how we

can correct that error/s.

class Test{

public:

int function1(){

                  try{

                        FILE *fileptr = fopen(“filename.txt”,“w”);

                         throw exception();

                         fclose(fileptr);

                         return 0;

                         }

                         catch(Exception e){

                         ...

                         }

}

};

4. In which situation do we need to implement Virtual inheritance? explain with an example




21/06/2012……………….

Current paper of Cs304

Total 52 questions:

4 questions of 2 marks

4 questions of 3 marks

4 questions of 5 marks.

2 mark Questions:

1. dynamic and static binding

2. Abstract class ke silent feature

3. describe a way to declare a template function as a friend of any other class
4. Two types of template

3 mark Questions:

1.Give two uses of a destructor.

2 Give the name of three operation that a cursor or iterate generally provide?

3. A class was given and ask to draw normal form and suppressed form diagram

4. What are container requirements?

5 mark Questions:

1. Describe problems with multiple inheritances?

2. Give the correct code after removing the error/s.

template<typename U>

void Test(U);

template< class T >

class B

{ int data;

public:

friend void Test<>( T );

 };

template<typename U>

void Test(U u)

{

B < int> b1;

b1.data = 7;

 

}

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

{

char i;

Test(i);

system("PAUSE");

return 0;

 }

3. 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

4. what is iterator? and what is output and input iterator?




today's paper include question...

define random iterator.what is relation between vector and random iterator?

templates merits and demerits?

make class according to this data:

class name= DOCTOR

attributes= name, salary, design etc

method= eat, walk, treatment etc

next question is different between virtual and multiple inheritance

2 question ay thy coding k js my out ijk all member of test() T1 WALA OR 2nd aya tha correct the coding

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

12. template <typename T>
13. class MyClass<int*>{
14. public:
15. MyClass(){
16. cout"This is class2"endl;
17. }
18. };
19.
20. int main(int argc, char *argv[])
21. {
22. MyClass<int> c1;
23. MyClass<int*> c2;
24. system("PAUSE");
25. return 0;
26.}




RSS

=======================

Popular Social Events

=======================

+ Member of the Day

+ Member of the Week

+ Member of the Month

+ Member of the Year

+ Miss VU

+ Mr VU

+ Gold Members

+ Vote for Miss VU

+ Vote for Mr VU

+ Members Points Table

+ Profile Points Allocation

+ Competition Corner

+ Our Fans Club

+ Certificate Winners

---------------------------------------

௵ Scholars Of Desk

 Gold Members

 MR VU,S

௵ MISS VU,S

 Members Of Month

 Team Members

 Moderators 

  ADMINS

ʭAdministrationʭ

Senior Admin : Yasmeen

VUDESK Owner : Ismail Shah

DMCA.com

VUDESK GROUPS

© 2013   Created by ʭIsmail Shahʭ.

Badges  |  Report an Issue  |  Terms of Service

-->