Object Oriented Programming Question Paper
Object Oriented Programming
Course:General Science
Institution: Gcse question papers
Exam Year:2018
Masai technical training institute
OBJECT ORIENTED PROGRAMMING
APRIL,2018
1. 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?
PART B — (5 ??16 = 80 Marks)
11. (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
(b) Explain the features of object oriented programming. Describe how each
of these is implemented in C++ and Java.
12. (a) Write a C++ program as follows to perform arithmetic operations on
Rational numbers of type a/b, where a and b are integers.
(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)
Or
(b) What is meant by inheritance? Explain with examples, the various types
of inheritance supported in C ++.
13. (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
(b) Explain the exception handling mechanism available in C++ with
suitable examples.
14. (a) Write a menu-based java program that can calculate the area of a
triangle, circle or square, based on the user’s choice.
Or
(b) Explain the Virtual Machine concept with reference to Java.
15. (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).
Or
(b) Explain the following with examples from Java. (2 ??8 =16)
(i) Streams and IO
(ii) Java threads.
——————
More Question Papers
Exams With Marking Schemes