CS6456 Oop Rejinpaul ND15 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Reg. No.

Question Paper Code : 27170


B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2015:

Fourth Semester

Electrical and Electronic Engineering

CS 6456 - OBJECT ORIENTED PROGRAMMING

(Common to Electronics and Instrumentation Engineering, Instrumentation and


Control Engineering)

(Regulations 2013)
Time : Three hours Maximum : 100 marks
Answer ALL questions.
PART A - (10 x 2 = 20 marks)

1. Differentiate a Constant Pointer and a Pointer to a Constant with an example.

2. Illustrate the usage of this pointer in C++.

3. When do you call an Object destructor?

4. What is a pure virtual function?

5. What is an Iterator? List out the characteristics of an Iterator.

6. What do you mean by the term 'Generic Programthing'?

7. Define the keyword 'static' in java.

8. Write the output produced by the following Code Fragments.

System.out.printin ("Result : "+ 40 + 30);

System.out.printin ("Result : "+(40 + 30));

9. Differentiate Checked and Unchecked exceptions.

10. How do you compare two strings by ignoring the case? Give an example.

PDF compression, OCR, web optimization using a watermarked evaluation copy of CVISION PDFCompressor
PART B - (5 x 16 = 80 marks)

11. (a) (i) Write a C++ program to implement a Binary Search Procedure to
find whether the given element is present in the array or not using
Objects and Classes. (6)
(ii) Write short notes on casting primitive data types to Object type and
vice versa with an example for each. (6)
(iii) What is a namespace? How do you resolve the name conflicts using
namespaces? Explain with an example. (4)

Or
(b) (i) Write a C++ program to find maximum of two numbers using inline
functions. (4)
(ii) Write a C++ program to find the area of the square, rectangle, circle
using function overloading. (8)
(iii) Briefly describe on the objected oriented features supported by C++.
(4)

12. (a) Develop a class Polynomial whose internal representation is a term


consisting of a coefficient and an exponent. Develop a complete class
containing proper constructor and destructor functions as well as set and
get functions. Overload the addition and subtraction operator to add and
subtract two polynomials and display the results. Overload the
assignment operator to assign one polynomial to another using friend
function. (16)

Or
(b) (i) Develop an abstract Class Polygon from which Triangle and
Rectangle are derived. Each Polygon should contain the function
Area( ) to calculate the area of them. Invoke appropriate Area( )
function to calculate the area using pointer to base class and
pointers to derived classes. (12)
(ii) Create a 'Vector' named Student to add the names of the students
in a class. Also display the contents of the vector after adding
necessary elements. (4)

13. (a) (i) Implement a Dictionary named "Index" which consists of


Key Terms and its Descriptions using MAP STL. Try to display all
the terms and descriptions present in the dictionary and if a key
term has been provided as an input, the corresponding description
should get displayed as an output to the user by searching the
entire dictionary. (8)
(ii) Implement -a Circular Queue with proper insertion and deletion
operations using Class Templates. (8)

Or

2 27170

PDF compression, OCR, web optimization using a watermarked evaluation copy of CVISION PDFCompressor
(b) (i) Write a C++ program to accept integer or string values from the
user within a specified range. (Range has to be specified with
minimum and maximum by the user). If the input violates the
range, appropriate exception needs to be raised. (6)

(ii) Write a C++ program to sort a list of integers, floating point


numbers and Characters by Quick Sort mechanism using function
templates. (6)

(iii) Write short notes on the storage structures available with Standard
Template Libraries. (4)

14. (a) (i) What are Packages? How are they created and used? Illustrate it
with an example. (8)

(ii) How do you implement multiple inheritance in Java? Explain. (4)

(iii) Why java has been called as "Write Once and Run Anywhere"?
Explain. (4)

Or
(b) Write a Java application to implement Mark Processing system for a
University consisting of various disciplines such as Engineering, Science
and Arts. Grade calculation for the students differs across the disciplines.
(i) Grade calculation for Undergraduate Engineering students requires
the involvement of technical events apart from the marks obtained
in their subjects and Post graduate Engineering students require
research project as an additional component.
(ii) For Post graduate Science students, involvement of paper
presentation is required whereas assignment weightage is
mandatory for Post graduate Arts students.
Grades for Research scholars would be computed based on the
number of research articles published and number of research
projects done. Try to implement the above system polymorphically.
(16)
15. (a) (i) Create an application that executes two threads. First thread
displays the alphabets A to Z at every one second. The second
thread will display the alphabets Z to A at every two seconds. Both
the threads need to synchronize with each other for printing
alphabets. The Second thread has to wait until the first thread
finishes its execution. The application waits for all the threads to
finish the execution. (10)

(ii) What is an interface? How do you achieve multiple inheritance


through interfaces? Explain with an example. (6)

Or

3 27170

PDF compression, OCR, web optimization using a watermarked evaluation copy of CVISION PDFCompressor
(b) (i) Write a Java program to accept a string from user and check
whether it is a file or directory. If it is a directory, count the number
of files in that directory. If it is a file, count the number of
consonants and display the contents of the file in a reverse order. (6)
Write a Java program that enters an 8-digit string for a birthdate.
The first two digits in the string are the month of birth, the next
two are the day and the remaining four are the year. The Java
program should squeeze out these substrings and calculate the
current age (Hint: Approximately print the difference in years).
Raise a NegativeAgeException if the calculated age is negative.
(10)

4 27170

PDF compression, OCR, web optimization using a watermarked evaluation copy of CVISION PDFCompressor

You might also like