Skip to document
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

CS1101 Unit 6 Quiz

Course

Programming Fundamentals (CS 1101)

999+ Documents
Students shared 1059 documents in this course
Uploaded by:
Anonymous Student
This document has been uploaded by a student, just like you, who decided to remain anonymous.
University of the People

Comments

Please sign in or register to post comments.

Preview text

Self-quiz 6 review

Question 1

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 The correct answer is: 23

Question 2

In Python, a list of characters is the same as a string. Select one: True False The correct answer is 'False'.

Question 3

String objects are modified with string slices. Select one: True False The correct answer is 'False'.

Question 4

The Python expression '​Unit 6'[-1] has value '6'. Select one: True False The correct answer is 'True'.

Question 5

What is the output of the following Python program? mylist = [ [2,4,1], [1,2,3], [2,3,5] ] a= 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 The correct answer is: 14

Question 6

A variable that has a data type of "str" cannot be part of a compound data type Select one: True False The correct answer is 'False'.

Question 7

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. - Your answer is correct. The correct answer is: -

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 The correct answer is: four score and seven years

Question 12

Traversal can only be accomplished with the "while" loop.

Select one: True False The correct answer is:’False’.

Question 13

This Python code: for fruit in ["banana", "apple", "quince"]: print (fruit)

Select one: True False The correct answer is 'False'.

Question 14

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. - Your answer is correct. The correct answer is: 24

Question 15

What is the output of the Python code below? my_list = [3, 2, 1]

print(my_list()) Select one:

a. 0 b. {1, 2, 3} c. None d. syntax error e. [1, 2, 3] Your answer is correct. The correct answer is: None

Question 16

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 Your answer is correct. The correct answer is: a

Question 17

To create a new object that has the same ​ value ​ as an existing object is knows as creating an ​ alias ​. Select one: True False The correct answer is 'False'.

Was this document helpful?
This is a Premium Document. Some documents on Studocu are Premium. Upgrade to Premium to unlock it.

CS1101 Unit 6 Quiz

Course: Programming Fundamentals (CS 1101)

999+ Documents
Students shared 1059 documents in this course
Was this document helpful?

This is a preview

Do you want full access? Go Premium and unlock all 5 pages
  • Access to all documents

  • Get Unlimited Downloads

  • Improve your grades

Upload

Share your documents to unlock

Already Premium?
Self-quiz 6 review
Question 1
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
The correct answer is: 23
Question 2
In Python, a list of characters is the same as a string.
Select one:
True
False
The correct answer is 'False'.
Question 3
String objects are modified with string slices.
Select one:
True
False
The correct answer is 'False'.
Question 4
The Python expression 'Unit 6'[-1] has value '6'.
Select one:
True
False
The correct answer is 'True'.

Why is this page out of focus?

This is a Premium document. Become Premium to read the whole document.