Computer Science > EXAM > CS 1101 Programming Fundamentals - Term 3, 2018-2019 Final Exam | 30 Questions & Answers (All)
CS 1101 Programming Fundamentals - Term 3, 2018-2019 Final Exam | 30 Questions & Answers 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 What output will the following code produce? n = 10 while n != 1: print (n,) 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 b. None an error will be displayed c. 8 4 2 d. 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 CS 1101 Programming Fundamentals - Term 3, 2018-2019 3/28/2019 Final Exam https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617 2/4 Question 3 Answer saved Marked out of 1.00 Question 4 Answer saved Marked out of 1.00 What output will the following Python commands produce? n = 1000 count = 0 while n: count = count + 1 n = n // 10 print (count) Select one: a. 0 b. 4 c. 5 d. 1000 e. 10000 This Python code: for fruit in ["banana", "apple", "quince"]: print (fruit) will produce this output: banana apple quince Select one: True False 3/28/2019 Final Exam https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617 3/4 Question 5 Answer saved Marked out of 1.00 Question 6 Answer saved Marked out of 1.00 Question 7 Answer saved Marked out of 1.00 What is the output of the following Python program? index = "Ability is a poor man's wealth".nd("w") print(index) Select one: a. 24 b. 0 c. 23 d. -1 Given a Python dictionary d and a value v, it is ecient to nd the corresponding key: d[k] = v. Select one: True False What output will the following code produce? def area(l, w): temp = l * w; return temp l = 4.0 w = 3.25 x = area(l, w) if ( x ): print (x) Select one: a. 13.0 b. 0 c. Expression does not evaluate to boolean true d. 13 [Show More]
Last updated: 4 months ago
Preview 3 out of 12 pages
Loading document previews ...
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Jun 07, 2021
Number of pages
12
Written in
This document has been written for:
Uploaded
Jun 07, 2021
Downloads
0
Views
113
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·