Python Questions and Answers Lists 5
Python Questions and Answers Lists 5
sanfoundry.com/python-question-papers
August 6, 2017
Answer: b
Explanation: Execute in the shell to verify.
2. How many elements are in m?
a) 8
b) 12
c) 16
d) 32
View Answer
Answer: c
Explanation: Execute in the shell to verify.
Note: Join free Sanfoundry classes at Telegram or Youtube
3. What will be the output of the following Python code?
2. v = values[0][0]
5. if v < values[row][column]:
6. v = values[row][column]
7. print(v)
a) 3
b) 5
c) 6
1/4
d) 33
View Answer
Answer: d
Explanation: Execute in the shell to verify.
4. What will be the output of the following Python code?
2. v = values[0][0]
5. if v > element:
6. v = element
7. print(v)
a) 1
b) 3
c) 5
d) 6
View Answer
Answer: a
Explanation: Execute in the shell to verify.
5. What will be the output of the following Python code?
3. row.sort()
6. print()
Answer: d
Explanation: Execute in the shell to verify.
6. What will be the output of the following Python code?
2/4
1. matrix = [[1, 2, 3, 4],
2. [4, 5, 6, 7],
a) 1 2 3 4
b) 4 5 6 7
c) 1 3 8 12
d) 2 5 9 13
View Answer
Answer: d
Explanation: Execute in the shell to verify.
7. What will be the output of the following Python code?
1. def m(list):
2. v = list[0]
3. for e in list:
4. if v < e: v = e
5. return v
a) 3 33
b) 1 1
c) 5 6
d) 5 33
View Answer
Answer: d
Explanation: Execute in the shell to verify.
8. What will be the output of the following Python code?
2. print(data[1][0][0])
3/4
a) 1
b) 2
c) 4
d) 5
View Answer
Answer: d
Explanation: Execute in the shell to verify.
9. What will be the output of the following Python code?
2. def ttt(m):
3. v = m[0][0]
4. for row in m:
7. return v
8. print(ttt(data[0]))
a) 1
b) 2
c) 4
d) 5
View Answer
Answer: c
Explanation: Execute in the shell to verify.
10. What will be the output of the following Python code?
2. points.sort()
3. print(points)
Answer: c
4/4