
Q91
Q91 Pseudocode:
SET x TO 10 SET y TO x MOD 4 PRINT y What does this print?
2
4
10
0
Q92
Q92 Identify the error:
int x = 10;
int y = ++x + 2;
cout << x << " " << y;
Incorrect use of increment operator
No error
Syntax error in cout statement
Misuse of assignment operator
Q93
Q93 Which control flow statement is used for executing a block of code repeatedly based on a condition?
if
else
for
switch
Q94
Q94 What is the function of the break statement in a loop?
To pause the loop
To skip an iteration of the loop
To terminate the loop
To continue to the next iteration of the loop
Q95
Q95 Consider the code:
for(int i = 0; i <= 2; i++) {
cout << i;
}.
What does it print?
012
123
Nothing
Error
Q96
Q96 Pseudocode:
IF x > 10 THEN PRINT "Greater" ELSE PRINT "Smaller or Equal" If x is 8, what is printed?
Greater
Smaller or Equal
Error
Nothing
Q97
Q97 Pseudocode:
FOR i FROM 0 TO 2 DO PRINT i What is the output?
012
123
Error
Nothing
Q98
Q98 Pseudocode:
SET count TO 0 REPEAT PRINT count INCREMENT count UNTIL count EQUALS 5 What is the output?
01234
012345
Infinite loop
Error
Q99
Q99 Spot the mistake:
int num = 0;
do {
cout << num;
} while(num);
Infinite loop
Syntax error
Should use a for loop
No error
Q100
Q100 What is a function prototype in C++?
A function that always returns an integer
The first call to a function in a program
A declaration of a function before its definition
A function without arguments
Q101
Q101 What is function overloading in C++?
Calling a function multiple times
Defining multiple functions with the same name but different parameters
Defining a function inside another function
Using default arguments in a function
Q102
Q102 In C++, what is recursion?
A function calling another function
A function that calls itself
Repeatedly executing a loop
A type of data structure
Q103
Q103 What is the output of this function call?
int add(int x, int y = 5) {
return x + y;
} cout << add(3);
8
3
5
Syntax error
Q104
Q104 Pseudocode:
FUNCTION AddNumbers(x, y) RETURN x + y END What does this function do?
Adds two numbers and prints the result
Subtracts two numbers
Adds two numbers and returns the result
Multiplies two numbers
Q105
Q105 Pseudocode:
FUNCTION PrintMessage() PRINT "Hello" END What is the purpose of this function?
To return the string "Hello"
To print "Hello" to the console
To store the message "Hello"
To check if "Hello" is printed
Q106
Q106 Pseudocode:
FUNCTION FindMax(x, y) IF x > y THEN RETURN x ELSE RETURN y END What does this function return?
The sum of x and y
The smaller of x and y
The larger of x and y
Nothing if x equals y
Q107
Q107 Pseudocode:
FUNCTION CalculateFactorial(n) IF n <= 1 THEN RETURN 1 ELSE RETURN n * CalculateFactorial(n - 1) END What does this function calculate?
The sum of numbers up to n
The factorial of n
The product of n and n-1
The nth number in the Fibonacci sequence
Q108
Q108 Identify the mistake in this code:
void printNum(int number = 5) {
cout << number;
}
printNum(10, 5);
Incorrect number of arguments
No error
Syntax error in function definition
Error in default argument
Q109
Q109 In C++, how can you initialize an array of integers named 'num' with the first four natural numbers?
int num[] = {1, 2, 3, 4};
int num[4] = {1, 2, 3, 4};
int num[4] = {1, 2, 3};
int num[] = {1, 2, 3, 4, 5};
Q110
Q110 Which statement is true about passing an array to a function in C++?
The array is always passed by value
The array is always passed by reference
A copy of the array is created
The size of the array must be known to the function
Q111
Q111 What is the output of this code?
int arr[] = {1, 2, 3};
cout << arr[1];
1
2
3
Error
Q112
Q112 Consider the code:
int matrix[2][3] = {{1, 2, 3}, {4, 5, 6}};
cout << matrix[1][1];
What does it print?
1
2
5
6
Q113
Q113 What is the output of the following code?
char chars[] = {'A', 'B', 'C', '\0'};
cout << chars;
A
AB
ABC
ABCD
Q114
Q114 Pseudocode:
SET matrix[2][2] TO [[1, 2], [3, 4]] PRINT matrix[0][1] What is the output?
1
2
3
4
Q115
Q115 Pseudocode:
SET charArray TO ['H', 'e', 'l', 'l', 'o', '\0'] PRINT charArray What is printed?
H
Hello
ello
Helloworld
Q116
Q116 Identify the error in this code:
int arr[3];
arr[3] = 10;
cout << arr[3];
Out of bounds array access
Syntax error
Type mismatch
No error
Q117
Q117 How do you declare a pointer to an integer in C++?
int *ptr;
int &ptr;
int ptr[];
int ptr;
Q118
Q118 What does the dereference operator (*) do in C++?
It multiplies two values
It returns the address of a pointer
It accesses the value at the address a pointer is pointing to
It creates a pointer
Q119
Q119 What is the output of the following code?
int x = 10;
int *ptr = &x;
cout << *ptr;
10
&x
ptr
*ptr
Q120
Q120 Pseudocode:
SET x TO 20 SET ptr TO ADDRESS OF x PRINT VALUE AT ptr What does this print?
20
ADDRESS OF x
ptr
VALUE AT ptr


