B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011
Fifth Semester
Electrical and Electronics Engineering
CS 2311 — OBJECT ORIENTED PROGRAMMING
(Common to Instrumentation and Control Engineering and
Electronics and Instrumentation Engineering)
(Regulation 2008)
Time : Three hours Maximum : 100 marks
Answer ALL questions.
PART A — (10 × 2 = 20 marks)
1. Define abstraction and encapsulation.
2. When will the destructors be called? Is it implicit or explicit?
3. List the operators that cannot be overloaded.
4. What are pure virtual functions? Where are they used?
5. Define Exception. Give example.
6. State the purpose of namespaces with an example.
7. What is byte code? Mention its advantage.
8. What are packages?
9. Define interface. State its use.
10. What is thread? How does it differ from a process?
PART B — (5 × 16 = 80 marks)
11. (a) Explain in detail about Class, Objects, Methods and Messages.
Or
(b) Write a C++ program to define overloaded constructor to perform string initialization, string copy and string destruction.
12. (a) Write a C++ program to implement C = A + B , C = A − B and C = A ∗ B where A , B and C are objects containing a int value (vector).
Or
(b) Explain run time polymorphism with example program in C++.
13. (a) Explain the different types of streams and various formatted I/O in C++.
Or
(b) Explain the various file handling mechanisms in C++.
14. (a) Write a java program to create two single dimensional arrays, initialize them and add them; store the result in another array. .
Or
(b) Write a java program to perform all string operations using the String class.
15. (a) Explain in detail about the inheritance mechanism in Java with example programs.
Or
(b) Explain with example program, exception handling in java.