ProgrammingHardProduct-company placement · C++

What is printed?

What is printed?
void f() noexcept { }
void g()          { }
int main() { cout << noexcept(f()) << noexcept(g()); }
  1. A. 10
  2. B. 11
  3. C. 00
  4. D. 01

Correct answer: A. 10

The noexcept operator is evaluated at compile time from the declarations: f is declared noexcept, g is not (even though its body cannot throw).

More OOP with C++ and Java questions

Exams that ask this topic