Embercode
✕
C++ Variables and Data TypesQuick quiz

Cumulative check

6 questions. Covers Naming and reading declarations.

Questions 1 to 5 of 6

  1. 1. A program divides two int values. The divisor is 0, but it comes from user input, so the compiler cannot see it. What happens?
  2. 2. Which test correctly checks whether the double named avg holds NaN?
  3. 3. What does this program print? ``cpp #include <iostream> int main() { char c = 'a' + 2; std::cout << c << ' ' << 'z' - 'a' << '\n'; } ``
  4. 4. What does this program print? ``cpp #include <iostream> int main() { int a = 010; int b = 0x10; std::cout << a << ' ' << b << '\n'; } ``
  5. 5. What is the bug in this program? ``cpp #include <iostream> #include <vector> int main() { std::vector<int> values = {3, 8, 12, 5}; int big; for (int v : values) { if (v > 4) { ++big; } } std::cout << big << '\n'; } ``

5 question(s) left on this page.