Search This Blog

Friday, September 16, 2011 ·

Third Semester
Computer Science and Engineering
(Common to Information Technology)
(Regulation 2008)
Time : Three hours Maximum : 100 Marks
Answer ALL Questions
PART A — (10 × 2 = 20 Marks)
1. List any four Object Oriented programming concepts.
2. What is an abstract class?
3. What is a copy constructor?
4. What are the operators that cannot be overloaded?
5. What are templates?
6. Illustrate the exception handling mechanism.
7. What are the visibility modes in inheritance?
8. Write the prototype for a typical pure virtual function.
9. What are the file stream classes used for creating input and output files?
10. List out any four containers supported by Standard Template Library.
PART B — (5 × 16 = 80 Marks)
11. (a) (i) Explain the idea of Classes, Data abstraction and encapsulation.
(ii) Write a C++ program that inputs two numbers and outputs the
largest number using class. (8)
(b) (i) What are the rules to be followed in function overloading. (4)
(ii) Write a C++ program that can take either two integers or two
floating point numbers and outputs the smallest number using
class, friend functions and function overloading. (12)
12. (a) (i) Explain the various types of constructors. (4)
(ii) Write a C++ program that takes the (x,y) coordinates of two points
and outputs the distance between them using constructors. (12)
(b) Write a C++ program that takes two values of time (hr, min, sec) and
outputs their sum using constructors and operator overloading. (16)
13. (a) (i) Write the syntax for member function template. (4)
(ii) Write a C++ program using class template for finding the scalar
product for int type vector and float type vector. (12)
(b) (i) Explain how rethrowing of an exception is done. (4)
(ii) Write a C++ program that illustrates multiple catch statements.
14. (a) (i) Explain the different forms of inheritance. (4)
(ii) Write a C++ program handling the following details for students
and staff using inheritance.
Student details : name, address, percentage marks.
Staff details : name, address, salary.
Create appropriate base and derived classes. Input the details and
output them. (12)
(b) (i) Explain the need for pure virtual functions. (4)
(ii) Write a C++ program for calculating the area of rectangle and circle
using run-time polymorphism. (12)
15. (a) (i) Explain any two functions used for manipulating file pointers. (4)
(ii) A data file ‘‘DATA’’ contains the name and marks of a set of
students. Write a C++ program that reads the contents of this file
into an object, sorts the data in descending order of marks and
writes the result to an output file ‘‘OUTPUT’’. (12)
(b) (i) Explain any two sequence containers supported by Standard
Template Library. (4)
(ii) Write a C++ program using lists from STL to input 10 numbers and
store them in a list. From this list, create two more lists, one
containing the even numbers, and the other containing the odd
numbers. Output all the three lists. (12)


Post a Comment