TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Oops qb cse
1. 1
OBJECT ORIENTED PROGRAMMING
ANNAUNIVERSITY QUESTIONS FOR PART-B UNIT WISE
UNIT-1
11 a)explain the major principle of oop with illustration & neat sketches
Or
11 b)explain in detail
1)inline function
2)friend function
3)const function
4)volatile function with suitable illustrations(MAY 12)
11. (a) (i) Highlight the features of object oriented programming
language.(8) (APR 11)
(ii) Explain function overloading with an example. (8) (APR 11)
Or
(b) (i) Consider a Bank Account class with Acc No. and balance as data
members. Write a C++ program to implement the member functions
get_Account_Details ( ) and display_Account_Details ( ).Also write a
suitable main function. (10) (APR 11)
(ii) Write a C++ program to explain how the member functions can
be accessed using pointers. (6) (APR 11)
11 a)wring a class’ite brief notes on friend function & show how modifying
a class’s private data with a friend function
Or
11 b) write a c++ pgm that
1)calculates & print the sum of the integers from 1 to 10
2)to calculate x raised to the power y (NOV11)
11. (a) (i) Write a C++ program to multiply two matrices and print the result.
(Marks 8) (ii) Explain inline functions with an example. (Marks 8) (APR 10)
Or
(b) (i) Explain the concept of pointers with an example program written in
C++. (Marks 10) (APR 10)
(ii) How is function overloading different from operator overloading. (Marks
6) (APR 10)
11. (a) (i) Explain the idea of Classes, Data abstraction and
encapsulation. (8) (NOV 09)
(ii) Write a C++ program that inputs two numbers and outputs the
largest number using class (8) (NOV09)
Or
(b) (i) What are the rules to be followed in function overloading. (4)
(NOV09)
(ii) Write a C++ program that can take either two integers or two
floating point numbers and outputs the smallest number using class,
friend functions and function overloading. (12) (NOV09)
11. (a) Explain the special features of object oriented programming.
(16)(NOV 10)
Or
(b) (i) List the special characteristics of friend function. (6) (NOV10)
(ii) Write a C++ program to find the area of the square, rectangle, circle
using function overloading. (10) (NOV10)
UNIT-2
12. (a) (i) Explain copy constructor with an example. (8) (APR 11)
(ii) Consider a Fruit Basket class with no. of Apples and no. of
Mangoes as data members. Overload the ‘+’ operator to add two
objects of this class. (8) (APR 11)
Or
(b) (i) Justify the need for using friend functions in overloading with an
example. (10)
(ii) Explain the use of destructor with an example. (6) (APR 11)
12. (a) (i) What are the copy constructors and explain their need? (Marks 8)
(APR 10)
(ii) Explain the syntax of operator overloading. How many arguments
are needed in the definition of an overloaded binary operator? Give
an example. (Marks 8) (APR 10)
Or
(b) Explain friend functions with an example. (Marks 16) (APR 10)
12. (a) (i) Explain the various types of constructors(4) (NOV 09)
2. 2
(ii) Write a C++ program that takes the (x,y) coordinates of two points
and outputs the distance between them using constructors. (12) (NOV 09)
Or
(b) Write a C++ program that takes two values of time (hr, min,
sec) and outputs their sum using constructors and operator overloading.
(16) (NOV 09)
12. (a) Explain the different types of constructors with suitable examples.
(16) (NOV10)
Or
(b) (i) Write the rules for overloading the operators. (6) (NOV 10)
(ii) Write a C++ program to add two complex numbers using operator
overloading. (10) (NOV10)
12 a) write a pgm to overload the stream insertion & stream extraction
operators to handle data of a userdefined telephone number class called
phonenumber
Or
12 b) 1)Explain ‘+’ operator overloading with an example
2)explain type conversion with suitable example(NOV 11)
12 a)what are the various types of constructors?illustrate with programming
examples
Or
12 b)what is meant by function overloading?write a c++ pgm to illustrate the
concept of function overloading? (MAY12)
UNIT-3
13. (a) Write a C++ program to 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 and
windows details. It delegates responsibility of computing the cost of doors
and window construction to door and window classes respectively. Write
a C++ program to model the above relationship and find the cost of
constructing the house. (Marks 16) (APR 10)
Or
(b) Write a C++ program to compute the square root of a number. The input
value must be tested for validity. If it is negative, the user defined
function mysqrt() should raise an exception. (Marks 16) (APR 10)
13. (a) (i) Explain with an example, how exception handling is carried out in
C++. (8)
(ii) Write a class template to insert an element into a linked list. (8) (APR
11)
Or
(b) (i) Write a class template to implement a stack. (10)
(ii) What is a user defined exception? Explain with an example. (6)
(APR 11)
13 a)define a divide by zero definition & use it to throw exceptions on
attempts to divide by zero
Or
13 b)write a c++ pgm to demonstrate function template to print array of
different types(NOV11)
13. (a) (i) Explain the overloading of template function with suitable
example.
(8) (NOV10)
(ii) Write a function template for finding the minimum value contained
in an array. (8) (NOV10)
Or
(b) (i) List the advantages of exception handling mechanisms. (4)
(ii) Write a C++ program for the following :
(1) A function to read two double type numbers from keyboard.
(2) A function to calculate the division of these two numbers.
(3) A try block to throw an exception when a wrong type of data is
keyed in.
(4) A try block to detect and throw an exception if the condition
‘‘divide-by-zero’’ occurs.
(5) Appropriate catch block to handle the exceptions thrown. (12) (NOV10)
13 a)what is a function template?write a template function to sort arrays of
float & int using bubble sort
or
13 b)discuss in detail about exception handling constructs & write a pgm to
illustrate divide by zero exception(MAY12)
13. (a) (i) Write the syntax for member function template. (4) (NOV 09)
3. 3
(ii) Write a C++ program using class template for finding the scalar
product for int type vector and float type vector. (12) (NOV09)
Or
(b) (i) Explain how rethrowing of an exception is done. (4) (NOV 09)
(ii) Write a C++ program that illustrates multiple catch statements.
(12) (NOV 09)
UNIT-4
14. (a) What are abstract classes? Write a program having student as an
abstract class and create many derived classes such as engineering,
science, medical etc.,from the student class. Create their object and
process them. (Marks 16) (APR 10)
Or
(b) Consider an example of book shop which sells book and video tapes.
These two classes are inherited from the base class called media. The
media class has command data members such as title and publication.
The book class has data members for storing number of pages in a book
and the tape class has the playing time in a tape. Each class will have
member function such as read() and show() in the base class, these
members have to be defined as virtual functions, write a program which
models the class hierarchy for book shop and process objects of these
classes using pointers to the base class. (Marks 16) (APR 10)
14. (a) (i) Explain runtime polymorphism with an example. (10)
(ii) Write short notes on: RTTI, down casting. (3 + 3) (APR 11)
Or
(b) (i) Discuss the different types of inheritance supported in C++ with
suitable illustration. (10) (ii) Describe the purpose of a virtual base class,
giving a suitable example. (6) (APR 11)
14 a) Explain different type of inheritances
b)Explain runtime polymorphism with example(NOV 11)
14. (a) Explain different types of inheritance with suitable example for each
one
of them. (16) (NOV 10)
Or
(b) (i) Give the rules for writing virtual functions. (6)
(ii) Write a C++ program to illustrate the use of virtual function. (10) (NOV
10)
14 a)what is application of virtual function?explain with exa how late
binding is achieved
Using virtual function
or
14b)exping the various runtime cast in detail(MAY 12)
14. (a) (i) Explain the different forms of inheritance (4) (NOV 09)
(ii) Write a C++ program handling the following details for students
and staff using inheritance.
Student details : name, address, percentage marks.
Staff details : name, address, salary.
Create appropriate base and derived classes. Input the details and
output them(12) (NOV09)
Or
(b) (i) Explain the need for pure virtual functions. (NOV09)
(4)
(ii) Write a C++ program for calculating the area of rectangle and circle
using run-time polymorphism.
(12) (NOV 09)
UNIT-5
15. (a) Write a C++ program to store set of objects in a file and to retrieve
the same. (16)
Or
(b) (i) Highlight the features of STL. (6)
(ii) List the different stream classes supported in C++ (4)
(iii) Write a C++ program to read the contents of a text file. (6) (APR 11)
15. (a) (i) Explain any two functions used for manipulating file pointers.
(4) (NOV09)
(ii) A data file ‘‘DATA’’ contains the name and marks of a set of
students. Write a C++ program that reads the contents of this file
into an object, sorts the data in descending order of marks and
writes the result to an output file ‘‘OUTPUT’’. (12) (NOV09)
Or
(b) (i) Explain any two sequence containers supported by Standard
Template Library. (4)
(NOV09)
(ii) Write a C++ program using lists from STL to input 10 numbers and
store them in a list. From this list, create two more lists, one
containing the even numbers, and the other containing the odd
numbers. Output all the three lists. (12) (NOV 09)
4. 4
15. (a) (i) Explain the use of any six manipulators with example. (6)
(ii) Discuss in detail the unformatted I/O operations. (10) (NOV10)
Or
(b) (i) Explain the stream classes for file operations with suitable
diagram. (4)
(ii) Write an interactive, menu-driven C++ program that will access the
database file containing the list of telephone numbers and their
corresponding customer name, and implement the following tasks :
(1) Determine the telephone number of the specified person.
(2) Determine the name if the telephone number is known.
(3) Update the telephone number, whenever, there is a change.
(12) (NOV 10)
15 a)what are manipulators?explain in detail various manipulators used for
i/o operations with example
Or
15 b) discuss in detail about STL(MAY12)
15 a)write a c++ pgm that maintains a bank’s account infn,the pgm adds new
accounts,deletes accounts in a text file.assume that a file credit.dat has been
created & the initial data has been inserted
Or
15 b)write brief notes on STL & standard library container classes(NOV11)
15. (a) Write a program which copies the contents of one file to a new file by
removing unnecessary spaces between words. (Marks 16) (APR 10)
Or
(b) Explain various file stream classes needed for file manipulations. (Marks
16) (APR 10)
BLUE PRINT(UNITWISE)
UNIT-1
1)BASIC CONCEPTS OF OOPS
2)DEFAULT ARGS,FUNCTION OVERLOADING
3)INLINE,FRIEND FUNCTIONS & ITS IMPORTANCE WITH FRIEND
CLASS
4)STATIC MEMBERS & FUNCTION
5)POINTERS & OBJECT
6)CONST & VOLATILE FUNCTION
UNIT-2
1)TYPES OF CONSTRUCTORS
2) OPERATOR OVERLOADING
A)WITH FRIEND FUNCTION(UNARY,BINARY)
B)WITHOUT FRIEND(UNARY,BINARY)
3)RULES FOR OPERATOR OVERLOADING
4)DESTRUCTOR
5)CONSTRUCTOR OVERLOADING
6)TYPE CONVERSION
UNIT-III
1)TEMPLATE CLASS,FUNCTION
2)TRY,CATCH,THROW EXCEPTION HANDLING
3)TERMINATE,UNEXPECTED EXCEPTION
UNIT-IV
1)TYPES OF INHERITANCE
2)VIRTUAL BASE CLASS
3)ABSTRACT CLASS
4)RUNTIME POLYMORPHISM
5)VIRTUAL & PURE VIRTUAL
6)TEMPLATE & RTTI
7)DYNAMIC CASTING
UNIT-V
1)IOS FUNCTIONS & MANIPULATORS (FORMATTED I/O)
2)FILE HANDLING(UNFORMATTED I/O)
3)NAMESPACES
4)STL
5)STRING OBJECTS