Embercode
✕
C++ Variables and Data TypesQuick quiz

Literals and bases

6 questions. Covers Literals and number bases.

Questions 1 to 5 of 6

  1. 1. What does this program print? ``cpp #include <iostream> int main() { int a = 010; int b = 0x10; std::cout << a + b << '\n'; } ``
  2. 2. What does this program print? ``cpp #include <iostream> int main() { std::cout << std::hex << 0xFF + 1 << ' ' << std::dec << 0xFF + 1 << '\n'; } ``
  3. 3. On 64-bit Linux with g++ 15.2, what type does auto x = 0xFFFFFFFF; get?
  4. 4. What value does int n = 0755; store?
  5. 5. Which two-character prefix makes a C++ integer literal hexadecimal?

    Type your answer.

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.