Chapter - 1: Intro to OOP

Answer the following:


C
Sections
1
Exercises

A

B

C

D

1

(a)What is the basic difference between structured programming model and the object-oriented programming model?
Ans: 
-> Code reusability is limited in Structured programming while it is very flexible in OOP. 
-> We can create user-defined data types like built-in types in OOP which is not in structured programming.
-> Polymorphism, inheritance, and many other features are in OOP but not in structured programming.

(b) What is the difference between a class and an object?
Ans: Class is a user-defined data-type whether the object is its an instance or its variable.

(c) Give at least 5 examples of classes and objects.
Ans:
-> Hp laptops are classes, and HP 15s-105t model is its object.
-> Maruti cars are classes, and Maruti 800 is its object.
-> Browser is a class, and Chrome, Safari is its object.
-> Student is a class, and Siraj (name) is its object.
-> Language is a class, C, Pascal, C++, Java are objects.

(d) What do you mean by encapsulation?
Ans: Encapsulation stands for binding up functions and data within a single unit called class.

(e) What do you mean by inheritance?
Ans: Inheritance means inheriting the properties from one class (base) to another class (derived) without rewriting codes.

(f) What do you mean by polymorphism?
Ans: Polymorphism stands for one face with different forms. That is one function or performs operator perform different tasks on different types of inputs.


© 2020 Garbage Valuegarbage value logo