CS304 - Current Final Term Paper Solved
CS304 - Current Final Term Paper Solved
FINALTERM EXAMINATION
CS304- Object Oriented Programming (Session - It is sometimes useful to specify a class from which
1) no objects will ever be created.
3 ► True
Question No: 1 ( Marks: 1 ) - Please choose ► False
one
Question No: 6 ( Marks: 1 ) - Please choose
Which one of the following terms must relate to one
polymorphism?
Assume a class Derv that is privately derived from
► Static allocation class Base. An object of class Derv located in main()
can access
► Static typing
► public members of Derv.
► Dynamic binding
► protected members of Derv.
► Dynamic allocation
► private members of Derv.
► protected members of Base.
Question No: 2 ( Marks: 1 ) - Please choose
one
Question No: 7 ( Marks: 1 ) - Please choose
one
Multiple inheritance can be of type
► Public
A pointer to a base class can point to objects of a
► Private
derived class.
► Protected
► All of the given
► True
► False
Question No: 3 ( Marks: 1 ) - Please choose
Question No: 8 ( Marks: 1 ) - Please choose
one
one
When a subclass specifies an alternative definition
A copy constructor is invoked when
for an attribute or method of its superclass, it is
► a function do not returns by value.
_______ the definition in the superclass.
► an argument is passed by value.
► overload
► a function returns by reference.
► overriding
► an argument is passed by reference.
► copy riding
► none of given
Question No: 9 ( Marks: 1 ) - Please
choose one
Question No: 4 ( Marks: 1 ) - Please choose
one
A function call is resolved at run-time
in___________
Like template functions, a class template may not
► non-virtual member function.
handle all the types successfully.
► virtual member function.
► True
► Both non-virtual member and virtual
► False
member function.
► None of given
Question No: 5 ( Marks: 1 ) - Please choose
one
Question No: 10 ( Marks: 1 ) - Please
choose one
2|Page
Each try block can have ______ no. of catch blocks. Question No: 16 ( Marks: 1 ) - Please
choose one
►1
►2 Which of the following is/are advantage[s] of
►3 generic programming?
► As many as necessary. ► Reusability
► Writability
► Maintainability
Question No: 12 ( Marks: 1 ) - Please ► All of given
choose one
Question No: 17 ( Marks: 1 ) - Please
Two important STL associative containers are choose one
_______ and _______.
► set,map By default the vector data items are initialized to
► sequence,mapping ____
► setmet,multipule
► sit,mat ►0
► 0.0
Question No: 13 ( Marks: 1 ) - Please ►1
choose one ► null
The mechanism of selecting function at run time Question No: 18 ( Marks: 1 ) - Please
according to the nature of calling object is called, choose one
1. ++ ► Templates
► Overloading
2. * ► Data hiding
► Encapsulation
3. %
Question No: 6 ( Marks: 1 ) - Please choose
4. All of the given choices one
this pointer does not pass implicitly to A class template may inherit from another class
template.
__________ functions.
1. Static Member ► True
► False
2. Non-Static Member
Question No: 8 ( Marks: 1 ) - Please choose
3. Instance Number one
In Private -------------- only member functions and
4. None of the given friend classes or functions of a derived class can
convert pointer or reference of derived object to
that of parent object
Operator overloading is
► specialization
► inheritance
1. making C++ operators work with ► abstraction
objects. ► composition
► All
► One specific Question No: 3 ( Marks: 1 ) - Please choose
► All instances of one date type one
► None of the given options
► A obj<char>; wrong
Question No: 28 ( Marks: 1 )
Classes like TwoDimensionalShape and ► Obj <char> A;
ThreeDimensionalShape would normally be
concrete, while classes like Sphere and Cube Question No: 6 ( Marks: 1 ) - Please choose
would normally be abstract. one
► True
► False The user must define the operation of the copy
constructor.
Question No: 29 ( Marks: 1 )
In order to define a class template, the first line ► True
of definition must be:
► False
► template <typename T>
► typename <template T>
10 | P a g e
► variable
► array
► function
► datatype
► Static pg261
Question No: 15 ( Marks: 1 ) - Please choose
► Dynamic one
Question No: 11 ( Marks: 1 ) - Please choose ► A class is a section of the hard disk reserved
one for object oriented programs
► private,public
► static,public
► none of given
Question No: 16 ( Marks: 1 ) - Please choose The type that is used to declare a reference or pointer is
one called its ---------
► default type
Inheritance is a way to
► static type
► True ► private
► False ► global
Question No: 18 ( Marks: 1 ) - Please choose Question No: 23 ( Marks: 1 ) - Please choose
one one
________ and ______ methods may not be Which of these are examples of error handling
declared abstract. techniques ?
► Abnormal Termination
► private,static
► Graceful Termination
12 | P a g e
► throw block
Question No: 28 ( Marks: 2 )
► main block
► non of the given State any two reasons why the virtual methods can
not be static?
Question No: 25 ( Marks: 1 ) - Please choose
one 1-virtual method can not be static as it is dynamic
2-as virtual method is dynamic so it works
automatically that is also another reason
Graphical representation of the classes and objects That virtual method can not be static.
is called object model it shows -------
class mother {
public:
Question No: 32 ( Marks: 3 ) mother ()
{ cout << "mother: no parameters\n"; }
mother (int a)
What do you mean by Stack unwinding? { cout << "mother: int parameter\n"; }
};
When we want to check what happens actually to
the local variables in the try block when then an class daughter : public mother {
exception is thrown this concept is called stack public:
unwinding. daughter (int a)
{ cout << "daughter: int parameter\n\n"; }
};
14 | P a g e
return 0;
9. Sub-Object can not be initialized using the
} constructor
True
Output will be False
5. Select correct line of code for inheritance 12. Which of the following operator doesn't
relationship between “Keys” class and take any argument if overloaded?
“SpecialKeys” class. “Person” is parent class /
while “SpecialKeys” is child class. -
class SpecialKeys: public Keys +
class Keys: public SpecialKeys None of the given choices
class SpecialKeys:: public Keys
class Keys:: public SpecialKeys 13. “A fan has wings”. Which type of
relationship exists between fan and wings?
6. “Keyboard” class is composed of “keys” Aggregation
class. What will be the order of execution of Association
constructor of “Keyboard” class and “Keys” Composition
class? Inheritance
First Detructor::Keys..
Second Destructor::Keyboard.. 14. What type of relationship exists between
First Destructor:: Keyboard.. “Account” class and “SavingAccount” class?
Second Destructor:: Keys.. Inheritance
Composition
7. Identify which of the following overloaded Aggregation
15 | P a g e
Procedures
Packages 5 Methodologies to the development of reusable
Templates software relate to__________.
None of given
A Structure programming
Templates automatically create different versions B procedural programming
of a function, depending on user input.
Select correct option: C generic programming
True D None of the given
False
Always make pointer to null, whenever Select correct line of code for composition
relationship between "Keyboard" class and
dynamic memory is deleted.
Select correct option: "Keys" class
True
False class keyboard { Keys type;};
class keys{ KeyBoard type; };
__________ provide the facility to access
the data member. class keyboard : private keys
class keys: private KeyBoard
Select correct option:
accesser function
17 | P a g e
It is illegal to make objects of one class c++ dynamic binding and polymorphism
members of another class. will be achieved when member function
Select correct option: will be __.
True Select correct option:
False private
public
In resolution order compiler search virtual
firstly _______. inline
Select correct option:
Generic Template Consider the code below, class
Partial Specialization class1{ protected: void func1(); }; class
Complete Specialization class2 : public class1 { }; Function func1
Ordinary function of class1 is ____ in class2,
Select correct option:
template<> class Vector{ void** p; //.... public
void*& operator[] ((int i); }; protected
Select correct option: private
This specialization can then be used as the none of the given options
common implimentation for all Vectors of
pointers. Consider the code below, class
This spcialization can then be used as the class1{ private: void func1(); }; class
all type implimentation for one type class2 : private class1 { }; Function func1
classes. of class1 is ____ in class2,
This specialization can then be used Select correct option:
double type pointers. public
This specialization should be used for protected
Vectors of all type int types. private
none of the given options
Objects
Which of the following features of OOP is None of given
used to deal with only relevant details?
Abstraction Which will be the Primary task or tasks of
Information hiding generic programming?
Object Categorize the abstractions in a domain
into concepts
Implement generic algorithms based on
____________ Binding means that the concepts
targets function for a call is selected at Build concrete models of the concepts
compile time. All of given
Static
Dynamic ] __________class to be executed.
Automatic Base
None of given Derived
Virtual
Implemented
It is illegal to make objects of one class Select correct line of code for inheritance
members of another class. relationship between "Person" class and
True "Supervisor" class. "Person" is parent
False class while "Supervisor" is child class.
Select correct option:
\
class Supervisor: public Person
Friends are used exactly the same for class Person: public Supervisor
template and non-template classes. class Supervisor:: public Person
True
False class Person:: public Supervisor
Variable
Function
22 | P a g e