Tribhuvan University
Institute of Science and Technology
2081
Bachelor Level / second-semester / Science
Computer Science and Information Technology( CSC166 )
Object-Oriented Programming
Full Marks: 60 + 20 + 20
Pass Marks: 24 + 8 + 8
Time: 3 Hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
Group A
Attempt any TWO questions.
What types of exception can be encountered in file handling? Write a program to create a class named MOVIE with data members name and genre. If the genre of the movie is comedy then write it to COMEDY.DAT and if the genre is action, write it to ACTION.DAT
Discuss the chain of constructor and destructor in derived class. Write a program to define a class named Employee with data members name, age and gender. Then create another class named EmployeeSalary inherited from Employee. In this class, the user should give the monthly salary of the employee and calculate the yearly salary after 15% tax deduction. In the main function, you should get the employee’s basic information and salary using inheritance.
When do we use static member functions? Explain the types of constructors with an example.
Group B
Attempt any EIGHT questions.
Write a function template that returns the greater number between two integers.
Describe the characteristics of object oriented programming approach.
List the five types of storage classes with their keyword, lifetime, and visibility.
Write a program to create a class PERSON with data members name and age. Overload the greater than (>) symbol, to display the name of elder one.
Define virtual base class. Differentiate between function overloading and function overriding.
What types of instructions are written in try block? Illustrate the use of friend function with an example.
Create a class BOOK with data members name and price. Write a member function that will take two objects of BOOK class and return the object with lower price.
Design a class TIME with hour and minutes. Write a program to convert integer type to TIME class type.
Illustrate the advantage of return by reference with an example.