Page 44 - ipp11
P. 44
8. Which of the following is the correct way to define a dictionary in Python? [1]
(a) {1, 2, 3} (b) [1, 2, 3] (c) (1, 2, 3) (d) <1, 2, 3>
Ans. (a) {1, 2, 3}
9. What will be the result of the following Python expression? [1]
result = 2**3 + 10//3
(a) 8 (b) 10 (c) 11 (d) 12
Ans. (c) 11
10. How many times will the following loop execute? [1]
for i in range(1, 6, 2):
print(i)
(a) 3 (b) 5 (c) 2 (d) 4
Ans. (a) 3
11. Which of the following Python statements skips the current loop iteration? [1]
(a) continue (b) break (c) pass (d) return
Ans. (a) continue
12. Which of the following code snippets will correctly create a dictionary? [1]
(a) d = [1, 2] (b) d = (1, 2)
(c) d = {1: "One", 2: "Two"} (d) d = "One":1, "Two":2
Ans. (c) {1: "One", 2: "Two"}
13. What will be the output of the Python code? [1]
nums = [10, 20, 30, 40]
print(nums[-2])
(a) 10 (b) 30 (c) 20 (d) 40
Ans. (b) 30
14. Which method is used to count dictionary items? [1]
(a) count() (b) items() (c) len() (d) size()
Ans. (c) len()
15. Which of the following functions is used to remove all list elements? [1]
(a) clear() (b) remove() (c) del() (d) delete()
Ans. (a) clear()
16. Which SQL command is used to Modify data in a table? [1]
(a) UPDATE (b) DELETE (c) ALTER TABLE (d) MODIFY
Ans. (a) UPDATE
17. What does a row in a database called? [1]
(a) Column (b) Record (c) Attribute (d) Field
Ans. (b) Record
18. Which of the following SQL clauses is used to filter records? [1]
(a) FROM (b) WHERE (c) SELECT (d) ORDER BY
Ans. (b) WHERE
19. Which of the following is not an SQL aggregate function? [1]
(a) MAX() (b) TOTAL() (c) SUM() (d) AVG()
Ans. (b) TOTAL()
M.14