Bengal Engineering and Science University 2007 B.E Computer Science and Engineering Object oriented technology - Question Paper
The ques. paper is with the attachment.
B.E. 4th Semester Examination, 2007 Object Oriented Technology (CS 403)
F.M:70 Time: 3 hrs.
Attempt question no. 1 and any FIVE from the rest.
1. a) State whether the following statements are TRUE or FALSE. (5)
i) Functions cannot return class objects.
ii) A function declared as static cannot access non-static class members.
iii) A function template can have more than one template argument.
iv) Pure virtual functions force the programmer to redefine the virtual function inside the derived classes.
v) When deriving a class from a base class with protected inheritance, public members of the base class became protected members of the derived class.
b) Tick V the correct answer. (5)
i) Which of the following is true in context of friend mechanism in C++?
Given class A is friend of class B implies B is friend of A
Given class A is friend of class B, and class B is friend of class C implies class A is friend of class C
Friends are not affected by the public, private or protected section in which they are declared within the class body
Friend classes are given access only to the protected and public members of the class granting friendship
ii) In C++, a virtual class
is an abstract class
is not inherited
is inherited only once
the one which has a virtual function
iii) If a class X is public base class of Y then
Y can access all private, protected and public members of X
the private, protected and public members of X become public in Y
the access control of members of X remains the same in Y
the private, protected and public members of X become protected in Y
iv) The actual source code for implementing a template function is created when
the function is actually executed
the declaration of the function appears
the definition of the function appears
the function is invoked
v) An exception may be thrown from
a throw statement in a catch block
a try block in a function
a function called in a try block
a return statement in a function
2. a) Differentiate between procedure oriented approach and object oriented approach of
software development process. (5)
b) What do you mean by Object Oriented Analysis (OOA)? Discuss briefly the steps to be performed in OOA. (7)
3. a) What is Unified Modeling Language(UML)? Why is it important for software
development system? . - (4)
b) Define Use Case Diagram and Class Diagram with possible graphical notations. Suppose a customer placing an order with a sales company, where a customer may be corporate customer or personal customer. Draw both the diagram for this problem. (8)
4. a) What is a virtual function? Explain its importance with an example. (2+4) b) Define a base class shape with two data members and two member functions
get_data() and display_area(). Base class data members are initialized by get_data() and display_areaQ is used to compute and display the area of figures. Derive two classes triangle and rectangle from the base class shape. Redefine display_area() in the derived classes to suit their requirements.
Using these three classes, design a program that will accept dimensions of a triangle or a rectangle interactively and display the area.
Note that Area of a triangle = (1/2) x base x height. (6)
5. a) What are input and output streams? (2)
b) What is a file mode? Describe various available file mode options in C++. (4)
c) Write command line argument programs in C++ to (6)
i) create a text file
ii) take the printout of above created text file
6. a) What is this pointer? Define a class person with one of its data member age and a
member function greater(). This member function compares two person objects and returns the object with greater age. Use the appropriate prototype of the member function greatei(). (6)
b) Define a self-referential structure type to store numbers. Define a class LinkList with a structure type(define above) data member and two member functions
add_item(int d) and display_list(). To insert a single item d into a link list
add_item(int d) is used and display_list() is used to display the link list. Hence, wile a program in C++ to create a link list with n elements and display it. (6)
7. a) How is conversion function created? Explain its syntax. (4)
b) We have two classes X and Y. If a is an object of X and b is an object of Y and we want to say a = b; what type of conversion routine should be used and where? (3)
c) Define a class string. Use overloaded = = operator to compare two strings. (5)
8. a) When do we use the protected visibility specifier to a class member? (2) b) When do we make a class virtual? In what order are the class constructors called
when a derived class object is created? (4)
c) We know that a private member of a base class is not inheritable. Is it any way possible for the objects of a derived class to access the private members of the base class? If yes, how? Explain it with a suitable C++ program. Remember, the base class cannot be modified. (6)
9. a) What is the difference between a function template and template function? Write a function template for finding the minimum value contained in an array and explain how does it increase the code reuse. (6)
b) Why do you need to use exception-handling mechanism? Write a program containing a possible exception using a try block to throw it and catch blocks to handle it properly. (4)
c) Demonstrate the concept of rethrowing an exception. (2)
Attachment: |
Earning: Approval pending. |