Laboratory Manual – Object Oriented Programming (OOPL)

Compulsory assignment : Install, Configure 64 bit Linux Operating Systems, study basic architecture, memory system, and learn basic administration.

Reference questions for Oral Exam

 

  1. Write a C++ program to create a calculator for an arithmetic operator (+, -, *, /). The program should take two operands from user and performs the operation on those two operands depending upon the operator entered by user. Use a switch statement to select the operation. Finally, display the result.
  2. Develop an object oriented program in C++ to create a database of student information system containing the following information: Name, Roll number, Class, division, Date of Birth, Blood group, Contact address, telephone number, driving license no. etc Construct the database with suitable member functions for initializing and destroying the data viz constructor, default constructor, Copy constructor, destructor, static member functions, class, this pointer, inline code and dynamic memory allocation operators-new and delete.
  3. Implement a class Quadratic that represents degree two polynomials i.e., polynomials of type ax2+bx+c. The class will require three data members corresponding to a, b and c. Implement the following operations: A constructor (including a default constructor which creates the 0 polynomial)., Overloaded operator+ to add two polynomials of degree 2, Overloaded << and >> to print and read polynomials. To do this, you will need to decide what you want your input and output format to look like, A function eval that computes the value of a polynomial for a given value of x, A function that computes the two solutions of the equation ax2+bx+c=0.
  4. Imagine a publishing company which does marketing for book and audiocassette versions. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int), and tape, which adds a playing time in minutes (type float). Write a program that instantiates the book and tape classes, allows user to enter data and displays the data members. If an exception is caught, replace all the data member values with zero values.
  5. Create User defined exception to check the following conditions and throw the exception if the criterion does not meet. a. User has age between 18 and 55  b. User stays has income between Rs. 50,000 – Rs. 1,00,000 per month  c. User stays in Pune/ Mumbai/ Bangalore / Chennai  d. User has 4-wheeler. Accept age, Income, City, Vehicle from the user and check for the conditions mentioned above. If any of the condition not met then throw the exception
  6. Write a C++ program that creates an output file, writes information to it, closes the file and open it again as an input file and read the information from the file.
  7. Write a C++ program using command line arguments to search for a word in a file and replace it with the specified word. The usage of the program is shown below.
  8. Write a function in C++ to count and display the number of lines not starting with alphabet ‘A’ present in a text file “STORY.TXT”. Example: If the file “STORY.TXT” contains the following lines, The roses are red. A girl is playing there. There is a playground. An aeroplane is in the sky. Numbers are not allowed in the password. The function should display the output as 3.
  9. Write a function template selection Sort. Write a program that inputs, sorts and outputs an integer array and a float array.
  10. Implement a class Complex which represents the Complex Number data type. Implement the following operations: 1. Constructor (including a default constructor which creates the complex number 0+0i). 2. Overloaded operator+ to add two complex numbers. 3. Overloaded operator* to multiply two complex numbers. 4. Overloaded << and >> to print and read Complex Numbers
  11. Create Student\Employee bio-data using following classes i) Personal record ii))Professional record iii) Academic record Assume appropriate data members and member function to accept required data & print bio-data. Create bio-data using multiple inheritance using C++.
  12. Create a class Rational Number (fractions) with the following capabilities: a) Create a constructor that prevents a 0 denominator in a fraction, reduces or simplifies fractions that are not in reduced form and avoids negative denominators. b) Overload the addition, subtraction, multiplication and division operators for this class. c) Overload the relational and equality operators for this class.
  13. Create a class template to represent a generic vector. Include following member functions: a) To create the vector. b) To modify the value of a given element c) To multiply by a scalar value d) To display the vector in the form (10,20,30,…)
  14. Write a menu driven program that will create a data file containing the list of telephone numbers in the following form John 23456 Ahmed 9876 ……….. ……… Use a class object to store each set of data, access the file created and implement the following tasks I. Determine the telephone number of specified person II. Determine the name if telephone number is known III. Update the telephone number, whenever there is a change.
  15. Write C++ program using STL for Dqueue (Double ended queue)
  16. Write C++ program using STL for implementation of stack & queue
  17. Write C++ program using STL to add binary numbers (assume one bit as one number); use STL stack.
  18. You are the owner of a hardware store and need to keep an inventory that can tell you what different tools you have, how many of each you have on hand and the cost of each one. Write a program that initializes the random-access file hardware.dat to 100 empty records, lets you input the data concerning each tool, enables you to list all your tools, lets you delete a record for a tool that you no longer have and lets you update any information in the file. The tool identification number should be the record number. Use the following information to start your file:
Record # Tool name Quantity Cost
3 Electric sander 7 57.98
17 Hammer 76 11.99
24 Jig saw 21 11.00
39 Lawn mower 3 79.50
56 Power saw 18 99.99