22316 Object-Oriented Programming using C++ Sample Question Paper PDF
Document Details
CO/CM/IF/CW
Tags
Summary
This is a past paper for a Computer Engineering course covering Object-Oriented Programming in C++. The paper includes multiple-choice and programming-based questions. It covers topics like for loops, abstract classes, scope resolution operators, and more.
Full Transcript
Scheme – I Sample Question Paper Program Name : Computer Engineering Program Group Program Code : CO/CM/IF/CW Semester : Third 22316 Course Title : Object Oriented Programming usin...
Scheme – I Sample Question Paper Program Name : Computer Engineering Program Group Program Code : CO/CM/IF/CW Semester : Third 22316 Course Title : Object Oriented Programming using C++ Max. Marks : 70 Time: 3 Hrs. Instructions: (1) All questions are compulsory. (2) Illustrate your answers with sketches wherever necessary. (3) Figures to the right indicate full marks. (4) Assume suitable data if necessary. (5) Preferably, write the answers in sequential order Q.1 Attempt any Five of the following 10 Marks A. Explain with suitable example, syntax of for loop in C++. B. Explain concept of abstract class. C. State the use of scope resolution operator and its use in C++. D. State use of new operator. E. List and explain use of any four file mode parameters F. Explain use of friend function with the help of suitable example. G. Write a C++ program to swap two numbers using pointer Q.2 Attempt any Three of the following 12 Marks A. Write a C++ program that replaces the string “Computer” in the String “Diploma in Computer Engineering” with string “Information Technology”. B. Employee Employee Name, Employee ID Getdata(), Putdata() Salary : Private derived from Employee Basic Pay, HRA, DA, CLA Calculate Salary() Define classes to appropriately represent class hierarchy as shown in above figure. Use constructors for both classes and display Salary for a particular employee. C. Define a class named ‘Train’ representing following members: Data members :- - Train Number 1 - Train Name N - Sourcee - Destination - Journeey Date - Capaciity M Member fun nctions: - Initialiise memberss - Input Train T data - Displayy data Write a C++ proggram to test the train claass. D D. State any a four poiints of differrentiation between b fun nction overlooading and function overrid ding. Q.3 A Attempt an ny Three off the follow wing 122 Marks A. Write a C++ proggram to calcuulate sum of A o distance anda display the results uusing friend d functioon. B. Write a program to B t count no of occurrennce of particcular characcter in text file C C. Answeer followingg : a. Define conncept of virttual base class. b. Give reasonn for assigninng protectedd visibility sp pecifier to a class c memberr. D D. State rules r of operrator overlo oading. Q.4 A Attempt an ny Three off the follow wing 122 Marks A A. An educationnal institutioon wishes too maintain a data of its employees. The A hiierarchical relationship r ps of relatedd classes aree as shown in i figure. Deefine all thee cllasses to reppresent abov ve hierarchyy and definee functions tot retrieve individual i innformation asa and when n required. B B. Write a C++ proggram that diisplays a deecimal numb ber in reverrse order.(Exx. If numbeer 521 , output expected iss 12543) is 345 C C. Write a C++ proggram to add two compleex numbers overloadinng “+”operaator 2 D. Write a program to copy contents of ABC.txt to XYZ.txt E. Write a C++ program to display number of objects created using static member. Q.5 Attempt any Two of the following 12 Marks A. 1. State any four points of differentiation between compile time polymorphism and run time polymorphism B. i) Write a program that will create data file containing the list of telephone numbers as: John 34567 Hari 56788 …… Use a class object to store each set of data. C. Define a class named ‘Bank Account’ to represent following members: Data members :- - Account Number - Name of Depositor - Account Type - Balance Amount Member functions: - Initialize members - Deposit Amount - Withdraw Amount - Display Balance Write a C++ program to test the Bank Account class for 10 customers. Q.6 Attempt any Two of the following 12 Marks A. Give syntax of and explain various functions related to ifstream and ofstream classes: seekp(), getline(),hide(),tail() B. Fix the compilation errors and find the output of following program #include class Test { private: int x; public: Test(int x = 0) { this->x = x; } void change(Test *t) { this = t; } void print() { cout