The word object-oriented is the combination of two words i.e. object and oriented. The dictionary meaning of the object is an article or entity that exists in the real world. The meaning of oriented is interested in a particular kind of thing or entity. In layman's terms, it is a programming pattern that rounds around an object or entity are called object-oriented programming.
2. DEFINITION OF OBJECT ORIENTED PROGRAMMING
Object-Oriented Programming or OOPs refers to
languages that use objects in programming. Object-
oriented programming aims to implement real-world
entities like inheritance, hiding, polymorphism, etc
in programming. The main aim of OOP is to bind
together the data and the functions that operate on
them so that no other part of the code can access
this data except that function.
2
3. WHAT ARE THE CONCEPTS OF OOP
Class
Objects
Data Abstraction
Encapsulation
Inheritance
Polymorphism
Dynamic Binding
Message Passing
Main Features of OOP
3
6. DESCRIBE DIFFERENT KINDS OF LOOP WITH EXAMPLE
Loops in programming are used to repeat a block of
code until the specified condition is met. A loop
statement allows programmers to execute a
statement or group of statements multiple times
without repetition of code.
6
7. For Loop
for loop in C programming is a repetition control
structure that allows programmers to write a loop
that will be executed a specific number of times.
for loop enables programmers to perform n
number of steps together in a single line.
Syntax:
for (initialize expression; test expression; increment)
{
// // body of for loop // ;
}
7
8. While Loop
While loop does not depend upon the number of
iterations. In for loop the number of iterations was
previously known to us but in the While loop, the
execution is terminated on the basis of the test
condition. If the test condition will become false then it
will break from the while loop else body will be
executed.
Syntax:
initialization_expression;
while (test_expression)
{
// body of the while loop update_expression;
}
8
9. do-while Loop
The do-while loop is similar to a while loop but the only difference lies in the do-
while loop test condition which is tested at the end of the body. In the do-while
loop, the loop body will execute at least once irrespective of the test condition.
Syntax:
initialization_expression;
do {
// body of do-while loop update_expression;
} while (test_expression);
9
10. ILLUSTRATE RECURSION IN STRUCTURE PROGRAMMING
Recursion is the technique of making a function call itself. This
technique provides a way to break complicated problems
down into simple problems which are easier to solve.
10
14. FIND ERROR AND SOLVE IT IN C++
Problem:
#include <Iostream>
int main()
{
int a=2;
if(A>1)
Cout<<"a is greater than 1")
return 0;
}
Solution:
#include <iostream>
int main()
{
int a=2;
if(a>1)
cout<<("a is greater than 1");
return 0;
}
14
15. EXPLAIN THE OUTPUT OF THIS C++ PROGRAM:
#include <iostream>
using namespace std;
int main() {
for (int i = 0; i < 10; i++)
{
if (i == 4) {
continue;
}
cout << i << "n";
}
return 0;
} 15
16. WRITE THE OUTPUT OF THIS FOLLOWING CODE
#include<iostream>
using namespace std;
void main()
{
int y=10;
if(y++>9 && y++!=10 && y++>11)
cout<<y<<endl;
else
cout<<y<< endl;
}
16