BCS 031 PDF

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

No.

of Printed Pages : 3 I BCS-0311

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
De December, 2016

BCS-031 : PROGRAMMING IN C++

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question no. 1 is compulsory and carries 40 marks.


Attempt any three questions from the rest.

1. (a) Explain the basic features of an


object-oriented language. Why did people
change over from structured programming
to object-oriented programming ?

(b) Abstract class provides a base upon which


other classes may be built. Justify the
above statement with the help of an
example. 5

(c) What do you mean by inheritance ? Explain


the advantages of using multiple
inheritance in C++ with the help of an
example. 7
BCS-031 1 P.T.O.
(d) Explain the importance of a constructor in
object-oriented programming. Differentiate
between copy constructor and default
constructor in C++ with the help of an
example. 7
(e) What is function overloading ? Give its
advantages in a C++ program. Also write a
C++ program to show function overloading.

(f) How does a virtual function differ from a


pure virtual function ? Also give an
example of a pure virtual function. 6

2. (a) What is exception handling ? What is the


sequence of events when an exception
occurs ? Write a C++ program that uses
exception handling to handle the errors
caused, when a number is divided by zero. 10
(b) Differentiate among private, public and
protected access modifiers. Also explain
their meaning when a derived class
inherits from a base class using public,
protected or private keywords, with the
help of an example. 10

3. (a) Write a program to add two complex


numbers by using binary operator
overloading. Write comments in the
program wherever it is required, to give
more clarity to the program. 10

BCS-031 2
(b) Write a program in C++ to calculate the
factorial of a given number. 5
(c) Explain the association of dynamic binding
and run-time polymorphism, with example. 5

4. (a) How is unformatted I/O different from


formatted I/0 ? Explain. 5

(b) Write a C++ program to create a Book


class. Define constructor and destructor for
this class. Also define the methods to show
the title and price of the books.
(c) Explain the use of the following operators
in C++ :
(i) &
?:

(iv) &&

Write short notes on the following : 4 x5=20


(a) New and Delete Operator
(b) Parameterized Constructor
(c) Class Template
(d) Pure Virtual Function

BCS-031 3 9,000
No. of Printed Pages : 3 BCS-031
BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
Term-End Examination
June, 2016 .

7E;
BCS-031 : PROGRAMMING IN C++

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)

Note : Question no. 1 is compulsory and carries 40 marks.


Attempt any three questions from the rest.

1. (a) What is Software Re-usability ? Explain in


the context of C++ with an example. 5

(b) Define visibility of a class member. Why


are different types of visibility modes
needed in derivation of a derived class ?

(c) Explain C++ streams and stream classes


with an example.

(d) List the C++ operators that cannot be


overloaded. Give reasons for any two of
these explaining why they cannot be
overloaded. 5
BCS-031 1 P.T.O.
(e) Explain file pointers and operations. Write
a C++ program which demonstrates the use
of put( ) — get( ) and read( ) — write( ). 10

(f) Differentiate between information hiding


and encapsulation. 5

(g) What do you mean by global variable and


local variable in C++ ? Distinguish with an
example.

2. (a) Write a C++ program to demonstrate break


and continue statement. 10

(b) Write a C++ program which explains


user-defined stream manipulators. 10

3. (a) Distinguish between class templates and


function templates, through an example. 10

(b) Write an interactive C++ program which


reads two integer numbers x and y, and an
operator. It then performs the following
operations :
(i) x+y
(ii) x — y
(iii) x * y
(iv) x / y
If any other operator is entered, the
program prints out an error message. 10

BCS-031 2
4. (a) What are base and derived classes ? Create
a base class called Stack and a derived
class called Mystack. Write an interactive
C++ program to show the operations of a
stack. 10

(b) Define Polymorphism. Explain various


types of polymorphism with examples. 10

5. (a) Write a C++ program which explains the


usage of Try, Throw and Catch. 10

