Oops Assignment
Oops Assignment
1. (a) How do classes and objects function within the object-oriented programming
paradigm, and what is their interconnection?
(b) Define constants and provide the syntax for declaring them in C++.
(e) What is the importance of the main() function in C++? Provide an example to illustrate its
significance.
2. (a) Write a C++ program that includes a function to calculate both the circumference and
area of a rectangle and circle. Then, invoke this function from the main() function of the
program.
(b) Develop a C++ program to determine the second smallest and second largest and element
within an array.
3. Compare the usage and characteristics of for, while, and do-while loops in C++.
Additionally, create a program utilizing a while loop to calculate and print the sum of all odd
numbers from 1 to 50.
4. (a) Develop a C++ program that utilizes recursion to calculate the factorial of a given
number.
(b) Describe the difference between local and global variables in C++.
#include
void main()
{ int i = 0;
j = j + 1;
5. (a) Describe the significance of loop control statements like break and continue in C++
loops. Furthermore, outline a C++ program showcasing various logical and bitwise operators
and their implementation.
(b) Develop a C++ program that converts each letter in a provided string to the succeeding letter
in the alphabet. For example, 'b' becomes 'c', 'c' becomes’d’, and 'z' becomes 'a'.
(b) Enumerate the methods through which object-oriented programming is employed to address
real-world problems.
7. (a) Compare and contrast a string with a character array in C++. Additionally, elucidate
all built-in string functions provided in C++.
(b) Develop a C++ program containing a function named sum_Of_Digits, which accepts an
integer as input and returns the sum of its digits. Prompt the user to input an integer and display
the sum of its digits utilizing the sum_Of_Digits function.
9. What defines a function? What types of functions exist in C++? Clarify with a relevant
example.
10. Describe the categorization of operators in C++, and present a C++ program utilizing a
while loop to generate the Fibonacci series up to n terms.