Gujarat Technological University 2010 M.C.A Object Oriented Concepts and Programming (OOCP) - Question Paper
GUJARAT TECHNOLOGICAL UNIVERSITY
MCA. Sem-II Examination July 2010
Seat No. Enrolment No.
Subject code: 620003
Subject Name: Object Oriented Concepts & Programming (OOCP) Date: 05 /07 /2010 Time: 11.00 am - 01.30 pm
Total Marks: 70
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
Q.1 a i. Compare structured programming with object oriented programming. 03
b How are the constructors and destructors called in inheritance? 07
Q-2 a. Distinguish between macro definition, normal function and inline function. What 07 are the advantages and disadvantages of inline function?
OR
b. Explain polymorphism. How do you achieve run time polymorphism in C++? 07
Q-3 a. i. How is the memory allocated to the object of a class? Explain with example. 04
ii. Explain: Abstraction and Encapsulation 03 b. i. What are read only objects? Explain the role of constructors in creating such 04 objects?
OR
Q-3 a. i. What are constructors and destructors? How do they differ from normal 04 function?
ii. In C++, a variable can be declared anywhere in the program. What is the 03 significance of this feature?
ii. Explain the need of static function for a class. 03
Q-4 a. Compare containership with inheritance. Also list the types of inheritance. 07
1. mutable
2. reinterpret_cast
OR
Q-4 a. Why functions like terminate or unexpected exists when abort () and exit () 07 functions are available? b. i. List out various modes of opening a file. Explain app and ate with example. 04
ii. Explain the need of virtual base class with example. 03
Q-5 a. What is virtual destructor? Explain its need. Can we have virtual constructor? 07 Why?
i. Explain the following:
1. friend function
2. anonymous namespace
ii. Design classes such that they support the following statements:
04
Rupee r1,r2; Dollar d1,d2;
d1 = r1; // converts rupee (Indian Currency) to dollar (US currency) r2 = d2; // converts dollar (US Currency) to rupee (Indian currency) NOTE: Assume 1 dollar = 47 Rupees
OR
What are the problems of using macros? How does template helps in this? Explain with example
Q-5 a.
07
03
04
b.
i. What are the advantages of having readymade components in STL?
ii. Create two classes Integer and Float that stores the int type and float type
respectively. Include default constructor, copy constructor in both the classes. Also write the functions that support the following.
Float F1;
Integer I1;
F1 = I1 + F1;
*************
2
Attachment: |
Earning: Approval pending. |