Cs 9 Reviews Quiz
Cs 9 Reviews Quiz
Cs 9 Reviews Quiz
Home
Dashboard
Site pages
Raymond Enokela
My courses
CS 1101 - AY2021-T1
Participants
Badges
Home
Competencies
Grades
General
Home My courses CS 1101 - AY2021-T1 Final Exam (Days 1 - 4) Review Quiz
3 September - 9
September
Review
10 SeptemberQuiz
- 16
September
17 September - 23
The Review Quiz will test your knowledge of all materials learned in this course. The results of this quiz will
September
not count towards your
24 September - 30 nal grade, but will help guide you in more thoroughly reviewing necessary topics
and adequately
September preparing for the Final Exam.
1 October - 7 October
8 October - 14 October
This quiz opened at Thursday, 22 October 2020, 12:05 AM
15 October - 21 October
22 October - 28 October
This quiz will close on Sunday, 1 November 2020, 11:55 PM.
Final Exam (Days 1 - 4)
Learning Guide Unit 9 Grading method: Highest grade
Review Quiz
Final Exam
Summary
Media Gallery of your previous attempts
UNIV 1001 - AY2021-T1
Attempt State Marks / 30.00 Grade / 100.00 Review
Finished
1 18.75 62.50 Review
Submitted Tuesday, 27 October 2020, 12:14 PM
Finished
2 13.13 43.78 Review
Submitted Friday, 30 October 2020, 9:21 AM
Finished
3 9.57 31.89 Review
Submitted Friday, 30 October 2020, 9:27 AM
Finished
4 10.00 33.33 Review
Submitted Friday, 30 October 2020, 9:32 AM
Finished
5 11.25 37.50 Review
Submitted Friday, 30 October 2020, 9:38 AM
/
Navigation
Highest grade: 62.50 / 100.00.
Home
Dashboard
Site pages Re-attempt quiz
My courses
CS 1101 - AY2021-T1
Learning Guide Unit 9
◄Participants
Badges
Jump to...
Competencies
Grades
Final Exam ►
General
3 September -9
UoPeople Clock (GMT-5)
September
10 September - 16
All activities close on Wednesdays at 11:55 PM, except for Learning Journals/Portfolios which close
September
on
17Thursdays
September at-11:55
23 PM always following this clock.
September
Sat, Oct 31, 2020
24 September
8:53 am - 30
September
1 October - 7 October
8 October - 14 October
Disclaimer Regarding Use of Course Material - Terms of Use
15 October - 21 October
22 October
University - 28 People
of the Octoberis a 501(c)(3) not for pro t organization. Contributions are tax deductible to the
extent permitted by law.
Final Exam (Days 1 - 4)
Copyright
Learning Guide Unit 9 © University of the People 2020. All rights reserved.
Review Quiz
Reset userFinal
tour Exam
on this page
Media Gallery
UNIV 1001 - AY2021-T1
/
Raymond Enokela
Which of the following types are allowed for Python dictionary keys?
Select one:
a. dictionary
b. list
c. list of dictionaries
d. tuple
/
Question 2 Partially correct Mark 0.25 out of 1.00
Any one of the languages that people have designed for speci c
formal language
purposes, such as representing mathematical ideas or computer
programs; all programming languages are this kind of languages.
syntax error
Any one of the languages that people speak that evolved naturally.
An error that does not occur until the program has started to execute syntax error
An error in a program that makes it do something other than what natural language
syntax error
The meaning of a program.
semantic error
The structure of a program.
The correct answer is: Any one of the languages that people have designed for speci c
purposes, such as representing mathematical ideas or computer programs; all programming
languages are this kind of languages. → formal language, Any one of the languages that
people speak that evolved naturally. → natural language, An error that does not occur until
the program has started to execute but that prevents the program from continuing. →
runtime error, An error in a program that makes it do something other than what the
programmer intended. → semantic error, The meaning of a program. → semantics, The
structure of a program. → syntax, An error in a program that makes it impossible to parse —
and therefore impossible to interpret. → syntax error, One of the basic elements of the
syntactic structure of a program, analogous to a word in a natural language. → token
/
Question 3 Correct Mark 1.00 out of 1.00
Select one:
b. <class 'bool'>
d. <class 'int'>
e. <class 'str'>
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
/
Question 5 Incorrect Mark 0.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
What is line?
Select one:
a. A le object
b. A list of characters
c. A list of words
/
Question 6 Correct Mark 1.00 out of 1.00
def function2(param):
print (param, param)
Select one:
The correct answer is: See Me See You See Me See You
/
Question 7 Incorrect Mark 0.00 out of 1.00
Which one of the following Python expressions has the value 64?
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
: To create a new object that has the same value as an existing object is know as
creating an alias.
Select one:
True
False
/
Question 9 Incorrect Mark 0.00 out of 1.00
def recurse(a):
if (a == 0):
print(a)
else:
recurse(a)
recurse(1)
Select one:
a. 0
b. 1
c. no output
pi = int(3.14159)
print (pi)
Select one:
a. 3
b. 3.0
c. 3.14159
d. 0
/
Question 11 Incorrect Mark 0.00 out of 1.00
def subroutine( n ):
while n > 0:
print (n,)
n -= 1
Select one:
The correct answer is: Counts from n down to 1 and displays each number
/
Question 12 Incorrect Mark 0.00 out of 1.00
l = 12.5
w=5
h=2
test_function(l, w, h)
Select one:
d. 125.0
/
Question 13 Correct Mark 1.00 out of 1.00
What will the contents of mylist be after the following code has been executed?
Select one:
a. [1, 4, 2, 3, 5]
b. [5, 1, 4, 2, 3]
c. [null]
d. [1, 4, 2, 3]
Learning to debug can be frustrating, but it is a valuable skill that is useful for many
activities beyond programming.
Select one:
True
False
/
Question 15 Incorrect Mark 0.00 out of 1.00
Select one:
True
False
x=1
y=2
if x == y:
print (x, "and", y, "are equal")
else:
if x < y:
print (x, "is less than", y)
else:
print (x, "is greater than", y)
Select one:
b. 1 is less than 2
c. 1 is greater than 2
d. 2 is greater than 1
/
Question 17 Incorrect Mark 0.00 out of 1.00
mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"]
print(" ".join(mylist[1::2]))
Select one:
/
Question 18 Incorrect Mark 0.00 out of 1.00
n = 10000
count = 0
while n:
count = count + 1
n = n // 10
print (count)
Select one:
a. 5
b. 0
c. 10000
d. 1000
/
Question 19 Incorrect Mark 0.00 out of 1.00
Assume that d is a Python dictionary. What does the following Python code produce?
d.items()
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
Select one:
True
False
/
Question 21 Incorrect Mark 0.00 out of 1.00
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]
/
Question 22 Correct Mark 1.00 out of 1.00
Select one:
a. 14
b. 23
c. 0
d. 13
/
Question 23 Correct Mark 1.00 out of 1.00
x=5
if x % 2 == 0:
print (x)
else:
print (x, x%2)
Select one:
a. 5
b. 5 1
c. 2
d. 5 0
/
Question 24 Correct Mark 1.00 out of 1.00
n = 10
while n != 1:
print (n,end=' ')
if n % 2 == 0: # n is even
n = n // 2
else: # n is odd
n=n*3+1
Select one:
a. 10 5 16 8 4 2
c. 8 4 2
d. 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2
Select one:
b. <class 'bool'>
d. <class 'int'>
e. <class 'str'>
/
Question 26 Correct Mark 1.00 out of 1.00
x=5
if x % 2 == 0:
print (x)
else:
print (x, x%2)
Select one:
a. 5
b. 5 1
c. 2
d. 5 0
/
Question 27 Incorrect Mark 0.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
What is n?
Select one:
a. A le object
b. A list of characters
c. A list of words
/
Question 28 Incorrect Mark 0.00 out of 1.00
import string
Select one:
a. 24
b. 0
c. 23
d. -1
pi = oat(3.14159)
print (pi)
Select one:
a. 3
b. 3.0
c. 3.14159
d. 0
/
Question 30 Incorrect Mark 0.00 out of 1.00
Select one:
a. in nite loop
b. universal loop
c. while loop
Jump to...
Final Exam ►
/
Raymond Enokela
Select one:
True
False
/
Question 2 Correct Mark 1.00 out of 1.00
Select one:
a. 14
b. 23
c. 0
d. 13
/
Question 3 Correct Mark 1.00 out of 1.00
What will the contents of mylist be after the following code has been executed?
Select one:
a. [1, 4, 2, 3, 5]
b. [5, 1, 4, 2, 3]
c. [null]
d. [1, 4, 2, 3]
/
Question 4 Incorrect Mark 0.00 out of 1.00
Assume that d is a Python dictionary. What does the following Python code produce?
result = dict()
for key in d:
val = d[key]
if val not in inverse:
result[val] = [key]
else:
result[val].append(key)
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
/
Question 5 Incorrect Mark 0.00 out of 1.00
Assume that d is a Python dictionary. What does the following Python code produce?
result = dict()
for key in d:
val = d[key]
if val not in result:
result[val] = [key]
else:
result[val].append(key)
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
Learning to debug can be frustrating, but it is a valuable skill that is useful for many
activities beyond programming.
Select one:
True
False
/
Question 7 Correct Mark 1.00 out of 1.00
Select one:
a. in nite loop
b. universal loop
c. while loop
/
Question 8 Partially correct Mark 0.13 out of 1.00
syntax
An error in a program.
The process of nding and removing any of the three kinds of syntax
programming errors.
Any one of the languages that people have designed for speci c
debugging
purposes, such as representing mathematical ideas or computer
programs; all programming languages are this kind of languages.
interpreter
A program that reads another program and executes it.
program
Any one of the languages that people speak that evolved naturally.
problem solving
To examine a program and analyse the syntactic structure.
A property of a program that can run on more than one kind of script
computer.
An instruction that causes the Python interpreter to display a value natural language
on the screen.
computations to be performed.
natural language
A program stored in a le (usually one that will be interpreted).
/
One of the basic elements of the syntactic structure of a program, token
problem solving
The structure of a program.
The correct answer is: An error in a program. → bug, The process of nding and removing
any of the three kinds of programming errors. → debugging, Any one of the languages that
people have designed for speci c purposes, such as representing mathematical ideas or
computer programs; all programming languages are this kind of languages. → formal
language, A programming language like Python that is designed to be easy for humans to
read and write. → high-level language, A program that reads another program and executes
it. → interpreter, A programming language that is designed to be easy for a computer to
execute; also called machine language or assembly language. → low-level language, Any one
of the languages that people speak that evolved naturally. → natural language, To examine a
program and analyse the syntactic structure. → parse, A property of a program that can run
on more than one kind of computer. → portability, An instruction that causes the Python
interpreter to display a value on the screen. → print statement, The process of formulating a
problem, nding a solution, and expressing the solution. → problem solving, a sequence of
instructions that speci es to a computer actions and computations to be performed. →
program, A program stored in a le (usually one that will be interpreted). → script, One of the
basic elements of the syntactic structure of a program, analogous to a word in a natural
language. → token, The structure of a program. → syntax
/
Question 9 Correct Mark 1.00 out of 1.00
mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"]
a=0
while a < 7:
print (mylist[a],)
a += 2
Select one:
/
Question 10 Incorrect Mark 0.00 out of 1.00
x=5
if x % 2 == 0:
print (x)
else:
print (x, x%2)
Select one:
a. 5
b. 5 1
c. 2
d. 5 0
/
Question 11 Incorrect Mark 0.00 out of 1.00
n = 10000
count = 0
while n:
count = count + 1
n = n // 10
print (count)
Select one:
a. 5
b. 0
c. 10000
d. 1000
/
Question 12 Correct Mark 1.00 out of 1.00
x=1
y=2
if x == y:
print (x, "and", y, "are equal")
else:
if x < y:
print (x, "is less than", y)
else:
print (x, "is greater than", y)
Select one:
b. 1 is less than 2
c. 1 is greater than 2
d. 2 is greater than 1
/
Question 13 Incorrect Mark 0.00 out of 1.00
mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"]
print(" ".join(mylist[1::2]))
Select one:
import string
Select one:
a. 24
b. 0
c. 23
d. -1
/
Question 15 Incorrect Mark 0.00 out of 1.00
Which one of the following Python expressions has the value 10?
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
pi = int(3.14159)
print (pi)
Select one:
a. 3
b. 3.0
c. 3.14159
d. 0
/
Question 17 Incorrect Mark 0.00 out of 1.00
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]
/
Question 18 Incorrect Mark 0.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
What is word?
Select one:
a. A le object
b. A list of characters
c. A list of words
Select one:
True
False
/
Question 20 Incorrect Mark 0.00 out of 1.00
: To create a new object that has the same value as an existing object is know as
creating an alias.
Select one:
True
False
A variable that has a data type of "str" cannot be part of a compound data type
Select one:
True
False
/
Question 22 Incorrect Mark 0.00 out of 1.00
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
Select one:
b. <class 'bool'>
d. <class 'int'>
e. <class 'str'>
/
Question 24 Correct Mark 1.00 out of 1.00
pi = oat(3.14159)
print (pi)
Select one:
a. 3
b. 3.0
c. 3.14159
d. 0
Select one:
True
False
/
Question 26 Correct Mark 1.00 out of 1.00
def subroutine( n ):
while n > 0:
print (n,)
n -= 1
Select one:
The correct answer is: Counts from n down to 1 and displays each number
Select one:
True
False
/
Question 28 Correct Mark 1.00 out of 1.00
Which one of the following Python expressions has the value 64?
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
l = 12.5
w=5
h=2
test_function(l, w, h)
Select one:
d. 125.0
try:
n = open('answer.txt')
n.write('Yes')
except:
print('No')
print('Maybe')
Select one:
a. Yes
b. No
c. Maybe
d. Yes
Maybe
e. No
Maybe
Jump to...
Final Exam ►
/
Raymond Enokela
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
/
Question 2 Correct Mark 1.00 out of 1.00
n = 10
while n != 1:
print (n,end=' ')
if n % 2 == 0: # n is even
n = n // 2
else: # n is odd
n=n*3+1
Select one:
a. 10 5 16 8 4 2
c. 8 4 2
d. 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2
If you use a Python dictionary in a for statement, it traverses the _____ of the
dictionary.
Select one:
b. indices
d. values
e. keys
Which one of the following Python expressions has the value 64?
Select one:
a. 8 ^ 2
b. 8 ** 2
c. 8 +- 2
d. 8 += 2
e. 8 -+ 2
def subroutine( n ):
while n > 0:
print (n,)
n -= 1
Select one:
The correct answer is: Counts from n down to 1 and displays each number
/
Question 6 Incorrect Mark 0.00 out of 1.00
Select one:
a. structured development
b. incremental development
c. unit testing
/
Question 7 Correct Mark 1.00 out of 1.00
Select one:
a. 14
b. 23
c. 0
d. 13
/
Question 8 Correct Mark 1.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
Select one:
a. Lines in a le
b. Lines in a list
c. Words in a dictionary
d. Words in a list
e. Words in a string
/
Question 9 Partially correct Mark 0.07 out of 1.00
natural language
An error in a program.
The process of nding and removing any of the three kinds of natural language
programming errors.
Any one of the languages that people have designed for speci c
natural language
purposes, such as representing mathematical ideas or computer
programs; all programming languages are this kind of languages.
natural language
A program that reads another program and executes it.
natural language
Any one of the languages that people speak that evolved naturally.
natural language
To examine a program and analyse the syntactic structure.
A property of a program that can run on more than one kind of natural language
computer.
An instruction that causes the Python interpreter to display a value natural language
on the screen.
computations to be performed.
low-level language
A program stored in a le (usually one that will be interpreted).
/
One of the basic elements of the syntactic structure of a program, problem solving
program
The structure of a program.
The correct answer is: An error in a program. → bug, The process of nding and removing
any of the three kinds of programming errors. → debugging, Any one of the languages that
people have designed for speci c purposes, such as representing mathematical ideas or
computer programs; all programming languages are this kind of languages. → formal
language, A programming language like Python that is designed to be easy for humans to
read and write. → high-level language, A program that reads another program and executes
it. → interpreter, A programming language that is designed to be easy for a computer to
execute; also called machine language or assembly language. → low-level language, Any one
of the languages that people speak that evolved naturally. → natural language, To examine a
program and analyse the syntactic structure. → parse, A property of a program that can run
on more than one kind of computer. → portability, An instruction that causes the Python
interpreter to display a value on the screen. → print statement, The process of formulating a
problem, nding a solution, and expressing the solution. → problem solving, a sequence of
instructions that speci es to a computer actions and computations to be performed. →
program, A program stored in a le (usually one that will be interpreted). → script, One of the
basic elements of the syntactic structure of a program, analogous to a word in a natural
language. → token, The structure of a program. → syntax
/
Question 10 Incorrect Mark 0.00 out of 1.00
Select one:
b. <class 'bool'>
d. <class 'int'>
e. <class 'str'>
x=5
if x % 2 == 0:
print (x)
else:
print (x, x%2)
Select one:
a. 5
b. 5 1
c. 2
d. 5 0
/
Question 12 Incorrect Mark 0.00 out of 1.00
Select one:
True
False
def recurse(a):
if (a == 0):
print(a)
else:
recurse(a)
recurse(1)
Select one:
a. 0
b. 1
c. no output
/
Question 14 Correct Mark 1.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
What is n?
Select one:
a. A le object
b. A list of characters
c. A list of words
/
Question 15 Incorrect Mark 0.00 out of 1.00
"bib". nd('b', 1, 2)
Select one:
a. 0
b. 2
c. -1
d. syntax error
e. 3
Select one:
True
False
/
Question 17 Correct Mark 1.00 out of 1.00
Select one:
True
False
For the Python program below, will there be any output, and will the program
terminate?
while True:
while 1 > 0:
break
print("Got it!")
break
Select one:
a. Yes and no
b. No and no
d. No and yes
e. Run-time error
/
Question 19 Incorrect Mark 0.00 out of 1.00
Select one:
True
False
Which of the following types are allowed for Python dictionary keys?
Select one:
a. dictionary
b. list
c. list of dictionaries
d. tuple
/
Question 21 Incorrect Mark 0.00 out of 1.00
Select one:
True
False
/
Question 22 Partially correct Mark 0.50 out of 1.00
Any one of the languages that people have designed for speci c
formal language
purposes, such as representing mathematical ideas or computer
programs; all programming languages are this kind of languages.
semantics
Any one of the languages that people speak that evolved naturally.
An error that does not occur until the program has started to execute formal language
semantics
The meaning of a program.
syntax
The structure of a program.
The correct answer is: Any one of the languages that people have designed for speci c
purposes, such as representing mathematical ideas or computer programs; all programming
languages are this kind of languages. → formal language, Any one of the languages that
people speak that evolved naturally. → natural language, An error that does not occur until
the program has started to execute but that prevents the program from continuing. →
runtime error, An error in a program that makes it do something other than what the
programmer intended. → semantic error, The meaning of a program. → semantics, The
structure of a program. → syntax, An error in a program that makes it impossible to parse —
and therefore impossible to interpret. → syntax error, One of the basic elements of the
syntactic structure of a program, analogous to a word in a natural language. → token
/
Question 23 Incorrect Mark 0.00 out of 1.00
A variable that has a data type of "str" cannot be part of a compound data type
Select one:
True
False
x=1
y=2
if x == y:
print (x, "and", y, "are equal")
else:
if x < y:
print (x, "is less than", y)
else:
print (x, "is greater than", y)
Select one:
b. 1 is less than 2
c. 1 is greater than 2
d. 2 is greater than 1
/
Question 25 Incorrect Mark 0.00 out of 1.00
Select one:
b. <class 'bool'>
d. <class 'int'>
e. <class 'str'>
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]
/
Question 27 Incorrect Mark 0.00 out of 1.00
Select one:
a. 5 5 5.000000
b. 5 5 5
c. 5 5.000000
d. 0 5 5.0
Select one:
a. 14
b. 23
c. 0
d. 13
/
Question 29 Correct Mark 1.00 out of 1.00
def function2(param):
print (param, param)
Select one:
The correct answer is: See Me See You See Me See You
/
Question 30 Incorrect Mark 0.00 out of 1.00
try:
n = open('answer.txt')
n.write('Yes')
except:
print('No')
print('Maybe')
Select one:
a. Yes
b. No
c. Maybe
d. Yes
Maybe
e. No
Maybe
Jump to...
Final Exam ►
/
Raymond Enokela
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
What is line?
Select one:
a. A le object
b. A list of characters
c. A list of words
/
Question 2 Correct Mark 1.00 out of 1.00
x=5
if x % 2 == 0:
print (x)
else:
print (x, x%2)
Select one:
a. 5
b. 5 1
c. 2
d. 5 0
/
Question 3 Correct Mark 1.00 out of 1.00
def function2(param):
print (param, param)
Select one:
The correct answer is: See Me See You See Me See You
/
Question 4 Correct Mark 1.00 out of 1.00
banana
apple
quince
Select one:
True
False
/
Question 5 Correct Mark 1.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
Select one:
a. Lines in a le
b. Lines in a list
c. Words in a dictionary
d. Words in a list
e. Words in a string
/
Question 6 Incorrect Mark 0.00 out of 1.00
Assume that d is a Python dictionary. What does the following Python code produce?
for k in d:
if d[k] == v:
return k
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
Select one:
a. 24
b. 0
c. 23
d. -1
/
Question 8 Correct Mark 1.00 out of 1.00
Select one:
a. 5 5 5.000000
b. 5 5 5
c. 5 5.000000
d. 0 5 5.0
When a Python function is called, inside the function, the arguments are assigned to
variables called parameters.
Select one:
True
False
/
Question 10 Correct Mark 1.00 out of 1.00
l = 4.0
w = 3.25
x = area(l, w)
if ( x ):
print (x)
Select one:
a. 13.0
b. 0
d. 13
/
Question 11 Correct Mark 1.00 out of 1.00
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]
"bib". nd('b', 1, 2)
Select one:
a. 0
b. 2
c. -1
d. syntax error
e. 3
/
Question 13 Correct Mark 1.00 out of 1.00
n = 10
while n != 1:
print (n,end=' ')
if n % 2 == 0: # n is even
n = n // 2
else: # n is odd
n=n*3+1
Select one:
a. 10 5 16 8 4 2
c. 8 4 2
d. 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2
/
Question 14 Incorrect Mark 0.00 out of 1.00
n = open('words.txt')
for line in n:
word = line.strip()
print(word)
What is n?
Select one:
a. A le object
b. A list of characters
c. A list of words
Select one:
True
False
/
Question 16 Correct Mark 1.00 out of 1.00
Select one:
True
False
/
Question 17 Partially correct Mark 0.75 out of 1.00
Any one of the languages that people have designed for speci c
formal language
purposes, such as representing mathematical ideas or computer
programs; all programming languages are this kind of languages.
natural language
Any one of the languages that people speak that evolved naturally.
An error that does not occur until the program has started to execute runtime error
An error in a program that makes it do something other than what semantic error
syntax
The meaning of a program.
syntax
The structure of a program.
The correct answer is: Any one of the languages that people have designed for speci c
purposes, such as representing mathematical ideas or computer programs; all programming
languages are this kind of languages. → formal language, Any one of the languages that
people speak that evolved naturally. → natural language, An error that does not occur until
the program has started to execute but that prevents the program from continuing. →
runtime error, An error in a program that makes it do something other than what the
programmer intended. → semantic error, The meaning of a program. → semantics, The
structure of a program. → syntax, An error in a program that makes it impossible to parse —
and therefore impossible to interpret. → syntax error, One of the basic elements of the
syntactic structure of a program, analogous to a word in a natural language. → token
/
Question 18 Correct Mark 1.00 out of 1.00
Select one:
b. <class 'bool'>
d. <class 'int'>
e. <class 'str'>
Assume that d is a Python dictionary. What does the following Python code produce?
d.items()
Select one:
a. a histogram
b. an inverted dictionary
c. a list of tuples
d. a lookup
e. a reverse lookup
/
Question 20 Incorrect Mark 0.00 out of 1.00
Select one:
True
False
def recurse(a):
if (a == 0):
print(a)
else:
recurse(a)
recurse(1)
Select one:
a. 0
b. 1
c. no output
/
Question 22 Correct Mark 1.00 out of 1.00
Select one:
a. 14
b. 23
c. 0
d. 13
Which of the following types are allowed for Python dictionary values?
Select one:
a. dictionary
b. list
c. list of dictionaries
d. tuple
/
Question 24 Correct Mark 1.00 out of 1.00
Select one:
a. recursion
b. conditional execution
c. alternative execution
If you assign the result a void function to a variable in Python, you get:
Select one:
a. an empty string
b. the value -1
c. the value 0
e. an exception
/
Question 26 Incorrect Mark 0.00 out of 1.00
Select one:
True
False
Which of the following types are allowed for Python dictionary keys?
Select one:
a. dictionary
b. list
c. list of dictionaries
d. tuple
/
Question 28 Correct Mark 1.00 out of 1.00
Select one:
a. structured development
b. incremental development
c. unit testing
If you use a Python dictionary in a for statement, it traverses the _____ of the
dictionary.
Select one:
b. indices
d. values
e. keys
/
Question 30 Incorrect Mark 0.00 out of 1.00
For the Python program below, will there be any output, and will the program
terminate?
while True:
while 1 > 0:
break
print("Got it!")
break
Select one:
a. Yes and no
b. No and no
d. No and yes
e. Run-time error
Jump to...
Final Exam ►