0% found this document useful (0 votes)
23 views6 pages

IA1 C++ B22EE0503 Question Bank

The document is a question bank for the Object-Oriented Programming course at Reva University for the academic year 2025-2026. It includes various questions covering concepts of C++, such as object-oriented programming, data types, control statements, and function usage, along with sample C++ programs. The document is structured into units with specific marks assigned to each question.

Uploaded by

Bhargavi Km
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

IA1 C++ B22EE0503 Question Bank

The document is a question bank for the Object-Oriented Programming course at Reva University for the academic year 2025-2026. It includes various questions covering concepts of C++, such as object-oriented programming, data types, control statements, and function usage, along with sample C++ programs. The document is structured into units with specific marks assigned to each question.

Uploaded by

Bhargavi Km
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

REVA UNIVERSITY

School of Computer Science and Engineering

Question Bank

Academic year : 2025-2026 [ODD SEMESTER]


Sub name : Object-Oriented Programming Sem & Sec: 5th EEE Sub Code: B22EE0503
in C++
Staff in-charge: Prof. Manasa K N & Prof. Keerthana P

Unit 1

1. Describe the concept of Object Oriented Programming and Explain the features of C++.( 10
Features) 10M
2. Difference between procedural and object oriented programming. 8M
3. Explain Primitive Data Types with example. 7M
4. What is variable? Explain its types. 7M
5. Explain I/O operators in C++ with syntax and example.(insert and extract operator). 8M
6. Explain conditional statements with example.(if, if else, if else if) 8M
7. Explain looping statements with example.(for, while, do while) 8M
8. Explain jump statement with example.(break, continue) 6M
9. With a sample program, explain the use of setw manipulator along with left and right
alignment.7M
10. Explain type conversion and its type with example. 7M
11. Write a C++ program to Create a simple calculator that supports +, -, *, / using switch-case. 6M
#include <iostream>
using namespace std;

int main() {
char op;
double a, b;

cout << "Enter operator (+, -, *, /): ";


cin >> op;
cout << "Enter two numbers: ";
cin >> a >> b;
switch (op) {
case '+': cout << "Result = " << a + b; break;
case '-': cout << "Result = " << a - b; break;
case '*': cout << "Result = " << a * b; break;
case '/':
if (b != 0)
cout << "Result = " << a / b;
else
cout << "Error! Division by zero.";
break;
default: cout << "Invalid operator!";
}
return 0;
}
Output:
Enter operator (+, -, *, /): +
Enter two numbers: 12 8
Result = 20
12. Write a C++ program to display the reminder and quotient. 6M
#include <iostream>
using namespace std;

int main() {
int a, b;
cout << "Enter dividend: ";
cin >> a;
cout << "Enter divisor: ";
cin >> b;

cout << "Quotient = " << a / b << endl;


cout << "Remainder = " << a % b << endl;
return 0;
}
Output:
Enter dividend: 20
Enter divisor: 3
Quotient = 6
Remainder = 2
13. Write a C++ program to accept student name and age and display it. 5M
#include <iostream>
using namespace std;

int main() {
string name;
int age;

cout << "Enter student name: ";


cin>>name;
cout << "Enter age: ";
cin >> age;

cout << "Student Name: " << name << endl;


cout << "Age: " << age << endl;
return 0;
}
Output:
Enter student name: Raam
Enter age: 20
Student Name: Raam
Age: 20

14. Write a C++ program to check if a number is positive/negative/zero integer 6M


#include <iostream>
using namespace std;
int main() {
int num;
cout << "Enter a number: ";
cin >> num;

if (num > 0)
cout << "Positive number";
else if (num < 0)
cout << "Negative number";
else
cout << "Zero";
return 0;
}
Output:
Enter a number: -7
Negative number

15. Write a C++ program to find if a number is Odd/ Even. 6M


#include <iostream>
using namespace std;

int main() {
int num;
cout << "Enter a number: ";
cin >> num;

if (num % 2 == 0)
cout << num << " is Even";
else
cout << num << " is Odd";
return 0;
}
Output:
Enter a number: 11
11 is Odd

16. Write a program to print number 1 to 10 using for while do while. 10M
#include <iostream>
using namespace std;

int main() {
cout << "Using for loop: ";
for (int i = 1; i <= 10; i++)
cout << i << " ";

cout << "\nUsing while loop: ";


int j = 1;
while (j <= 10) {
cout << j << " ";
j++;
}

cout << "\nUsing do-while loop: ";


int k = 1;
do {
cout << k << " ";
k++;
} while (k <= 10);

return 0;
}
Output:
Using for loop: 1 2 3 4 5 6 7 8 9 10
Using while loop: 1 2 3 4 5 6 7 8 9 10
Using do-while loop: 1 2 3 4 5 6 7 8 9 10

Unit 2
1. Briefly explain the use of function with its syntax and example. 7M
2. Explain with its syntax and example the use of function with return by value. 7M
3. Explain with its syntax and example the use of function with Reference arguments. 7M

4. Explain with its syntax and example the use of function with Returning by reference. 7M
5. Explain function overloading in C++ with example. 8M
6. Explain inline function in C++ with example. 8M
7. Briefly explain the use of function with with default arguments. 7M

You might also like