ProgrammingModerateProduct-company MCQ pattern
What is printed?
What is printed?
print("abc" < "abd" < "ab", "10" < "9", 10 < 9)- A. True False True
- B. False True False
- C. False False False
- D. True True False
Correct answer: B. False True False
"abc" < "abd" is True, but the chain also needs "abd" < "ab", and that is False because a prefix is smaller than the longer string. Strings compare character by character, so "10" < "9" ('1' < '9') is True, while the numbers give 10 < 9, which is False.
More Python Programming questions
- What is printed? python print({x % 3: x for x in range(7)})
- What is printed? python print([(i, j) for i in range(3) for j in range(i)])
- What is printed? python def g(): x = yield 1 yield x 2 it = g() print(next(it), it.send(5))
- What is printed? python calls = 0 def f(n): global calls calls += 1 return 1 if n <= 1 else f(n - 1) + f(n - 2) print(f(5), calls)
- What is printed? python import copy a = [[1, 2], [3]] b = copy.copy(a) c = copy.deepcopy(a) a[0].append(9) a.append([4]) print(len(b)…
- What is printed? python x = [1] 3 for i in range(3): x[i] = x[i - 1] + i print(x)