CS304 Finalterm Current Paper 2013 File 10

No Comments

Current papercs304:
2 mark Questions:

1. Write down a list of four intangible objects?

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



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



3. define static and dynamic binding.



4. what is constructor?



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.

3. What are container requirements (5)

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

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

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



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.


Describe cache handler. (2)
Can an object have more then one aspects? Describe briefly (3)
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. (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. };
11.
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. }
What will be the output after executing the following code? (5)
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;

}

Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment