B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011.
Electrical and Electronics Engineering
CS 2311 – OBJECT ORIENTED PROGRAMMING
(Common to Electronics & Instrumentation Engineering and Instrumentation &
Time : Three hours Maximum : 100 marks
Answer ALL questions.
PART A — (10 × 2 = 20 marks)
1. What is the difference between a pointer and a reference?
2. What are copy constructors?
3. What is a friend function?
4. What is a virtual base class?
5. What are manipulators? How do you create a one?
6. What is the difference between a function template and template function?
7. What is an abstract class?
8. Under which contexts would you use ‘final’ and ‘finally’.
9. How is the keyword ‘super’ used in Java?
10. What are wrapper classes in Java?
PART B — (5 × 16 = 80 marks)
11. (a) (i) Explain the basic Object Oriented concepts. (10)
(ii) Write a C++ program that will ask for a temperature in Fahrenheit and display it. (6)
(b) (i) Illustrate the concept of function overloading to find the maximum of two numbers. (10)
(ii) What are inline functions? Write a sample code to explain. (6)
12. (a) (i) Create a class that contains one data member. Overload all the four arithmetic operators so that they operate on the objects of that class. (10)
(ii) Describe the syntax of the different forms of inheritance in C++.(6)
(b) (i) What are virtual functions? Explain with a suitable program.(10)
(ii) What is dynamic binding? How is it achieved? (6)
13. (a) (i) Explain the features of I/O system supported in C++. (10)
(ii) Write a program containing a possible exception. Use a try block and throw it and a catch block to handle it properly. (6)
(b) (i) Write a program that reads a name from the keyboard into three separate string objects and then concatenates them into a new string object using ‘+’ operator and append() function. (10)
(ii) List the major categories of containers supported by STL. (6)
14. (a) (i) Describe the structure of a typical Java program and give the steps to execute it. (10)
(ii) Explain the importance of JVM in JRE. (6)
(b) (i) Create a Complex number class in Java. The class should have a constructor and methods to add, subtract and multiply two complex numbers, and to return the real and imaginary parts.(10)
(ii) What are packages? How we they created and used? (6)
15. (a) (i) Describe the three different types of inheritance with an example Java program for each.
(ii) Describe the concept of interface with the syntax. (6)
(b) (i) Write a Java program to demonstrate how to read and write data to a file. (10)
(ii) What is a thread? How do you create threads? (6)