TRIBHUVAN UNIVERSITY
INSTITUTE OF SCIENCE AND TECHNOLOGY
2081 B.S.
Candidates are required to give their answers in their own words as far as practicable.
Group A
Long Answer QuestionsAttempt any Two questions.
- 1What 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 movie is comedy then write it to COMEDY.DAT and if the genre is action, write it to ACTION.DAT.
- 2Discuss 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.
- 3When do we use static member functions? Explain the types of constructors with an example.
Group B
Short Answer QuestionsAttempt any Eight questions.
- 4Write a function template that returns the greater number between two integers.
- 5Describe the characteristics of object oriented programming approach.
- 6List the five types of storage classes with their keyword, lifetime, and visibility.
- 7Write 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.
- 8Define virtual base class. Differentiate between function overloading and function overriding.
- 9What types of instructions are written in try block? Illustrate the use of friend function with an example.
- 10Create 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.
- 11Design a class TIME with hour and minutes. Write a program to convert integer type to TIME class type.
- 12Illustrate the advantage of return by reference with an example.