KEMBAR78
Object Oriented Programming Using C++ | PDF | C++ | Programming Paradigms
0% found this document useful (0 votes)
27 views8 pages

Object Oriented Programming Using C++

Uploaded by

wizardking8938
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

Object Oriented Programming Using C++

Uploaded by

wizardking8938
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Roll No. …………………..

BCA–C202
B. C. A. (Second Semester)
EXAMINATION, 2021-22
OBJECT ORIENTED PROGRAMMING USING C++
1
Time : 22 Hours
Maximum Marks : 60
Note : All questions have to be attempted.
Section—A
1. Multiple choice questions : 1 each
(i) C++ is invented by whom ? (CO1, BL1)
(a) Dennis Ritchie
(b) Ken Thompson
(c) Brian Kernighan
(d) Bjarne Stroustrup
(ii) Which of the following correctly declares an
array in C++ ? (CO5, BL2)
(a) array{10};
(b) array array[10];
(c) int array;
(d) int array[10];

P. T. O.
[2] BCA–C202

(iii) What will be the output of the following C++


function ? (CO4, BL5)
int main( )
{
register int i = 1;
int *ptr = &i;
cout << *ptr;
return 0;
}
(a) Runtime error may be possible
(b) Compiler error may be possible
(c) 1
(d) 0
(iv) What is Inheritance in C++ ? (CO3, BL2)
(a) Deriving new classes from existing classes
(b) Overloading of classes
(c) Classes with same names
(d) Wrapping of data into a single class
(v) Pick the incorrect statement about inline functions
in C++ : (CO2, BL4)
(a) Saves overhead of a return call from a
function.
(b) They are generally very large and
complicated function.
[3] BCA–C202

(c) These functions are inserted/substituted at


the point of call.
(d) They reduce function call overheads.
(vi) Which concept allows you to reuse the written
code in C++ ? (CO4, BL1)
(a) Inheritance
(b) Polymorphism
(c) Abstraction
(d) Encapsulation
(vii) What will be the output of the following C++
code ? (CO4, BL4)
#include <iostream>
using namespace std;
int main( )
{
int a;
a = 5 + 3 * 5;
cout << a;
return 0;
}
(a) 35
(b) 20
(c) 25
(d) 30

P. T. O.
[4] BCA–C202

(viii) What is the index number of the last element of


an array with 9 elements ? (CO1, BL2)
(a) 9
(b) 8
(c) 0
(d) Programmer-defined
(ix) What will be the output of the following C++
code ? (CO2, BL5)
#include <iostream>
using namespace std;
int main( )
{
int n = 15;
for (; ;)
cout << n;
return 0;
}
(a) error
(b) 15
(c) infinite times of printing n
(d) None of the mentioned
(x) What is an inline function ? (CO1, BL2)
(a) A function that is expanded at each all
during execution.
[5] BCA–C202

(b) A function that is called during compile


time.
(c) A function that is not checked for syntax
errors.
(d) A function that is not checked for semantic
analysis.
(xi) What will happen when we use void in argument
passing ? (CO2, BL3)
(a) It will not return value to its caller.
(b) It will return value to its caller.
(c) May be or my not be return any value to its
caller.
(d) It will return value with the help of object.
(xii) What will be the output of the following C++
code ? (CO1, BL4)
#include <iostream>
using namespace std;
int max(int a, int b)
{
return (a > b ? a : b);
}
int main( )
{
int i = 5;
int j = 7;
cout << max (i, j);

P. T. O.
[6] BCA–C202

return 0;
}
(a) 5
(b) 7
(c) either 5 or 7
(d) 13
Section—B
2. Attempt any four of the following (short answer type
questions): 3 each
(a) Illustrate any three features of OOPs.
(CO5, BL4)
(b) Explain the concept of Tokens. (CO4, BL1)
(c) Explain the concept of Access Specifiers.
(CO2, BL2)
(d) Explain the concept of Private Inheritance.
(CO3, BL2)
(e) Explain the concept of this pointer. (CO4, BL1)
3. Attempt any two questions : 6 each
(a) Illustrate the concept of Nesting Member
functions in class with the help of an example.
(CO5, BL4)
(b) Differentiate types of constructors. (CO1, BL4)
(c) Compare function overloading and operator
overloading with the help of an example.
(CO1, BL4)
[7] BCA–C202

4. Attempt any two questions : 6 each


(a) Design a program to demonstrate the concept of
derived class and based class. (CO3, BL6)
(b) Design a program to demonstrate the concept of
polymorphism in C++. (CO4, BL6)
(c) Design a program to demonstrate the concept of
virtual function. (CO2, BL6)

5. Attempt any two questions : 6 each


(a) Design a C++ program to print Fibonacci series
without using recursion and using recursion.
(CO5, BL6)
(b) Create two classes DM and DB which store the
value of distances. DM stores distances in meters
and centimeters and DB in feet and inches. Write
a program that can read values for the class
objects and add one object of DM with another
object of DB. Use a friend function to carry out
the addition operation. The object that stores the
results may be a DM object or DB object,
depending on the units in which the results are
required. The display should be in the format of
feet and inches or meters and centimeters
depending on the object on display. (CO3, BL6)
(c) Make a class Employee with a name and salary.
Make a class Manager inherit from employee.

P. T. O.
[8] BCA–C202

Add an instance variable, named department, of


type string. Supply a method to string that prints
the Manager’s name, department and salary.
Make a class Executive inherit from Manager.
Supply a method to string that prints the string
Executive followed by the information stored in
the Manager superclass object. Supply a test
program that tests these classes and methods.
(CO5, BL6)

BCA–C202

You might also like