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

Bachelors In Information Technology

Institute of Science and Technology, TU

Object Oriented Programming (BIT153)

Year Asked: 2082, syllabus wise question

Basics of C++ programming
1.
Explain default arguments and inline functions in C++ with suitable examples. [5]
Class and Objects
1.
Write a program to create a class Student with data members id, name, and marks. Define constructors to initialize data members and demonstrate constructor overloading. Implement member functions to read students details, display them and calculate average marks. [10]
2.
What is the use of this pointer? Write a program to demonstrate it. [5]
3.
Explain friend function and friend class with example. [5]
File and Streams
1.
Write a C++ program to read a text file named data.txt and display its contents on the screen. Also, count the number of lines, words, and characters in the file and display these counts after showing the file content. [5]
Function Templates and Exception Handling
1.
What are function templates? Also, write a program that swaps two values using function templates. [1+4]
2.
Write a program to handle division by zero exception using try, catch, and throw. [5]
Inheritance
1.
Explain inheritance with suitable example. Differentiate between single, multiple, and hybrid inheritance. Write a program to show constructor invocation order in multilevel inheritance. [1+4+5]
2.
Explain ambiguity problem in multiple inheritance with example. How is it resolved using virtual base class? [5]
Operator Overloading
1.
Explain operator overloading with example? Write a C++ class Number to store an integer. Overload addition (+) and comparison (==) operators, and show conversion between int and Number. Write a program to perform these operations. [2+8]
Virtual Function, Polymorphism, and other C++ Features
1.
Differentiate between early binding and late binding. Write a program to show dynamic polymorphism using virtual function. [2+3]
2.
What is the difference between abstract class and concrete class? Explain with example. [5]