(b) Write a C++ program for finding the


difference between two times that are
given in 24 hour format. So
"19:00:00" — "3:30:00" = 15:30:00, while
"09:00:00" — "13:30:00" = "19:30:00". 10

BCS-031 5,500
No. of Printed Pages : 3 I BC S-031 I
BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
Term-End Examination
June, 2017

BCS-031 : PROGRAMMING IN C++

Time : 3 hours Maximum Marks : 100


(Weightctge : 75%)

Note : Question no. 1 is compulsory and carries 40 marks.


Attempt any three questions from the rest.

1. (a) Why are object oriented programming


languages more popular than structured
programming languages ? Differentiate
between structured and object oriented
programming languages.
(b) Explain ambiguity resolution in multiple
inheritance. What happens if we don't use
a virtual function in the inheritance ?
(c) Write a C++ program to create a matrix
class. Define constructor and destructor for
this class. Also define a method to find the
sum of two matrices. 10

BCS 031
- 1 P.T.O.
(d) Define the Standard Template Library.
How is the class template different from
the function template ? Explain. 6

(e) Differentiate between private, protected


and public access modifiers with the help of
an example for each. 6

(f) How is constructor different from the


`constructor with argument' ? Explain by
using an example. 6

2. (a) Write a program to demonstrate the


catching of all exceptions. What happens
when a raised exception is not caught by
catch-block (in the absence of catching all
exception blocks) ? 10

(b) Write a program to implement the


overloading of « operator. 10

3. (a) How do we declare static class data ?


Explain the syntax and rules to define
static class data. 5

(b) Write a short program to implement the


concept of passing object as argument. 5

BCS-031 2
(c) Write the general form of the user-defined
manipulators. Design a single manipulator
format to provide the following output
specifications for printing float values : 10
(i) 10 column width
(ii) Right Justified
(iii) Two-digit precision
(iv) Filling of unused places with *
(v) Trailing zeroes shown

4. (a) What is the importance of Abstract Class ?


Write a program to implement the concept
of abstract class in C++. Also explain why
an abstract class cannot be instantiated. 10
(b) Write a program to calculate the factorial
of a given number by using copy
constructor. Also write comments in your
program wherever required. 10

5. Write short notes on the following : 4 x 5=20


(a) Destructor
(b) Pure Virtual Function
(c) Friend Function
(d) Multiple Inheritance

BCS-031 3 3,500
No. of Printed Pages : 4 I BCS 031
-

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
1:316-7 44 O December, 2017

BCS-031 : PROGRAMMING IN C++

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)
Note : Question no. 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) What do you mean by Abstraction and


Encapsulation ? How are the two terms
interrelated ? 4
(b) What is a Reference Variable ? What is its
usage ?
(c) Identify the errors in the following code
segment : 4
int main( )

cout « "Enter two numbers";


cin » num » auto;
float area = length * breadth;

BCS-031 1 P.T.O.
(d) Why will the function given in the
following code fragment not work ? What
should be done to make it work ?
int main( )

float sum (float, float);

void calc(void)

float x, y, s;

cin » x » y

s = sum (x, y);

(e) What is a Friend Function ? What is the


significance of friend functions ? 4
(f) What do you mean by Static Data Members
of a class ? Explain the characteristics of
static data members. 4
(g) What do you understand by a Default
Constructor ? How is a default constructor
equivalent to a constructor with default
arguments ? 4
BCS-031 2
(h) What is Function Overloading ? Compare
default arguments with function
overloading.
(i) When should one derive a class publicly or
privately ? Give a suitable example in
support of your answer.
(j) What are Iterators ? List the five types of
iterators supported by STL in C++. 4

2. (a) How does the functioning of a function


differ when
(i) an object is passed by value ?
(ii) an object is passed by reference ? 7
(b) What is Operator Overloading ? List the
operators which cannot be overloaded. Give
reasons behind it. 7
(c) What is 'this' Pointer ? Explain the
significance of 'this' pointer with the help of
an example. 6

3. (a) What is the difference between call-by-value


and call-by-reference in a user defined
function in C++ ? Give an example to
illustrate the difference. 10
(b) What is Message Passing ? Explain how
message passing is used in C++
programming with example. 10
BCS-031 3 P.T.O.
4. (a) What is the difference between overloading
and overriding concepts in C++ ? Explain
the usage of these concepts with suitable
example code in C++. 10

(b) What is an Exception in C++ ? Explain how


exception handling is done in C++ with the
help of a program. What will happen if
exception is thrown outside of a try block ?
Give reasons for such a happening. 10

5. (a) Write a program in C++ to create a class


Employee with basic data members such as
name, address, age. Create a class
Part_time employee which inherits from
the Employee class. Part_time class should
have a function to display the name,
address and payment of the part-time
employee. 10

(b) Write a program in C++ to simulate the


environment of a simple calculator. 10

BCS-031 4 15,000
No. of Printed Pages : 3 I BCS 031
-

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
June, 2015
05723 .

BCS-031 : PROGRAMMING IN C ++
Time : 3 hours Maximum Marks : 100
(Weightage 75%)
Note : Question no. 1 is compulsory and carries 40
marks. Attempt any three questions from the rest.

1. (a) Explain object oriented concepts. How is


object oriented language different from
structured programming language ? 8
(b) What is inheritance ? Explain different
types of inheritance supported by C++. 6
(c) Differentiate between default constructor
and parameterized constructor with the
help of an example.
(d) What is an abstract class ? How do you
create an abstract class ? What is the
purpose of creating an abstract class in
object oriented programming paradigm ?
Explain with the help of an example. 8
(e) Write a C++ program to add two complex
numbers. In this program you need to
create complex class and define proper
constructor for object initialization. 10

BCS-031 1 P.T.O.
2. (a) What do you understand by friend
function ? Write a C++ program to find out
the sum of n given numbers using friend
function. 10
(b) Explain the difference between private,
protected and public access specifier with
respect to class and its object. Write a
program in this support. 10

3. (a) What do you mean by


operator-overloading ? List the operators
which cannot be overloaded. Write a C++
program for unary minus (-) operator
overloading. 10

(b) Explain the concept of virtual function with


its important characteristics. Write a C++
program to illustrate the importance of
pure virtual function. 10

4. (a) What do you mean by this pointer ? Explain


the use of this pointer with the help of an
example. 5
(b) Write a C++ program to display the
price-list of five vegetables. Use
precision( ) function to set precision 2 for
display price. 5
(c) What is function template ? Write a
function template to swap two given
numbers. 10

BCS-031 2
5. (a) What is containership ? Write the
important containers available in C++ with
their importance. 10

(b) What do you mean by exception handling ?


Write the syntax of try, throw and catch
expressions. Write a program to catch all
the exceptions in C++ programs. 10

BCS-031 3 6,500
No. of Printed Pages : 3 BCS-031
DIPLOMA IN CIVIL ENGINEERING

Term-End Examination
December, 2012
O
O
BCS-031 : PROGRAMMING IN C++
Time : 2 hours Maximum Marks : 100
(Weightage 75%)
Note : Question number 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) Explain features of structured programming 6


paradigm in brief. Also list its advantages
and disadvantages with respect to Object
Oriented Paradigm.
(b) What is encapsulation ? Explain how it is 8
different from information hiding with the
help of an example program to manage
Books issue and return in a Library.
(c) What is data type ? List any four built in 6
data types and their size in C++. Also
explain need of derived data type in C++
programming.
(d) What is an object ? Explain how objects in 8
C++ are created and destroyed, with the
help of program to create Bank-Account
Class, having data members name, account-
number, balance and member function
display balance.

BCS-031 1 P.T.O.
(e) Explain the concept of copy constructor 6
with the help of an example program.

(f) What is function template ? Write a


function template SUM to add two
numbers.

2. (a) Write a program in C++, which take two 10


3 x 3 matrices as input and find sum of them.
Implement suitable constructor and
destructor for this program.

(b) What is message passing ? Explain how 10


message passing is used in C++
programming with an example.

3. (a) What is access control specifier ? Explain 5


the need of different access control specifiers
with example.

(b) What is constructor ? Explain advantage 5


of constructor with the help of an example.
(c) Write a C++ program to create a class Book, 10
to keep the records of books available in
your library. This program should have
proper constructor and member functions,
to get the details such as publisher, author
and price etc. of the books. Make necessary
assumptions where ever required.

BCS-031 2
4. (a) Explain need of operator overloading. Also 10
explain why some operators can not be
overloaded ? Write a C++ program to
overload '+' operator to add two character
strings.
(b) What is data stream ? Explain stream 5
hierarchy in C++.
(c) What is friend function ? Explain its 5
advantage with the help of an example.

5. (a) What is polymorphism ? Explain advantage 10


of polymorphism. Also write a C++
program to explain use of virtual function.
(b) What is exception ? Explain how exception 10
handling is done in C++ with the help of a
program. Also describe what will happen if
an exception is thrown out side of a try
block and why ?

B CS-031 3
No. of Printed Pages : 2 BCS-031
BACHELOR OF COMPUTER APPLICATIONS
(Revised)

Term-End Examination
December, 2013

BCS-031 : PROGRAMMING IN C++


Time : 3 hours Maximum Marks : 100
(Weiglitage 75%)
Note : Question number 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) Explain the basic characteristics of object 6


oriented programming (OOP). Also explain
any three advantages of OOP over
procedural programming languages.
(b) What is an operator ? List the various types 8
of operators used in C++.
(c) What is meant by object initialization ? 6
What is its need ? Explain with the help of
a suitable examples.
(d) What are friend functions ? Explain two
8
merits and two demerits of using friend
functions, with the help of an example.
(e) What is slope resolution operator ? Explain 6
its use with the help of a C++ program.
(f) What is virtual function ? Explain 6
advantage of using virtual function in C++,
with the help of an example.

BCS-031 1 P.T.O.
2. (a) What is exception handling ? How is it 10
performed in C++ ? Explain with the help
of an example.
(b) Write an object oriented program in C++ to 10
read a set of integer numbers. Upto n, where
n is defined by the user and print the
contents of the array in the reverse order
using a class template.

3. (a) Write a program in C++ to find the largest 10


of any three numbers using a member
function defined in a class.
(b) What is static member ? Explain use of static 10
data member and static member function
with the help of an example program in
C++.

4. (a) List the merits and demerits of single 5


inheritance over multiple inheritance.
(b) What is polymorphism ? Explain any three 5
advantages of polymorphism.
(c) What is container ? List main types of 10
container in C++. Also list some common
member functions of container classes.

5. Write short note on the followings : 4x5=20


(a) Abstract classes
(b) Input and output streams
(c) Operator overloading
(d) Class and objects

BCS-031 2
No. of Printed Pages : 3 BCS-031
BACHELOR OF COMPUTER APPLICATIONS
(Revised)
Term-End Examination
00074 December, 2014
BCS-031 : PROGRAMMING IN C ++

Time : 3 hours Maximum Marks : 100


(Weightage 75%)
Note : Question no. 1 is compulsory and carries 40
marks. Attempt any three questions from the rest.

1. (a) Why did people change over from


structured programming to object-oriented
programming ? Explain it in brief with the
help of an example. 6
(b) • Write C++ program to find factorial of a
given number using copy constructor. 8
(c) What do you mean by inline function ?
What is its importance in object-oriented
programming languages. Write C++
program to clarify the concept of inline
function. 8
(d) Differentiate class template and function
template with the help of an example. 8
(e) Write C++ program to implement
multilevel inheritance. Provide the
necessary comments to clarify the
availability of data members and member
functions in different classes. 5
BCS-031 1 P.T.O.
(f) What is an object in C++ ? Explain how an
object can be passed as an argument to a
function with the help of an example.

2. (a) What do you mean by constructors ? Write


the characteristics of constructors. Write a
program to illustrate the use of constructor
in C++ programming. 10
(b) What happens if we don't use the virtual
function in the inheritance ? Explain the
importance of virtual function in the
reference of the above, with the help of an
example. 10

3. (a) What are the needs of operator overloading


in the program ? Why can't some operators
be overloaded ? Write C++ program to add
two complex numbers using plus (+)
operator overloading. 10

(b) Why does abstract class play an important


role in object-oriented programming ?
Write C++ program of abstract class which
uses the concept of pure virtual function. 10

4. (a) What do you mean by polymorphism ? How


is run time polymorphism different from
compile time polymorphism ? Give
example(s) to support the above
differentiation. 10

BCS-031 2
(b) What do you mean by the file stream
operations ? Write C++ program to
demonstrate the reading from disk file and
writing the result to the disk file.
(c) What is friend function ? Explain its
concept with the help of a suitable
example. 3

5. (a) Describe all types of containers that are


available in C++ with their importance, in
detail. 10

(b) Explain a situation when you will use


multiple catch statements in a C++
program for exception handling. 5

(c) Write a C++ program to find the area of a


circle.

BCS-031 3 9,000
No. of Printed Pages : 2 BCS-031
BACHELOR OF COMPUTER APPLICATIONS
(Revised)
Term-End Examination

O June, 2014

BCS-031 : PROGRAMMING IN C++


Time : 3 hours Maximum Marks : 100
(Weightage 75%)
Note : Question number 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) Explain the basic characteristics of object 8


oriented languages. How is object oriented
programming language better than
structured programming language ?
(b) What do you mean by copy constructor ? 6
Explain it with a suitable C++ program.

(c) What is meant by comparison and logical 8


operators ? How are they different from the
arithmetic and assignment operators,
explain with the help of an example.
(d) Explain function template with the help of 6
an example.
(e) What is looping in C++ ? What are the 6
advantages of using loops in C++ ? Also
list the various looping options available in
C++.
(f) What is a structure in C++, and how a 6
structure is different from a class ? Explain
with example.

BCS-031 1 P.T.O.
2. (a) What is exception handling ? What are the 10
keywords used to handle the exception in
C++ ? Write a C++ program to handle
divide by zero exception.
(b) Write a program in C++ using operator 10
template for the binary numbers to perform
a simple arithmetic operations such as add
and subtract.

3. (a) Write a program in C++ that prints 10


numbers and its cubes from 1 to 10 by using
if-then-else and for loop.
(b) Explain the use of continue statement in C++, 5
with example.
(c) Explain how setting of field width and 5
setting of precision may be done in C++.

4. (a) Write a C++ program to create vehicle class 10


and derive Car, Truck and Bike classes from
the Vehicle class. Also define proper
constructors for each of these classes.
(b) Explain the concept of virtual function with 5
the help of an example.
(c) What are access control specifiers ? Explain 5
difference between private and public access
control specifiers.

5. Write short note on the following : 4x5=20


(a) Encapsulation
(b) Message Passing
(c) Function Overloading
(d) File pointers and operations.

BCS-031 2
No. of Printed Pages : 2 BCS-031(S)

BACHELOR OF COMPUTER APPLICATIONS


(BCA) (Revised)
Term-End Examination
December, 2018

BCS-031(S) : PROGRAMMING IN C++

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)
Note : Question no. 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) Write four advantages and four


disadvantages of structured programming. 8

(b) Differentiate between information hiding


and encapsulation with an example. 4
(c) What are the operators in C++ ? Explain
with an example. 8
(d) Write a program in C++ to demonstrate the
use of Switch statement. 6
(e) Explain class templates and function
templates with illustrations. 10
(f) What are the benefits of inheritance ?
Explain in brief. 4
BCS-031(S) 1 P.T.O.
2. (a) What is inline function ? Explain its
advantage with an example. 6
(b) Write a C++ program to find out the sum of
n numbers, by defining proper class,
constructor and methods. 10
(c) Explain the use of nested if statement
with the help of an example. 4

3. (a) Define Member function and Friend


function. Write the purpose of each. 8
(b) Write a C++ program to demonstrate how
objects are passed as an argument. 7
(c) Write a program in C++ to find the
factorial of a given number. 5

4. (a) What do you mean by constructor


overloading in C++ ? Explain with the help
of an example. 10
(b) What is copy constructor ? Illustrate the
use of copy constructor with help of a
program in C++. 10

5. Write brief notes on the following : 4x5=20


(a) Message Passing
(b) Polymorphism
(c) Type Conversion
(d) File Pointers and Operations

BCS-031(S) 2 8,000
No. of Printed Pages : 3 B CS 031
- I
BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
05405 Term-End Examination

June, 2018

BCS-031 : PROGRAMMING IN C++

Time : 3 hours Maximum Marks : 100


(Weightage : 75%)
Note : Question no. 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) Define Abstraction and Encapsulation in


object oriented programming. Explain class
and object with the help of an example. 6

(b) What is polymorphism ? Explain its


advantages. Write a C++ program to
demonstrate polymorphism. 10

(c) Write a C++ program to find the sum of


two given numbers. 4

(d) What is a constructor ? Explain the


advantages of using constructors with the
help of an example. 5
BCS-031 1 P.T.O.
(e) What is a virtual function ? Write a
program in C++ to define a class "Teacher's
with a virtual function "Salary". Derive
class "Associate-Professor" from class
teacher and implement the salary function. 10

(f) What is encapsulation ? Are encapsulation


and information hiding the same ? Explain. 5

2. (a) Explain the different types of operators


available in C++. 10

(b) What is inheritance ? What are the


different types of inheritance supported
by C++ ? Explain how inheritance is
implemented in C++. 10

3. (a) Write a C++ program to define class


"Circle" and implement the following : 10
(i) a constructor

(ii) a member function to find area of a


circle

(iii) a member function to find


circumference of a circle

(b) How is function overloading implemented


in C++ ? Explain with an example
program. 10
BCS-031 2
4. (a) What is a friend function ? Explain how it
is implemented iii C++, with the help of an
example program. 10

(b) What is a template class ? Create a


template class for stack data structure. 10

5. (a) What are containers ? Explain the use of


,

List Container class with the help of an


example. 6

(b) What is an exception ? How is it handled in


C++ ? Explain it with the help of an
example. 6

(c) Explain the following with the help of an


example : 2x4=8
(i) Destructor
(ii) Inline function

BCS-031 3 6,000
No. of Printed Pages : 3 B CS-031
BACHELOR OF COMPUTER APPLICATIONS
(Revised)
Term-End Examination
O
June, 2013
O
BCS-031 : PROGRAMMING IN C++
Time : 3 hours Maximum Marks : 100
(Weightage 75%)
Note : Question number 1 is compulsory and carries 40 marks.
Attempt any three questions from the rest.

1. (a) What is object - oriented programming 6


paradigm ? Explain advantages of object -
oriented programming paradigm over
structured programming paradigm.
(b) Write a C++ program to create a class 10
NUMBER with a constructor to initialize
object of NUMBER class with three integer
data values. Define a function largest to find
the largest number among the three member
data.
(c) What is need of memory management in 5
C++ programming ? Explain in brief about
memory management process in C++.
(d) What is a virtual function ? Write a 8
program in C++ to create class Doctor with
a virtual function salary. Derive class
Visiting - Doctor and implement function
salary in it.

BCS-031 1 P.T.O.
(e) What is operator overloading ? Briefly 6
explain general rules of operator
overloading.
(f) What is stream manipulator ? Explain use 5
of setw( ) and setprecision( ) as stream
manipulator.

2. (a) Differentiate C++ programming language 5


from C programming language in terms of
parameter passing in functions..
(b) What is data type ? Draw hierarchy of data 5
types in C++.
(c) Write a C++ program to implement simple 10
calculator to perform '+, —, *, /' on two
integer operands. Your program should
have methods for reading data and for
performing arithmetical operations.

3. (a) Write a C++ program to open an existing 10


file and insert the text "My C++ File" at the
end of it.
(b) What is reusability of code ? Write a C++ 10
program to create a class student, with basic
data members such as name, address, age.
Create a class PG_student by inheriting from
student class. PG_student class should have
a function to display, name, address, subject
of the student.

BCS-031 2
4. (a) What is need of exception handling in C++ 10
programming ? Explain with an example
how exceptions are handled in C++. Briefly
describe the hierarchy of exception classes
in C++ standard library.
(b) What is template class ? Explain advantages 10
of template class. Create a template class
for Linked - List data structure.

5. (a) What is function overloading ? How it is 10


different from function overriding ? Explain
with an example of each.
(b) How function calls are matched with 10
overloaded functions in C++ ? Explain with
the help of a C++ Program.

BCS-031 3
No. of Printed Pages : 3 CI 1Es I BCS-031
BACHELOR OF COMPUTER APPLICATIONS
(BCA) (Revised)
Term-End Examination
December, 2015

BCS-031 : PROGRAMMING IN C ++
Time : 3 hours Maximum Marks : 100
(Weightage : 75%)

Note : Question no. 1 is compulsory and carries 40


marks. Attempt any three questions from the rest.

1. (a) What is structured programming ? Write


the disadvantages of structured
programming. 5
(b) How do you input non-graphic characters
in the C++ programming language ? What
do these escape sequences represent ? 5
(i) \n
(ii) a
(iii) \v
(c) Write a C++ program to demonstrate the
use of switch statement. 5
(d) Write the appropriate statements to create
a function template printarray that can
display the values contained in array
passed as parameter to the function. The
function must be able to accept integer,
float and character arrays as arguments. 10

BCS-031 1 P.T.O.
(e) Describe the concept of classes and objects
through examples. 5
(f) What are Container Classes ? List the
different types of containers and give three
examples of each.
(g) List any five common examples of
exceptions.

2. (a) Consider an example of declaring the


examination result of BCA students of
IGNOU. Design three classes : Student,
Exam and Result. The Student class has
data members such as those representing
roll no., name, etc.

Create the class Exam by inheriting


Student class. The Exam class adds fields
representing the marks scored in 6
subjects.

Derive the Result from the Exam class, and


it has its own fields such as total marks.

Write an interactive program to model this


relationship by showing the three classes.
Also, show how you can print out the
values of each member of these classes. 10+5=15

(b) Define member function. Explain the


purpose of member function. 5

BCS-031 2
3. (a) Define friend function. Discuss memory
requirements for classes, objects, data
members and member functions with an
example. 10

(b) Write a C++ program to print Student


details : Student Name, Father's Name,
Mother's Name, Student Address, Zip code,
Student Roll No. using constructor and
destructor. 10

4. (a) Explain briefly the importance of pure


virtual function in the software
development paradigm. Write a C++
program with abstract class having pure
virtual function. 10
(b) Explain exceptions in C++ program
through an example. 10

5. (a) Explain Inheritance and Multi-Inheritance


with an example. Write a C++ program
which has Inheritance and
Multi-Inheritance. 10

(b) Define Operator Overloading. Write the


general rules for Operator Overloading. 10

BCS-031 3 11,000

You might also like