Q: 11
What is the expected output of the following code?
x = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
def func(data):
res = data[0][0]
for da in data:
for d in da:
if res < d:
res = d
return res
print(func(x[0]))
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 12
What is the result of the following code snippet?
val1 = 10
val2 = 20
val3 = val1 > val2 or val2 % val1 == 0
print(val3)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 13
What will be the output of the following Python code?
d = {0, 1, 2}
for x in d:
print(x)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 14
You have the following code:
user_input = input("Enter a number: ")
result = user_input ** 2.0
print(f'{user_input} to the power of 2 is {result}')
User enters 10. The result of the input() function is a string. How can you modify this code to get rid of
the TypeError exception and get the result 100.0? (select 2)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 15
What is the expected output of the following code?
def fun():
return True
x = fun(False)
print(x)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 16
What is the output of the following Python code?
x = "Hello, World!"
result = x.split(",")
print(result)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 17
Please fill the blank field(s) in the statement with the right words. Program code making use of a given module is called a ________ of the module.
Your Answer
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 18
What is the expected output of the following code?
def func(message, num=1):
print(message * num)
func('Hello')
func('Welcome', 3)
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Q: 19
What is the result of the following code snippet?
def compute(i, j):
return i ** 2 + j ** 2
print(compute(j=2, 2))
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Question 11 of 20 · Page 2 / 2