If 'func' is a function that takes an integer and returns void, how would you call this function using a pointer 'ptr' to the function?
func(ptr, 5);
*ptr(5);
ptr(5);
&ptr(5);
What is the value of 'i' after the following loop completes?
int i; for (i = 0; i < 5; i++) { // Loop body }
5
4
6
Undefined behavior
What is the output of the following code snippet: cout << (5 > 3 && 10 < 20);?
cout << (5 > 3 && 10 < 20);
1
3
0
What is a function signature in C++?
The comments and documentation associated with a function.
The function's body (the code within the curly braces).
The value returned by the function.
The function's name and the data types of its parameters.
What does the 'protected' access specifier in C++ control?
Accessibility within the same class only
Accessibility within the same class and derived classes
Accessibility only within the same file
Accessibility from anywhere in the program
Which statement is used to skip the rest of the current iteration in a loop and jump to the next iteration?
break
skip
continue
goto
What is the correct way to receive user input in C++ and store it in a variable named 'name'?
cin >> name;
input name;
cout << name;
scanf name;
What is the output of the following C++ code snippet?
#include <iostream> int main() { int x = 5; int y = 10; int result = (x, y); std::cout << result; return 0; }
Compilation Error
10
15
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];
int numbers(5);
numbers[5] as int;
Which of the following is NOT a type of inheritance in C++?
Multiple inheritance
Distributed inheritance
Multilevel inheritance
Single inheritance