2. What will be the output of the following program?

#include <iostream>
int main() {
    int count = 0;
    for (int i = 0; i < 10; i++) {
        if (i % 3 == 0)
            continue;
        if (i % 5 == 0)
            break;
        count++;
    }
    std::cout << count << std::endl;
    return 0;
}

A. 0
B. 7
C. 6
D. 4

Answer . D. 4

Tag . 6 Fundamentals of Programming (C++)

4. In C++, which keyword is used to perform dynamic memory allocation?

A. new
B. allocate
C. malloc
D. alloc

Answer . A. new

Tag . 6 Fundamentals of Programming (C++)

9. Which of the following is a correct identifier in C++?

A. VAR1234
B. $var_name
C. 7var_name
D. 7VARNAME

Answer . A. VAR1234

Tag . 6 Fundamentals of Programming (C++)

11. What is the return type of a function that doesn't return any value?

A. int
B. float
C. bool
D. void

Answer . D. void

Tag . 6 Fundamentals of Programming (C++)

28. What is recursion in the context of functions in C++?

A. A function that has a large number of parameters.
B. A function that calls itself directly or indirectly.
C. A function that uses static variables.
D. A function that returns a Boolean value.

Answer . B. A function that calls itself directly or indirectly.