You are on page 1of 1

7/13/2020 Introduction to Object Oriented Programming Concepts | Happy Compiler

2. What are the elements of object oriented programming?


Objects, Classes, Data Abstraction, Inheritance, Polymorphism, Encapsulation.
3. List the features of object oriented programming.
This approach is useful in solving complex problems.
OOP stresses on data.
4. In what ways object oriented programming is different from procedure oriented
programming language?
OOP emphasizes on data whereas POP emphasizes on functions.
5. Name any two object oriented programming principles.
Encapsulation, Polymorphism.
6. Name any two object oriented programming and procedure oriented programming
languages.
Java and Python are OOP languages.
BASIC and C are POP languages.
7. Which OOP principle implements function overloading?
Polymorphism.
8. Define the following terms:
a) Encapsulation with an example.
Wrapping up of data and functions in a class so that they can be used as a single unit is
called encapsulation. For example, keeping both data and functions within a class such that
only the member functions can access the data within the class.
b) Data Abstraction with an example.
It is the act of representing essential features without knowing the background details. For
example, the private data members in a class are hidden from unintentional changes.
9. Explain inheritance with a suitable example.
Inheritance is an OOP principle by which a class acquires some features from another class.
It helps in reusing of code. For example, an SUV is a car that inherits all the features of a
general car, and also adds some unique properties and features to itself.
10. What is meant by polymorphism? Explain with an example.
It is the process of using a function for more than one purpose. For example, Math.abs()
implements polymorphism because it works with both integers and floating-point numbers.

Exercise Questions

W RIT E T RUE O R FA LS E :

1. Java application is a Java program which is developed by users. (FALSE)


2. James Gosling developed Java programming language. (TRUE)
3. Machine codes are expressed using alphanumeric characters. (FALSE)
4. Bytecode is the program in binary form. (TRUE)
5. JVM is Java Visual Management. (FALSE)

F I LL IN THE B LA NK S :

1. Java is a case-sensitive language.


2. In Java, the package used to find power raised to any base is java.lang.
3. The words which are preserved with the system are called reserved words, that cannot be
used as variable names in Java programming.

https://www.happycompiler.com/oop/ 2/11

You might also like