Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively
The % operator returns the remainder, 7 % 2 = 1.
The for keyword starts a loop, e.g., for i in range(3).
The if keyword begins a conditional block, e.g., if x > 0.
If 10 > 5 is True, ‘Yes’ is printed as the condition is met.
The break keyword exits a loop prematurely, e.g., in a for loop.
The or keyword represents the logical OR operation, e.g., True or False is True.
The & operator performs a bitwise AND, 5 & 3 = 1 (binary 101 & 011 = 001).
The << operator shifts bits left, e.g., 2 << 1 = 4.
10 > 5 is True, so the or condition with 3 < 1 (False) is True.
The ~ operator inverts all bits, e.g., ~5 = -6 in two’s complement.