ProgrammingModerateGATE CS · Product-company placement
What is printed?
What is printed?
print("10" + "5", int("10") + 5, "10" * 2, str(10) * 2 == "1010", "5" < "10")- A. 105 15 1010 True False
- B. 15 15 20 True True
- C. 105 15 20 True False
- D. 105 15 1010 True True
Correct answer: A. 105 15 1010 True False
+ concatenates strings and * repeats them. String comparison is lexicographic by character: '5' > '1', so '5' < '10' is False.
More Python Programming questions
- What is printed? python a = "hello" try: a[0] = "j" except TypeError: a = "j" + a[1:] b = a.replace("l", "X", 1) print(a, b…
- What is printed? python print(1000 == 1000, 0.1 + 0.7, 7 / 2 == 7 // 2 + 0.5, 2 0.5 2, (-8) (1 / 3) == -2)
- What is printed? python s = "racecar" print(s.index("c"), s.rindex("c"), s.find("c", 3), s[::-1] is s, s.count("a", 2))
- What is printed? python import sys print(type(10 20).name, 10 20 // 3 % 10, len(str(2 100)), (2 64) - 1 == 0xFFFFFFFFFFFFFFFF)
- What is printed? python x = [1, 2, 3] print(x 2, [x] 2 == [[1, 2, 3], [1, 2, 3]], x + [4] is x, [] == False, not [])
- What is printed? python t = 1, 2, u = (3) v = () w = (4,) 0 print(type(t).name, len(t), type(u).name, v == w, (1, 2) < (1, 2, -1))