You are on page 1of 7

Question 1

Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of the following Python program?


mylist = [ [2,4,1], [1,2,3], [2,3,5] ]
total = 0
for sublist in mylist:
total += sum(sublist)
print(total)
Select one:
a. 14

b. 23
c. 0
d. 13

Feedback

Your answer is correct.


The correct answer is: 23

Question 2
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of the following Python program?


fruit = "banana"
letter = fruit[1]
print (letter)
Select one:
a. b

b. a
c. n
d. banana

Feedback

The correct answer is: a

Question 3
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

What is the output of the following Python 3 program?

mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"]
a=0
while a < 8:
print(mylist[a],)
a=a+2
Select one:
a. now is the time

b. now is the time for


c. four score and seven years
d. now four is score the and seven time years for

Feedback

The correct answer is: now is the time

Question 4
Correct
Mark 1.00 out of 1.00
Flag question

Question text

What is the output of the Python code below?


my_list = [3, 2, 1]
print(my_list)
Select one:
a. 0
b. {3, 2, 1}
c. None
d. syntax error

e. [3, 2, 1]

Feedback

Your answer is correct.


The correct answer is: [3, 2, 1]

Question 5
Correct
Mark 1.00 out of 1.00

Flag question

Question text

What is the output of the following Python program?

mylist = [ [2,4,1], [1,2,3], [2,3,5] ]


a=0
total = 0
while a < 3:
b=0
while b < 2:
total += mylist[a][b]
b += 1
a += 1
print(total)
Select one:

a. 14
b. 23
c. 0
d. 13

Feedback

The correct answer is: 14

Question 6
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

In Python, a list of characters is the same as a string.


Select one:

True
False

Feedback

The correct answer is 'False'.

Question 7
Correct
Mark 1.00 out of 1.00

Flag question

Question text
What is the output of the Python code below?
my_list = [3, 2, 1]
print(my_list.sort())
Select one:
a. 0
b. {1, 2, 3}

c. None
d. syntax error
e. [1, 2, 3]

Feedback

Your answer is correct.


The correct answer is: None

Question 8
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

What is the output of the following Python program?


index = "Ability is a poor man's wealth".find("W")
print(index)
Select one:

a. 24
b. 0
c. 23
d. -1

Feedback

Your answer is incorrect.


The correct answer is: -1
Question 9
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

This Python code:

for fruit in ["banana", "apple", "quince"]:


print (fruit)

will produce this output:

banana apple quince


Select one:

True
False

Feedback

The correct answer is 'False'.

Question 10
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

To create a new object that has the same value as an existing object is knows as
creating an alias.
Select one:

True
False
Feedback

The correct answer is 'False'.

Question 1
Incorrect
Mark 0.00 out of 1.00

Flag question

Question text

What is the output of the Python code below?


my_list = [3, 2, 1]
print(my_list)
Select one:
a. 0

b. {3, 2, 1}
c. None
d. syntax error
e. [3, 2, 1]

Feedback

Your answer is incorrect.


The correct answer is: [3, 2, 1]

You might also like