SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
RAMAPURAM CAMPUS - CHENNAI
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
21CSC101T – OBJECT ORIENTED DESIGN AND PROGRAMMING
QUESTION BANK
UNIT – 1
Basic Definitions :
[Link] out the features of procedure oriented programming.
2. List out the features of object oriented programming.
[Link] the input and output statements using in C++ along with example.
[Link] out the rules for naming variables .
[Link] built in datatypes along with syntax.
[Link] Explicit type conversions.
[Link] implicit type conversions.
[Link] class along with example.
[Link] object along with example..
[Link] abstraction and encapsulation.
[Link] are three types of access specifiers. Define them.
[Link] constructor along with example.
[Link] destructor along with example.
[Link] are the two types of methods to define member function in class? Define
them.
[Link] structural diagram and list out its types .
[Link] behavioral diagram and list out its types.
17. Define interac tiondiagram and list out its types.
[Link] use case dagram.
[Link] class diagram.
[Link] tokens.
[Link] pointers .
[Link] the structure of C++ program.
Part-B
[Link] procedure oriented programming and object oriented programming.
[Link] the features of object oriented programming.
[Link] the two types of type conversions along with syntax and example program.
[Link] the different methods of variable declaration along with example.
5. Explain concept of pointers along with syntax and example.
[Link] the components of class diagram and draw class diagram for library books
issuing
concept.
[Link] the components of use case diagram and draw use case diagram to show the
bank
customer relationship .
[Link] concept of class , object creation, member function definitions and write
example
program for arithmetic operations by using class and object , member function
concept.
Part-C Higher Order Thinking level (Questions)
1. Define a class student with the following specification
Private members of class student
admno integer
sname 20 character
eng. math, science float
total float
ctotal() a function to calculate eng + math + science with float return type.
Public member function of class student
Takedata() Function to accept values for admno, sname, eng, science and invoke
ctotal() to calculate total.
Showdata() Function to display all the data members on the screen
[Link] a class batsman with the following specifications:
Private members:
bcode 4 digits code number
bname 20 characters
innings, notout, runs integer type
batavg it is calculated according to the formula –
batavg =runs/(innings-notout)
calcavg() Function to compute batavg
Public members:
readdata() Function to accept value from bcode, name, innings, notout
and invoke the function calcavg()
displaydata() Function to display the data members on the screen
[Link] a class TEST in C++ with following description:
Private Members
TestCode of type integer
Description of type string
NoCandidate of type integer
CenterReqd (number of centers required) of type integer
A member function CALCNTR() to calculate and return the number of centers as
(NoCandidates/100+1)
Public Members
- A function SCHEDULE() to allow user to enter values for TestCode, Description,
NoCandidate & call function CALCNTR() to calculate the number of Centres
- A function DISPTEST() to allow user to view the content of all the data member
[Link] a class in C++ with following description:
Private Members
A data member Flight number of type integer
A data member Destination of type string
A data member Distance of type float
A data member Fuel of type float
A member function CALFUEL() to calculate the value of Fuel as per the following
criteria
Distance Fuel
<=1000 500
more than 1000 and <=2000 1100
more than 2000 2200
Public Members
A function FEEDINFO() to allow user to enter values for Flight Number, Destination,
Distance & call function CALFUEL() to calculate the quantity of Fuel
A function SHOWINFO() to allow user to view the content of all the data members
5. Define a class BOOK with the following specifications :
Private members of the class BOOK are
BOOK NO integer type
BOOKTITLE 20 characters
PRICE float (price per copy)
TOTAL_COST() A function to calculate the total cost for N number of copies
where N is passed to the function as argument.
Public members of the class BOOK are
INPUT() function to read BOOK_NO. BOOKTITLE, PRICE
PURCHASE() function to ask the user to input the number of copies to be
purchased. It invokes TOTAL_COST() and prints the total cost to be paid by the user.
Note : You are also required to give detailed function definitions.
[Link] a class REPORT with the following specification:
Private members :
adno 4 digit admission number
name 20 characters
marks an array of 5 floating point values
average average marks obtained
GETAVG() a function to compute the average obtained in five subject
Public members:
READINFO() function to accept values for adno, name, marks. Invoke the
function GETAVG()
DISPLAYINFO() function to display all data members of report on the screen
7. Write a program which takes an array as user input. Create two function both of
which take
the array as argument (there may be additional arguments). One function should sort
the array
in ascending order and the other should sort it in descending order. Both functions
should
return the arrays to main function. Print both arrays in main function.
8. Write a function that takes your date of birth in YYYY, MM and DD format
(separated by
spaces) as input as well as the current date in same format, and calculate your age in
years,
months and days. Use separate function for age calculation.
[Link] a C++ program in which create a class with a function to print the area and
perimeter
of a triangle. There should be a parametrized constructor having three sides as
parameters.
Take length of sides a user inputs and pass the values to object of the class using
constructor.
10. For each of the following, write a single C++ statement that performs the
identified task.
(i) Declare two variables fPtr1 and fPtr2 to be pointers to objects of type double.
(ii) Create a dynamic variable to which fPtr1 points.
(iii) If the pointer fPtr2 is undefined (i.e. it does not point to any variable), let it point
to the
same variable that fPtr1 points to.
(iv) Print the address of the object pointed to by fPtr1.
(v) Print the value of the object pointed to by fPtr2.
(vi) Release the memory occupied by the dynamic variable to which fPtr1 points.
(vii) Assign null values to the pointers fPtr1 and fPtr2