Define OOP. List the OOP concepts.

Estudies4you
Q3. Define OOP. List the OOP concepts.
Answer : 

OOP
Object oriented programming is a technique that builds the program using the objects along with a set of well defined interfaces to that object. It describes the way in which elements within a computer program must be organized and the way in which elements can interact with each other. Object oriented programming uses bottom-up approach and also manages the increasing complexity.

Concepts of OOP: 
The various concepts of OOP are as follows,
(a) Objects
(b) Classes
(c) Data abstraction
(d) Encapsulation
(e) Inheritance
(f) Polymorphism.


Q4. Define operator. List different types of operator in C++.
Answer :

Operator:
An operator is .a single or double symbol that gives instruction to the compiler or interpreter to perform certain operations on its associated data items called operands (such as constants, variables, array elements and function references).

Types of Operators
C++ support different types of operators as discussed below,
  1. Arithmetic operators
  2. Relational operators
  3. Logical operators
  4. Assignment operators
  5. Increment and decrement operators
  6. Conditional operators
  7. Bitwise operators
  8. Special operators.

Q5. Define type conversion.
Answer : 

Type Conversion
Type conversion refers to the process of converting the data of one type into another type. For example, consider two integer variables namely x = 4 and y= 7. When a division operation is performed on them the result would be 0.57 which is a floating point number. Since x and y are declared as integers, the C++ compiler considers their result(x/y) also as integer by discarding the decimal value eventually. Hence, proper type conversion is necessary to ensure accurate results. There are certain basic rules that are to be followed while type conversion.

Basically, there are two types of type conversion supported in C++.
(i) Implicit conversion
(ii) Explicit conversion.

(i) Implicit Type Conversion
In a binary expression, if two operands have different data types then the conversion of one type into another is implicitly done by the compiler. This conversion is referred as implicit type conversion.

(ii) Explicit Type Conversion
The process in which data of one type is explicitly converted to another type is known as explicit type conversion. This conversion is also known as casting. It uses an operator called the unary cast operator. The casting is basically done by defining a new data type enclosed in parenthesis before the value that needs to be converted.

To Top