Object Oriented Programming using C++
ASSIGNMENT-1
Submission Date: 6th Oct 2022
Q.1. Define the following terms related to OOP.
a) Encapsulation b) Data abstraction c) Inheritance d) Polymorphism
e) Message passing f) Extendibility g) Delegation h) Containership
i) Abstract data type j) Enumerated data type k) Classes l) Object
m) New & Delete operator n) Static variable o) Constant variable p)Type conversion
q) Abstract Classes
Q.2 Difference between C/C++? Difference between programming & object-oriented
programming.
Q.3 Discuss the merits & demerits of object-oriented methodology.
Q.4 Write an object representation of student class.
Q.5 In C/C++ why the main function popularly called as driver function.
Q.6 Explain the need for type conversion with suitable example. Write type conversion
step for following statement (z=i+b+j-k/4)
Where i &j are integers, b is float, k is double, z is long.
Q.7 Compare the c input/output statements with C++ input/output stream.
Q.8 What is the difference between reference variables and normal variables? Why a
constant value can’t be initialized to variables of reference type.
Q.9 Justify the need of scope resolution operator for excessing global variables.
Q.10 What are the different types of access specifier supported by C++?
Q.11 What are the difference between static binding and late binding? Explain dynamic
binding with suitable examples.
Q.12 Date consist of DD-MM-YY. Can this item be modeled as a class? Write a program to
display the date and the time on the console screen.
Q.13 What is the effect of following expression? Justify your answers: -
If i=1 and j=4
i) (i++) + (++i) ii) j = j++ iii) j = ++j iv) i+++j v) i+++j++
Q.14 What is operator precedence? Explain the precedence of all the operators of
C++. Arrange the following operator in the order of precedence.
-, +, *, (), ^, !, ++, --, |, &, &&, >>, <<, >
Q.15 Discuss the need of control flow statement in C++ and also write which statement is
better.
Q.16 State which of the following statement is True/False.
i) Use of goto helps in developing structured program.
ii) The value -1 is treated as false.
iii) The switch statement can have more than one matching case.
iv) The use of an expression such as a=b as a test expression is not encouraged in any
control statement.
Q.17 What is the difference between call by value, call by pointer and call by reference.
Explain with example.
Q.18 What are the advantages of function prototyping in C++?
Q.19 What is the significance of the associativity of operators? What is the order of evaluation
of the operator?: in the statement A = I > J ? I : J ;
Q.20 Write the difference between constructor and destructor with example.
ASSIGNMENT-2
Submission Date: 13th Oct 2022 Marks: 5
Q1. Examine this program and anticipate the output:
#include<iostream.h>
void main ()
{
int a=1,b=1,c;
if(c=(a-b))
cout<<”the value of c is:”<<c;
}
Q2. Write a program to add two integer variables and multiple the sum with 13.
Q3. What is the difference between x = 3 and x == 3?
Q4. Demonstrate the difference between break and continue with examples.
Q5. What is the value of x when loop completes?
for(int x=0; x<100 ; x=x+2);
Q6. What is dot and scope resolution operator? Write the use of these operators with examples.
Q7. Design a program for a library book checkout system that shows the date a book is due
and late charges for an overdue book as derived objects.
Q8. What is the difference between public, private and protected? Explain in tabular form.
Q9. How many elements are in the array SomeArray[10][5][20]?
Q10. How do you invoke a base member function from derived class in which you have not
overridden that function?
Q11. When you overload member functions, in what ways must they differ?
Q12.What is this pointer? Explain the use with example.
Q13. How does copy constructor differ from the assignment operator (=)?
Q14. Explain the use of virtual function and friend function with example.
Q15. Write a program to write and read the data of employee in text file.
Q16. What is stream, fstream and ofstream? State the difference between these three.
Q17. What are the steps to provide in exception handling in C++ program? Explain with
example.
Q18. Write a template to find the largest number in two numbers of any type.
Q19. What do you understand by #define, #undefine, #if and #endif?
Q20. Explain the types of inheritance with example? Show the declaration of a class Square,
which derives from class Rectangle, which in turn derives from class shape. State which type
of inheritance is this?