Previous Year Papers of C++ For Ignou Students BCS - 031 (BCA) (IGNOU Notes of C++) (Important Qestions of C++ IGNOU BCS-031)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

1. Explain features of structured programming paradigm in brief.

Also list its advantages and


disadvantages with respect to Object Oriented Paradigm. 6

(i) What is object - oriented programming paradigm ? Explain advantages of object - oriented
programming paradigm over structured programming paradigm. 6
(ii) Explain object oriented concepts. How is object oriented language different from structured
programming language ? 8
(iii) Why did people change over from structured programming to object-oriented programming ?
Explain it in brief with the help of an example. 6
(iv) What is structured programming ? Write the disadvantages of structured programming. 5
(v) Explain the basic features of an object-oriented language. Why did people change over from
structured programming to object-oriented programming ? 8
(vi) Explain the basic characteristics of object oriented languages. How is object oriented
programming language better than structured programming language ? 8
(vii) What is a structure in C++, and how a 6 structure is different from a class ? Explain with
example. 6

2. What is encapsulation ? Explain how it is different from information hiding with the help of an
example program to manage Books issue and return in a Library. 8

(i) Write short note on the following : Encapsulation 4


(ii) Differentiate between information hiding and encapsulation. 5

3. 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.

(i) What is data type ? Draw hierarchy of data types in C++. (5

4. 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, accountnumber, balance and member
function display balance. 8

(i) 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. 5.

5. (e) Explain the concept of copy constructor with the help of an example program. 6

(i) Write C++ program to find factorial of a given number using copy constructor. 8
(ii) 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
(iii) What do you mean by copy constructor ? Explain it with a suitable C++ program. 6
6. What is function template ? Write a function template SUM to add two numbers. 6.

(i) 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
(ii) Explain function template with the help of an example. 6
(iii) What is function template ? Write a function template to swap two given numbers. 10
(iv) Distinguish between class templates and function templates, through an example. 10

7. Write a program in C++, which take two 3 x 3 matrices as input and find sum of them. Implement
suitable constructor and destructor for this program. 10

(i) Write a program in C++ to find the largest of any three numbers using a member function
defined in a class. 10
(ii) Write a program in C++ to calculate the factorial of a given number. 5
(iii) Write a program in C++ using operator template for the binary numbers to perform a simple
arithmetic operations such as add and subtract. 10
(iv) Write a program in C++ that prints numbers and its cubes from 1 to 10 by using if-then-else
and for loop. 10

8. (b) What is message passing ? Explain how message passing is used in C++ programming with an
example. 10.

(i) Write short note on the following : 4x5=20(b) Message Passing

9. (a) What is access control specifier ? Explain the need of different access control specifiers with
example. 5

(i) What are access control specifiers ? Explain difference between private and public access control
specifiers. 5.

10. What is constructor ? Explain advantage of constructor with the help of an example. 5

(i) Write a C++ program to create a class Book, 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. 10
(ii) What do you mean by constructors ? Write the characteristics of constructors. Write a program
to illustrate the use of constructor in C++ programming. 10
(iii) 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
(iv) Write a C++ program to create vehicle class and derive Car, Truck and Bike classes from the
Vehicle class. Also define proper constructors for each of these classes. 10
(v) 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.
(vi) Write a C++ program to create a class 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. 10
(vii) Differentiate between default constructor and parameterized constructor with the help of an
example. 8
(viii) short note (b) Parameterized Constructor 4
(ix) Write a C++ program to find the area of a circle. 5
(x) Write a C++ program to implement simple calculator to perform '+, —, *, /' on two integer
operands. Your program should have methods for reading data and for performing arithmetical
operations. 10
(xi) (a) Write a C++ program to open an existing file and insert the text "My C++ File" at the end of
it. 1
(xii) Write a C++ program to display the price-list of five vegetables. Use precision( ) function to set
precision 2 for display price. 5
(xiii) Write a C++ program which explains the usage of Try, Throw and Catch. 10
(xiv) 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

11. Explain need of operator overloading. Also explain why some operators can not be overloaded ?
Write a C++ program to overload '+' operator to add two character strings. 10

(i) (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
(ii) (b) Define Operator Overloading. Write the general rules for Operator Overloading. 10
(iii) (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
(iv) (e) What is operator overloading ? Briefly explain general rules of operator overloading. 6
(v) (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
(vi) short note (c) Operator overloading 4

12. What is an operator ? List the various types of operators used in C++. 8

(i) What is slope resolution operator ? Explain its use with the help of a C++ program. 6

(ii) Explain the use of the following operators in C++ : 8.

 &
 ?
 ::
 &&

(iii) Short Note :” New and Delete Operator 4

(iv) What is meant by comparison and logical operators ? How are they different from the arithmetic
and assignment operators, explain with the help of an example. 8

(v) List the C++ operators that cannot be overloaded. Give reasons for any two of these explaining
why they cannot be overloaded. 5

(vi) 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

13. What is data stream ? Explain stream hierarchy in C++. 5

(i) 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. 7
(ii) Explain C++ streams and stream classes with an example. 5
(iii) What is stream manipulator ? Explain use of setw( ) and setprecision( ) as stream
manipulator. 5.
(iv) Write a C++ program which explains user-defined stream manipulators. 10
(v) Input and output streams

14. What is friend function ? Explain its advantage with the help of an example. 5.

(i) What are friend functions ? Explain two merits and two demerits of using friend functions,
with the help of an example. 8
(ii) What is friend function ? Explain its concept with the help of a suitable example. 3
(iii) Define friend function. Discuss memory requirements for classes, objects, data members and
member functions with an example. 10
(iv) What do you understand by friend function ? Write a C++ program to find out the sum of n
given numbers using friend function. 10
15. What is polymorphism ? Explain advantage 10 of polymorphism. Also write a C++ program to explain
use of virtual function. 10

(i) What is polymorphism ? Explain any three advantages of polymorphism. 5


(ii) 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
(iii) Explain the association of dynamic binding and run-time polymorphism, with example. 5
(iv) Define Polymorphism. Explain various types of polymorphism with examples. 10

16. 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 ? 10

(i) What is exception handling ? How is it performed in C++ ? Explain with the help of an example.
10
(ii) Explain a situation when you will use multiple catch statements in a C++ program for exception
handling. 5
(iii) Explain exceptions in C++ program through an example. 10
(iv) 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
(v) What is need of exception handling in C++ programming ? Explain with an example how
exceptions are handled in C++. Briefly describe the hierarchy of exception classes in C++
standard library. 10
(vi) What is exception handling ? What are the keywords used to handle the exception in C++ ?
Write a C++ program to handle divide by zero exception.10
(vii) 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
(viii) List any five common examples of exceptions. 5

17. Explain the basic characteristics of object oriented programming (OOP). Also explain any three
advantages of OOP over procedural programming languages. 6

18. What is meant by object initialization ? What is its need ? Explain with the help of a suitable
examples. 6

(I) 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

19. What is virtual function ? Explain advantage of using virtual function in C++, with the help of an
example. 6
(i) 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
(ii) 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
(iii) Explain briefly the importance of pure virtual function in the software development paradigm.
Write a C++ program with abstract class having pure virtual function. 1 0
(iv) How does a virtual function differ from a pure virtual function ? Also give an example of a pure
virtual function. 6
(v) What is a virtual function ? Write a program in C++ to create class Doctor with a virtual function
salary. Derive class Visiting - Doctor and implement function salary in it. 8
(vi) Explain the concept of virtual function with the help of an example. 5
(vii) Write short notes on the following : Pure Virtual Function 4

20. Write an object oriented program in C++ to 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. 10

 Write short notes on the following : 4 x5=20 Class Template


 What is template class ? Explain advantages 10 of template class. Create a template class for
Linked - List data structure. 10.

21. What is static member ? Explain use of static data member and static member function with the
help of an example program in C++. 10

 Define member function. Explain the purpose of member function. 5

22. List the merits and demerits of single inheritance over multiple inheritance. 5

 Explain Inheritance and Multi-Inheritance with an example. Write a C++ program which has
Inheritance and Multi-Inheritance. 10
 What do you mean by inheritance ? Explain the advantages of using multiple inheritance in C++
with the help of an example. 7
 What is inheritance ? Explain different types of inheritance supported by C++. 6
 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
 What is reusability of code ? Write a C++ 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.
10
 What is Software Re-usability ? Explain in the context of C++ with an example. 5
23. What is container ? List main types of container in C++. Also list some common member functions of
container classes. 10

(i) Describe all types of containers that are available in C++ with their importance, in detail. 10

(ii) What are Container Classes ? List the different types of containers and give three examples of
each.5

(iii) What is containership ? Write the important containers available in C++ with their importance. 10

24.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

25. How function calls are matched with overloaded functions in C++ ? Explain with the help of a C++
Program. 10

26. 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

27. Describe the concept of classes and objects through examples. 5

 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
 Abstract class provides a base upon which other classes may be built. Justify the above
statement with the help of an example. 5
 (iii)
 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
 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
 Define visibility of a class member. Why are different types of visibility modes needed in
derivation of a derived class ? 5
 (v) Write short note on the followings : 4
 Abstract classes
 Class and objects

28. Write a C++ program to demonstrate the use of switch statement. 5

29. What is function overloading ? Give its advantages in a C++ program. Also write a C++ program to
show function overloading. 7

 What is function overloading ? How it is different from function overriding ? Explain with an
example of each. 10
 Write short note on the following : Function Overloading 4

30. 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

 Differentiate C++ programming language from C programming language in terms of parameter


passing in functions.. 5

31.How is unformatted I/O different from formatted I/0 ? Explain. 5

32. What is need of memory management in C++ programming ? Explain in brief about memory
management process in C++. 5

33. Explain the use of continue statement in C++, with example.

 Write a C++ program to demonstrate break and continue statement. 10

34. What is looping in C++ ? What are the advantages of using loops in C++ ? Also list the various
looping options available in C++. 6

35. Explain how setting of field width and setting of precision may be done in C++. 5.

36. Explain file pointers and operations. Write a C++ program which demonstrates the use of put( ) —
get( ) and read( ) — write( ). 10

 Write short note on the following : File pointers and operations. 4


 What do you mean by this pointer ? Explain the use of this pointer with the help of an example.
5
37. Explain the difference between private, protected and public access specifier with respect to class
and its object. Write a program in this support. 10

38. What do you mean by global variable and local variable in C++ ? Distinguish with an example. 5

You might also like