Bachelors Level/First Year/Second Semester/Science csit/second semester/object oriented programming/syllabus wise questions

B.Sc Computer Science and Information Technology

Institute of Science and Technology, TU

Object Oriented Programming (CSC166)

Year Asked: 2075, syllabus wise question

Classes & Objects
1.
Explain the concept of user-defined to user-defined data concession with the conversion routine located in the destination class. [10]
2.
Write a member function called reverse() 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 character and so on. The string should be passed to reverse() as an argument. [5]
3.
Explain the default action of the copy constructor. Write a suitable program that demonstrates the technique of overloading the copy constructor. [5]
File handling
1.
Briefly explain the hierarchy of stream classes. Write a program that overloads extraction and insertion operators. [10]
2.
How is character I/O different from Binary I/O? Explain with examples. [5]
Function Templates and Exception Handling
1.
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? [5]
2.
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. [5]
3.
Explain how exceptions are used for handling C++ error in a systematic and OOP-oriented way with the design that includes multiple exceptions. [5]
Inheritance
1.
Depict the difference between private and public derivation. Explain derived class constructor with suitable program. [10]
2.
Briefly explain types of inheritance used in object oriented programming. [5]
3.
Create a real scenario where static data members are useful. Explain with suitable program. [5]
Operator Overloading
1.
"An overloaded function appears to perform different activities depending the kind of data send to it." Justify the statement with appropriate example. [5]