Tribhuvan University
Bachelor of Science in Computer Science and Information Technology
Semester 2 · TU Board 2075
Course Title: Object Oriented Programming (CSC166)
Full Marks: 60Pass Marks: 24Time: 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
(2 × 10 = 20)
- 1.10
Explain the concept of user-defined to user-defined data conversion routine located in the destination class.
- 2.10
Depict the difference between private and public derivation. Explain derived class constructor with suitable program.
- 3.10
Briefly explain the hierarchy of stream classes. Write a program that overloads extraction and insertion operators.
Group B
(8 × 5 = 40)
- 4.5
Write a member function called reverseit() that reverses a string ( an array of character). Use a for loop that swaps the first and last characters, then the second and next-to last characters and so on. The string should be passed to reverseit() as an argument.
- 5.5
What is the principle reason for using default arguments in the function? Explain how missing arguments and default arguments are handled by the function simultaneously?
- 6.5
"An overloaded function appears to perform different activities depending the kind of data send to it" Justify the statement with appropriate example.
- 7.5
Explain the default action of the copy constructor. Write a suitable program that demonstrates the technique of overloading the copy constructor.
- 8.5
Briefly explain types of inheritance used in object oriented Programming.
Answer comingAlso asked in 2082, 2081, 2080, 2079, 2076
- 9.5
Create a real scenario where static data members are useful. Explain with suitable example.
- 10.5
Create a function called swaps() that interchanges the values of the two arguments sent to it (pass these arguments by reference). Make the function into a template, so it can be used with all numerical data types (char, int, float, and so on). Write a main() program to exercise the function with several types.
- 11.5
Explain how exceptions are used for handling C++ error in a systematic and OOP-oriented way with the design that includes multiple exceptions.
- 12.5
How is character I/O different from Binary I/O? Explain with examples.
— The End —