Wednesday, November 4, 2009
OBJECT ORIENTED PROGRAMMING |
B.E./B.Tech. DEGREE EXAMINATION, |
Second Semester |
Information Technology |
IF 144 — OBJECT ORIENTED PROGRAMMING |
Time : Three hours Maximum : 100 marks |
Answer ALL questions. |
PART A — (10 ? 2 = 20 marks) |
1. Define the terms (a) data abstraction (b) inheritance. |
2. What are the types of variables in C++ that can have floating point values? Write the range of |
each type of variable. |
3. What are wild pointers? |
4. What are inline functions? What are their advantages? |
5. Is the following statement correct? Give reasons. |
Destructors can be overloaded. |
6. How are interfaces different from classes? |
7. What is a thread? Compare a thread with a process. |
8. List any 4 methods of class applet. |
9. What are the different forms of comment statements in Java? |
10. What is an I/O stream? |
PART B — (5 ? 16 = 80 marks) |
11. Explain the elements of object oriented programming. Describe how these elements are |
implemented in C++ and Java. |
12. (a) Write a C++ program to read the elements of a 2D matrix and display them. Arrays |
should not be used. Dynamically allocate space for the elements of the matrix. Provide function |
for release of memory. Write a program to test the functions. |
Or |
(b) Model a complex number as a class. Provide constructors to initialize either with (0, 0) or |
with values given. Overload and <<> |
13. (a) What are the different forms of inheritance supported in C++? Discuss on the visibility of |
the base class members in privately and publicly inherited classes. |
(b) What are virtual function? What are the rules associated with them? What are abstract |
classes? Give an example (with the program) to illustrate the use of abstract classes. |
14. (a) Explain the life cycle of a thread. List any 4 methods of class thread in Java. With |
examples, illustrate ways of creating threads in a Java program. |
Or |
(b) Define an interface to declare methods to increment time and to display time. Define another |
interface that declares methods to set time. Define class digital clock that r epresents time in the |
format hr/min/sec. and another class minute clock to represent time in format hr/min. Have these |
two classes to implement methods defined in both interface. Write a test program. |
15. (a) Write the syntax of applet tag in HTML. How are parameters passed to an applet? Write |
an applet to display the age of the user passed as the parameter to it. |
Or |
(b) Define an inheritance hierarchy to represent quadrilateral, trapezoid, rectangle and square. ( , |
) co-ordinates of four end points of the shape should be taken as points in the super class. Write |
methods to display the co-ordinates and areas of shapes. Write a test program to create a set of |
shapes and display their area. Explain the object oriented features used. |