You are on page 1of 5

No.

of Pages : 5

BCS–C-101
B. Sc. SEMESTER I
EXAMINATION, Feb., 2021
Subject : COMPUTER SCIENCE
Paper Name : Object Oriented
Programming Using C++
Time : Three Hours ] [ Maximum Marks : 70
Note : Question paper is divided into two Sections
A and B. Attempt both Sections. Answer
questions as per instructions given.
Section—A
(Short Answer Type Questions)
Note : Attempt any five questions in about
150 words each. Each question carries
6 marks. (5×6=30)
1. Obtain the output from the following C+ +
program as expected to appear on the screen
after its execution.
#include<iostream>
using namespace std;
P. T. O.
[2] BCS–C-101

int main()
{
char *Text = "AJANTA";
int *P, Num[] = {11,5,7,9};
P = Num;
cout<<*P<<Text<<endl;
Text++;
P++;
cout<<*P<<Text<<endl;
return 0;
}
2. Why does C++ introduce reference variable ?
3. How are constructors different from member
functions ?
4. Why is friend function required ? Explain with
an example.
5. What is the ambiguity that arises in multiple
inheritance ? How it can be overcome ?
Explain with example.
6. What is the need of virtual function ? With an
example, explain overriding of member
function of base in derived class.
[3] BCS–C-101

7. Explain Calling a virtual function through a


base class reference.
8. What is the need for class templates ? Create a
template for bubble sort functions.
9. Write down the example of dynamic
constructor in C++.
10. What are the memory requirements for the
class, objects, member functions, data
members, static and non-static data members ?
Section—B
(Long Answer Type Questions)
Note : Attempt any four questions in detail. Each
question carries 10 marks. (4×10=40)
1. What is a user defined exception ? Write down
the scenario where we require user defined
exceptions. When do we need multiple catch
blocks for a single try block ? Give an
example.
2. Write a C++ program using function template
to find the product of two integer or floating
point type of data.
3. Write a C++ program involving input/output
using overloaded operators << and >> and
member functions of I/O stream classes.
P. T. O.
[4] BCS–C-101

4. Write a C++ program to check the given


integer is prime or composite number.
5. Write a C++ program to compute the cosine of
a number using the following series :

x 2 x 4 x6
cos ( x) =1− + − + .....
2! 4! 6!

6. Write a template- based program for adding


objects of the vector class. Use dynamic data
members instead of arrays for storing vector
elements.
7. It is required to find out the cost of
constructing a house. Create a base class called
house. There are two classes called door and
window available. The house class has
members which provide information related to
the area of construction, doors windows details
etc. It delegates responsibility of computing
this cost of doors and windows construction to
door and window classes respectively. In
C++, this can be achieved by having instances
of the classes door and window in the House
class.
Write an interactive program to model the
above relationship.
[5] BCS–C-101

8. Write a C++ program to computer the standard


deviation of a set of values using the following
formula :
Σ ( x − mean) 2
σ=
n
x is a set of numbers.
mean is the average of the set of numbers.
n is the size of the set.
σ is the standard deviation

BCS–C-101
P. T. O.

You might also like