CS 1101 Final Exam University of the People/CS 1101 Final Exam University of the People/CS 1101 Final Exam University of the People/CS 1101 Final Exam University of the People/CS 1101 Final Exam University of the People
UNIVERSITY OF THE PEOPLE
CS 1101 PROGRAMMING FUNDAMENTALS
FINAL EXAM
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
Match concepts with their definition!
,Any one of the languages that people have designed for specific Answer 1
purposes, such as representing mathematical ideas or computer formal language
programs; all programming languages are this kind of languages.
Answer 2
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 Answer 3
but that prevents the program from continuing. runtime error
An error in a program that makes it do something other than what the Answer 4
semantic error
programmer intended.
Answer 5
The meaning of a program. semantics
Answer 6
The structure of a program. syntax
An error in a program that makes it impossible to parse — and Answer 7
therefore impossible to interpret. syntax error
One of the basic elements of the syntactic structure of a program, Answer 8
token
analogous to a word in a natural language.
Feedback
The correct answer is: Any one of the languages that people have designed
for specific 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
Flag question
Question text
What is Python’s response to the command: type(0.123)
Select one:
a.
<class 'float'>
, b.
<class 'bool'>
c.
SyntaxError: invalid syntax
d.
<class 'int'>
e.
<class 'str'>
Feedback
Your answer is correct.
The correct answer is: <class 'float'>
Question 4
Correct
Mark 1.00 out of 1.00
Flag question
Question text
Given the following code, what will the output be?
mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years",
"for"]
a=0
while a < 7:
print (mylist[a],)
a += 2
Select one:
a.
now is the time
b.
now is the time for
c.
for score and seven years
d.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller VEVA2K. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £20.72. You're not tied to anything after your purchase.