Explain in detail the following principles of Object-Oriented Programming.
Data encapsulation and data hiding.
Inheritance and polymorphism.
Abstraction
Why constructor and destructor are required on Object Oriented Programming? Explain with suitable example.
Define a student class (with necessary constructors and member functions) in Object Oriented Programming (abstract necessary attributes and their types). (Write a complete code in C++ programming language).
Derive a computer Science and Mathematics class from student class adding necessary attributes (at least three subjects).
Use these classes in a main function and display the average marks of computer science and mathematics students.
Short Questions
Attempt any eight questions: (8 × 5=40)
What is type casting? Explain with suitable example.
Write a program to compute subtraction of two complex numbers using operator overloading.
Why exception handling is required? Explain with suitable example.
Differentiate between super class and sub class with suitable examples.
Write a program in C++ to count a number of words in a line of text.
Differentiate between function overriding and function overloading. Explain with suitable example.
Explain the role of polymorphism in Object Oriented Programming.
Explain the different types of class access specifiers.
Write a program to find the cube of given integer using inline function.
Write a program to convert centigrade into Fahrenheit temperature.