Page 61 - PYTHON-11
P. 61
18. Select the correct output of the following code. (1)
my_dict = {'x': 5, 'y': 10}
print(my_dict.values())
(a) {5,10} (b) (5,10)
(c) [5,10] (d) dict_values([5, 10])
Ans. (d) dict_values([5,10])
19. Observe the following code and select the correct output. (1)
tup_val = (7, 9, 15, [41, 53])
tup_val[3][0] = 65
print(tup_val)
(a) (7, 9, 15, [41, 53]) (b) (7, 9, 15, (65, 53))
(c) (7, 9, 15, [65, 53]) (d) Error
Ans. (c) (7, 9, 15, [65, 53])
Q. 20 and Q 21 are Assertion (A) and Reason (R)-based questions. Mark the correct choice as:
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
20. Assertion (A): Python allows dynamic typing of variables. (1)
Reasoning (R): A variable in Python must be declared with a specific data type before assigning a value.
Ans. (c) A is true but R is false.
21. Assertion (A): Cyberbullying is a punishable offence under IT Act 2000. (1)
Reasoning (R): IT Act includes provisions against online harassment, defamation and misuse of digital
platforms.
Ans. (a) Both A and R are true and R is the correct explanation for A.
Section B (7 × 2 = 14 Marks)
22. Draw a logic circuit for the following equation. (2)
(X+Y)’ + (U+W)’
Ans.
X (X+Y)'
Y
(X+Y)' + (U+W)'
U (U+W)'
W
23. Write a Python program to illustrate the concept of for loop. (2)
Ans. num=int(input("Enter the number to print its table"))
for x in range(1,11):
print(num, "X", x,"=",num*x )
24. Write any four advantages of Python. (2)
Ans. Some advantages of Python are as follows:
(a) Platform-Independent: It is platform-independent and can run across different operating systems or
platforms such as Windows, Linux/Unix, macOS, etc.
(b) Readability: It uses clear, simple, concise and English-like instructions that are easy to read and
understand.
(c) Object-Oriented Programming Language: It is an interactive, interpreted and object-oriented
programming language.
(d) Syntax Highlighting: It allows easy distinction between input, output and error messages by providing
different color codes.
M.10