B.E/B.Tech DEGREE EXAMINATION Apr/May 2008
Third semester Computer Science and Engineering
CS 1204 - Object Oriented Programming
Time: 3 hours Maximum marks: 100
PART A (10 x 2 =20 marks)
1. Define Encapsulation
2. What is an expression? Give an example
3. State the meaning of the public access specifier
4. Can the precedence of an operator be altered?
5. What stream class is required to create an output stream?
6. Why is it not possible to refer an exception declared within try block outside try block?
7. Justify the statement “Java is platform independent”.
8. What is the difference between overloading and overriding?
9. Explain the Life cycle of Thread
10. Compare interface and abstract class
PART B (5 x 16 = 80)
11(a)(i)Justify the need for object-oriented paradigm (ii)What are the different data types supported by C++? (iii)What are the differences between reference variables and normal variables?
(or)
(b)(i)What are the difference between break and continue statements? (ii)Write a C++ program to print the sum of all squares between 1 and N,where N is a number accepted from the keyboard (ie)1+4+….+(N*N)
12(a)(i)Give the access rules for accessing static members (ii)Write a program to overload unary operator ++ for incrementing distance. Assume that the distance class has feet and inches as data members
(b)(i)What is operator overloading? How many arguments are required in the definition of an overloaded binary operator? (ii)What are the different forms of inheritance supported by C++?Explain them with an example
13(a)Explain how exception handling is achieved in C++.Give 5 different constructs and explain the working of them.
(b) (i)What are file modes? Describe various file mode options available in C++. (ii)Explain the various file stream classes needed for file manipulations in C++
14(a)(i)Compare and contrast the following control structures in Java _do…while and the while statement _switch statement and if…else statement (ii)What is method?
(b)Explain the various forms of inheritance in Java with necessary coding
15(a)Explain any 5 classes to support exception handling in java with an example for each
(b)(i)State the uses of interface (ii)Explain how to create and use a package with an example