We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
Roll No. LI | ie]
LI | |
B.E/ B.Tech (Full Time) End Semester Examinations, Apr - May 2019
(Computer Science and Engineering)
Semester IL
88203 Programming using C++
(Regulation 2012)
Time: 3 Hours Answer ALL Questions Max. Marks: 100
PART - A(10 x2 =20 Marks)
1, Isit possible to compare two pointer variables? Illustrate using an example
List the diéferent modes in which e file can be opened.
3. How does C++ class differ from structures in C?
4, Give a simple function that demonstrates the use of a unique pointer, which is automatically
passed to a member function when it is invoked.
5, List the advantages of overloading.
6, Explain the significance of different access specifiers used in inheritance
7. Exemplii
the use of reinterpret_cast operator
8, What is the difference between function overloading and templates?
9, Write the significance of Iterators in STL containers.
10. How does a map differ from list?
PART- B/S x16
(Qn. 11 is Compulsory)
11. Answer the following
A. Copy constructor and Dynamic constructor. @
B. List those operators that can be and cannot be overloaded in C++. @
C. "Only destructors can be made virtual”. Justify your answer. Q
D. When will you make a function Inline. Write an inline function to find the maximum of three
numb
@)
E. Is there any way to access class private members without its object? Justify your answer.
12.) i) Write a program that demonstrates the use of static data member, static member
function and array of objects. (10)
ii) What is en array of pointers ? And how does it differ from pointer to an array?
Ilustrate with an example. 6(OR)
) i) Write a C program to calculate the net salary of an employee with structure members
as Name, Empid, Basic pay, Da(10% of Basic pay), Ta(12% of Basic pay). Create a
pointer pointing to en array of 10 employees. Write a display function to display the
details of employee who is getting the highest salary based on their annual income
using pointers. Also write an update function to modify the annual income by
deducting IT( use structure pointer as function argument), (20)
ii) Write a C program to store 5 names in a text file, Display the same, Append 2 names
and display the byte position of 6th name. 6)
13. a) i) Create 2 base class named, ‘shape! with two members base and height, a member
function for initialization and a virtual function to compute area(). Derive two specific
classes Triangle and Rectangle which override the function area(). Use these classes in
main function and display the erea of triangle and rectangle using virtual functions.
(12)
Brief about Abstract base class and Virtual base class with suitable syntax. 4
(OR)
b) Write a program that has a class Train with data members- no_of _seats_1*, no_of
Te
seats ‘, no_of seats_3"™' and member functions to set and display data. Derive a class
Reservation that has data members- seats_booked_1®, _ seats_booked_2™,
seats_booked_3™*- and functions to book and cancel tickets, and display the status.
(16)
14. a) i) List out the advantages of class and function templates. (4)
ii) Write a generic function to perform linear search on an array a2)
(OR)
b) Write a program that has 2 class Matrix, overload the += operator, and throws an
exception if number of rows and columns of the two matrices are not equal. a6)
that reads a file and copies its contents in another file. While copying,
full stops with commas. &)
them as even or odd. Store all even integers in a file called EVEN.TXT and all odd
numbers in ODD.TXT(OR)
5) i) Write a program that demonstrates the use of different cast operators. (8)
ii) Write a program to implement Vectors in
operations,
= push_back( )
+ pop_back()
+ begin( )
-end() (8)