-
What will be the output of the following code?
- A) a, b, c
- B) a, b, c, d
- C) c, d, e ✓
- D) c, d, e, f
-
Which of the following is a valid way to declare a dictionary in Python?
- A) {1: "one", 2: "two", 3: "three"} ✓
- B) [1: "one", 2: "two", 3: "three"]
- C) (1: "one", 2: "two", 3: "three")
- D) <1: "one", 2: "two", 3: "three>
-
Which of the following method is correct to add an element at a specific position?
- A) insert() ✓
- B) add()
- C) append()
- D) index()
-
What is the correct syntax to add an item to the end of a list in Python?
- A) list.add(item)
- B) list.append(item) ✓
- C) list.insert(item)
- D) list.extend(item)
-
Which of the following is not a valid data type in Python?
- A) integer
- B) string
- C) float
- D) character ✓
-
What is the output of the following code?
for i in range(1, 21):
if i % 3 == 0 and i % 5 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)
- A) Prints numbers from 1 to 20
- B) Prints Fizz for multiples of 3 and Buzz for multiples of 5 ✓
- C) Prints FizzBuzz for multiples of 3 and 5
- D) None of the above
- What is the output of the following code?
a = 5
b = 2
print(a // b)
- A) 2 ✓
- B) 2.5
- C) 3
- D) 2.0
-
What is the output of the following code?
- A) "hello"
- B) "olleh" ✓
- C) "hlo"
- D) "leh"
-
What is the output of the following code?
- A) 2
- B) 5
- C) 0 ✓
- D) 1
-
What is the output of the following code?
- A) "pyt"
- B) "yth" ✓
- C) "tho"
- D) "hon"