Search Papers On This Blog. Just Write The Name Of The Course

Friday 24 December 2010

CS304- Object Oriented Programming Complete Finalterm Paper 2010

FINALTERM  EXAMINATION
Spring 2010
CS304- Object Oriented Programming
Time: 90 min
Marks: 58

Student Info
Student ID:
    

Center:


Exam Date:





Question No: 1      ( Marks: 1 ) - Please choose one


A template argument is preceded by the keyword ________.

       vector

       class

       template

       type*



Question No: 2      ( Marks: 1 ) - Please choose one


What is true about function templates?







       The compiler generates only one copy of the function template

       The compiler generates a copy of function respective to each type of data

       The compiler can only generate copy for the int type data

       None of the given.


Question No: 3      ( Marks: 1 ) - Please choose one


It is sometimes useful to specify a class from which no objects will ever be created.






       True

       False


Question No: 4      ( Marks: 1 ) - Please choose one


Consider the following statements:
1) int iArray[5];
2) int *pArr = iArray;







       These statements will compile successfully

       Error in first statement

       Error in second statement

       None of given options


Question No: 5      ( Marks: 1 ) - Please choose one


If there is a pointer p to objects of a base class, and it contains the address of an object of a derived class, and both classes contain a nonvirtual member function, ding(), then the statement p->ding(); will cause the version of ding() in the _____ class to be executed.


       Base

       Derived

       Abstract

       virtual


Question No: 6      ( Marks: 1 ) - Please choose one


The user must define the operation of the copy constructor.



       True

       False


Question No: 7      ( Marks: 1 ) - Please choose one


Statement I: All the non-private members of the base class can be accessed from the derived class as if they were members of the derived class.
Statement II: The protected data members can be accessed in the same class or in its derived class






       Both are true

       Both are false

       Statement I is true, statement II is false

       Statement I is false, statement II is true


Question No: 8      ( Marks: 1 ) - Please choose one


Template functions use _________ than ordinary functions.


       Greater Memory

       Lesser Memory

       Equal Memory

       None of the given options
           


Question No: 9      ( Marks: 1 ) - Please choose one


The find() algorithm





       finds matching sequences of elements in two containers.

       finds a container that matches a specified container.

       takes iterators as its first two arguments.
       takes container elements as its first two arguments.



Question No: 10      ( Marks: 1 ) - Please choose one


Behaviors of objects are represented through,


       Data


       States


       Attributes


       Operations



Question No: 11      ( Marks: 1 ) - Please choose one


class DocElement
{
public:
      virtual void Print() { cout << "Generic element"; }
};
class Heading : public DocElement
{
public:
      void Print() { cout << "Heading element"; }
};
class Paragraph : public DocElement
{
public:
      void Print() { cout << "Paragraph element"; }
};
void main()
{
      DocElement * p = new Paragraph();

      p->Print();
}

When you run this program, it will print out a single line to the console output.

What will be in that line?

Select one correct answer from the following list:


       Generic element


       Heading element


       Paragraph element


       Nothing will be printed.


Question No: 12      ( Marks: 1 ) - Please choose one


Compiler performs ________ type checking to diagnose type errors,







       Static

       Dynamic

       Bound

       Unbound


Question No: 13      ( Marks: 1 ) - Please choose one


Function overloading should be use where behavior must be similar to some extent but code may differ.




       True

       False


Question No: 14      ( Marks: 1 ) - Please choose one


Consider the following definition

template < class T > class Xyz { … };

       it defines a class template for integers only

       it defines a class template for any data type

       class templates are not defined in this way

       none of given options


Question No: 15      ( Marks: 1 ) - Please choose one


Which one of the following is example of complete specialization,



       template <typename T> class Vector { };

       template <typename T> class Vector<T*> { };
       template<> class Vector <char*> { };

       None of given.


Question No: 16      ( Marks: 1 ) - Please choose one


By default the vector data items are initialized to ____
       0

       0.0

       1

       null



Question No: 17      ( Marks: 1 ) - Please choose one


Which one of the following functions returns the total number of elements in a vector.

       length();

       size();

       ele();

       veclen();



Question No: 18      ( Marks: 1 ) - Please choose one


An STL container can not be used to,




       hold objects of class employee.

       store elements in a way that makes them quickly accessible.

       compile c++ programs.

       organize the way objects are stored in memory


Question No: 19      ( Marks: 1 ) - Please choose one


A range is often supplied to an algorithm by two _______ values.
       italic

       iteration

       iterator

       None of given



Question No: 20      ( Marks: 1 ) - Please choose one


Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes?
       Generalization

       Sub-typing

       Specialization

       Extension


Question No: 21      ( Marks: 1 ) - Please choose one


In inheritance, a child class is a sub-type of base class.
       True

       False


Question No: 22      ( Marks: 1 ) - Please choose one


By default all members of a class are,

       Public

       Protected

       Private

       Public & protected



Question No: 23      ( Marks: 1 ) - Please choose one


this pointers are not accessible for const member functions.

       True

       False


Question No: 24      ( Marks: 1 ) - Please choose one


Object can be declared constant with the use of Constant keyword.





       True

       False

Question No: 25      ( Marks: 1 ) - Please choose one


------------- members are somewhere between public and private members. They are used in inheritance

       protected

       public

       private

       global


Question No: 26      ( Marks: 1 ) - Please choose one


In Private --------------  only member functions and friend classes or functions of a derived class can convert pointer or reference of derived object to that of parent object


       specialization

       inheritance

       abstraction

       composition

Question No: 27      ( Marks: 2 )


Give the basic difference between Iterators and cursors?




Question No: 28      ( Marks: 2 )


What are the non - type parameters for templates?


Question No: 29      ( Marks: 2 )


State any conflict that may rise due to multiple inheritance?


Question No: 30      ( Marks: 2 )


What is behavior of an object. Explain it with the help of one real life example..



Question No: 31      ( Marks: 3 )


Give the general syntax of nested try catch blocks?



Question No: 32      ( Marks: 3 )


Write a template function that takes one template parameter and always returns value that is always equal to double of its parameter value (parameter * 2).


Question No: 33      ( Marks: 3 )


If we declare a function as friend of a template class will it be a friend for a particular data type or for all data types of that class.



Question No: 34      ( Marks: 5 )


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.

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



Question No: 35      ( Marks: 5 )


 Examine the following code and determine the output of the program
a.       if A and B methods are virtual
b.      if A and B methods are not virtual


class A
{
public:
void method() { cout<<"A's method \n"; }

};

class B : public A
{

public:
void method() { cout<<"B's method\n"; }

};

void main()
{

A obj1;
B obj2;
A* aptr;
aptr = & obj2;
obj2. method();
obj1. method();
aptr -> method();

}



Question No: 36      ( Marks: 5 )


Q. What do you know about Exception in initialization ? Expalin it with a help of an example.

No comments:

Post a Comment