What is the value of 'i' after the following loop completes?
int i; for (i = 0; i < 5; i++) { // Loop body }
Undefined behavior
4
6
5
Which operator is used to combine two strings in C++?
/
Which of the following is NOT a valid C++ function definition?
double calculateArea(double radius) { return 3.14 * radius * radius; }
void printMessage();
string greet(string name) { cout << "Hello, " << name << "!" << endl; }
int sum(int a, int b) { return a + b; }
How do you declare a variable named 'age' of integer type?
age as int;
int age;
declare age as integer;
variable age: int;
Which loop is most suitable when you know the number of iterations in advance?
while loop
for loop
It depends on the specific situation.
do-while loop
What is the output of the following code snippet?
int arr[] = {10, 20, 30}; int *ptr = arr; cout << *(ptr + 2);
30
20
10
Invalid memory access
What is the correct way to declare an integer array named 'numbers' with a size of 5 in C++?
array numbers[5];
int numbers(5);
numbers[5] as int;
int numbers[5];
int i = 10; do { cout << i << " "; i--; } while (i > 10);
The loop will run infinitely
9 8 7 6 5 4 3 2 1 0
10 9 8 7 6 5 4 3 2 1
Which of the following is NOT a type of inheritance in C++?
Multiple inheritance
Multilevel inheritance
Distributed inheritance
Single inheritance
If 'ptr' points to the first element of an array, what does 'ptr + 1' point to?
The address of the array itself
The size of the array
The previous element in the array
The next element in the array