You are on page 1of 2

www.Vidyarthiplus.

com

Question Paper Code : 53109

2
om 1

Reg. No. :

B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2010

Fifth Semester

pa
ul
.c

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

jin

Answer ALL questions

21re

PART A (10 2 = 20 Marks)

With respect to C++ distinguish objects from classes.

2.

Write a copy constructor for class date (assume mm, dd, yy as its members).

3.

What is encapsulation? Do friend functions violate encapsulation?

4.

How are virtual functions declared in C++?

5.

What are IO streams? Give an example.

6.

What is the purpose of the STL (Standard Template Library)?

7.

Give two examples for java modifiers.

8.

What is the purpose of the getBytes( ) method?

9.

Give a sample statement for parseInt( ) and give comments for the statement.

10.

What are the two ways of creating java threads?

nl
o

ad
ed

fro
m

1.

(a)

Write a C++ program to perform 2D matrix operations as follows:


(i)
Define class MATRIX, use appropriate constructor(s).
(5)
(ii) Define methods for the following two matrix operations:
determinant and transpose.
(6)
(iii) Write a main program to demonstrate the use of the MATRIX class
and its methods.
(5)
Or

do
w

21

11.

PART B (5 16 = 80 Marks)

Explain the features of object oriented programming. Describe how each


of these is implemented in C++ and Java.

(b)

www.Vidyarthiplus.com

www.Vidyarthiplus.com
(a)

Write a C++ program as follows to perform arithmetic operations on


Rational numbers of type a/b, where a and b are integers.

2
om 1

12.

(i)

Define a class by Rational Number.

(4)

(ii)

Use operator overloaded methods for addition and subtraction.

(6)

(iii) Write a main program to demonstrate the use of this class and its
methods.
(4)
(iv)

Give a sample output.

(2)

What is meant by inheritance? Explain with examples, the various types


of inheritance supported in C ++.

(a)

Write a C++ program to demonstrate file handling as follows: get strings


as input from the user, store them in a file, retrieve them and display
them.
Or

Explain the exception handling mechanism available in C++ with


suitable examples.

(a)

Write a menu-based java program that can calculate the area of a


triangle, circle or square, based on the users choice.

21re

(b)

fro
m

14.

pa
ul
.c

(b)

jin

13.

Or

Or

(a)

Write a java class called student with name, Marks of 3 subjects and
total Marks. Write another class named calculate that gets the Marks
of the student and calculates the total Marks and displays the result
(pass or fail).

Explain the Virtual Machine concept with reference to Java.

ad
ed

15.

(b)

Explain the following with examples from Java.


(i)

Streams and IO

(ii)

Java threads.

(2 8 =16)

do
w

21

nl
o

(b)

Or

www.Vidyarthiplus.com

53109

You might also like