ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(int('8' * 3) % 7, int('8' * 3, 16) % 7, pow(10, 3, 7), 888 % 7)- A. 6 6 6 6
- B. 6 0 6 6
- C. 6 0 1 6
- D. 6 0 6 1
Correct answer: B. 6 0 6 6
888 is 7 * 126 + 6, so the remainder is 6. The hex value 0x888 is 2184, which is 7 * 312, so its remainder is 0. 10**3 is 1000, which leaves 6.
More Python Programming questions
- What is printed? python print(0.1 0.1, 0.1 0.1 == 0.01, round(0.1 0.1, 2) == 0.01, 10 0.1 0.1 10 == 1)
- What is printed? python print(len(str(777)), 777 % 1000, str(777)[-3:], int(str(777)[:3]))
- What is printed? python def rpn(tokens): st = [] for t in tokens: if t in ('+', '-', '', '/'): b = st.pop() a = st.pop() if t == '+'…
- What is printed? python def ceildiv(a, b): return -(-a // b) print(ceildiv(7, 2), ceildiv(-7, 2), ceildiv(6, 3), ceildiv(1, 5))
- What is printed? python def atmost(a, k): l = s = c = 0 for r, x in enumerate(a): s += x while s > k: s -= a[l] l += 1 c += r - l + 1…
- What is printed? python from itertools import accumulate a = [3, 1, 4, 1, 5, 9, 2] print(list(accumulate(a, max)), list(accumulate(a…