Skip to content
Quiz · Operators and Expressions · lesson 6 of 8

Quiz — operator precedence

What does the program print?

C++
#include <iostream>

int main() {
    int n = 2;
    int a = 1 << n + 1;
    int b = n > 1 ? 10 : 20 + 1;
    std::cout << a << ' ' << b << '\n';
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way