Computer Science > ESSAY > CS 1101 Programming Fundamentals _Term 3_ CS 1101 - AY2019-T3 ► Final Exam (Days 1 - 4) ► Final  (All)

CS 1101 Programming Fundamentals _Term 3_ CS 1101 - AY2019-T3 ► Final Exam (Days 1 - 4) ► Final Exam. Score 30/30.

Document Content and Description Below

CS 1101 Programming Fundamentals Final Exam Home ► My courses ► CS 1101 - AY2019-T3 ► Final Exam (Days 1 - 4) ► Final Exam Question 1 Answer saved Marked out of 1.00 Question 2 Answer... saved Marked 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 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 eÞcient 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 3/28/2019 Final Exam https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617 4/4 Question 8 Answer saved Marked out of 1.00 Question 9 Answer saved Marked out of 1.00 Question 10 Answer saved Marked out of 1.00 ◄ Review Quiz Jump to... Python tuples are mutable. Select one: True False Generally speaking, Õlter list operations produce a diàerent number of list elements compared to map operations. Select one: True False In Python, a list of characters is the same as a string. Select one: True False 3/28/2019 Final Exam https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617&page=1 1/4 Home ► My courses ► CS 1101 - AY2019-T3 ► Final Exam (Days 1 - 4) ► Final Exam Question 11 Not yet answered Marked out of 1.00 Question 12 Not yet answered Marked out of 1.00 Question 13 Not yet answered Marked out of 1.00 Which of the following types are allowed for Python dictionary keys? Select one: a. dictionary b. dictionary of lists c. list d. tuple e. All of the above What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(0) Select one: a. 0 b. 1 c. no output d. RuntimeError: maximum recursion depth exceeded In most cases, it is possible to prevent an exception from terminating a program by using the try and except statements. Select one: True False 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&page=1 2/4 Question 14 Not yet answered Marked out of 1.00 Question 15 Not yet answered Marked out of 1.00 Question 16 Not yet answered Marked out of 1.00 Question 17 Not yet answered Marked out of 1.00 Handling an exception with a try statement is called throwing an exception. Select one: True False In Python, once a variable has been created, its type cannot be changed in the program. Select one: True False The elements of a list are mutable. Select one: True False A Python expression is a combination of variables, operators, and values that represents a single result. Select one: True False 3/28/2019 Final Exam https://my.uopeople.edu/mod/quiz/attempt.php?attempt=1772932&cmid=169617&page=1 3/4 Question 18 Not yet answered Marked out of 1.00 Question 19 Not yet answered Marked out of 1.00 What output will the following Python script produce? def function2(param): print (param, param) def function1(part1, part2): cat = part1 + part2 function2(cat) chant1 = "See Me " chant2 = "See You " function1(chant1, chant2) Select one: a. See Me See You b. See You See Me See You See Me c. See Me See Me See You See You d. None it would generate an error Which of the following is not a Python keyword? Select one: a. def b. else c. in d. path e. break 3/28/2019 Final Exam Question 20 Not yet answered Marked out of 1.00 ◄ Review Quiz Jump to... What output will the following Python statement produce? print ("%s %d %f" % (5, 5, 5)) Select one: a. 5 5 5.000000 b. 5 5 5 c. 5 5.000000 d. 0 5 5.0 3/28/2019 Final Exam Home ► My courses ► CS 1101 - AY2019-T3 ► Final Exam (Days 1 - 4) ► Final Exam Question 21 Not yet answered Marked out of 1.00 Question 22 Not yet answered Marked out of 1.00 The invert_dict Python function is supposed to invert a dictionary. Based on the sample input and the output shown below, the function is correct. invert_dict({1: 10, 2: 10, 3: 20}) {10: [1, 2, 3], 20: [3]} Select one: True False What does Python function procedure do? def procedure( n ): while n > 0: print (n,) n = n - 1 Select one: a. Counts from 10 down to 0 and displays each number b. Counts from n down to 1 and displays each number c. Calculates the sum of n numbers greater than 0 d. Calculates the mean of n CS 1101 Programming Fundamentals - Term 3, 2018-2019 3/28/2019 Final Exam Question 23 Not yet answered Marked out of 1.00 Question 24 Not yet answered Marked out of 1.00 Functions like print which perform an action but don’t return a value are called: Select one: a. recursive functions b. built-in functions c. simple functions d. utility functions e. void functions The Python code below is an example of recursion: def fa(): fb() def fb(): fa() fa() Select one: True False 3/28/2019 Final Exam Question 25 Not yet answered Marked out of 1.00 Question 26 Not yet answered Marked out of 1.00 Question 27 Not yet answered Marked out of 1.00 What output will the following python commands produce: 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: a. 1 and 2 are equal b. 1 is less than 2 c. 1 is greater than 2 d. 2 is greater than 1 What is the value of the following Python expression? not(True or False) Select one: True False An error in a program that makes it do something other than what the programmer intended is called: Select one: a. a syntax error b. a semantic error c. an exception d. a user error e. a side-eàect 3/28/2019 Final Exam Question 28 Not yet answered Marked out of 1.00 Question 29 Not yet answered Marked out of 1.00 Question 30 Not yet answered Marked out of 1.00 ◄ Review Quiz Jump to... The Python line below causes “5 dollars” to be printed. print('%s %d' % (5, 'dollars')) Select one: True False If a Python function modiÕes an argument of type list, the caller’s corresponding variable is modiÕed to match. Select one: True False What is the output of the following Python script? pi = Öoat(3.14159) print (pi) Select one: a. 3 b. 3.0 c. 3.14159 d. 0 [Show More]

Last updated: 1 year ago

Preview 1 out of 12 pages

Add to cart

Instant download

We Accept:

We Accept
document-preview

Buy this document to get the full access instantly

Instant Download Access after purchase

Add to cart

Instant download

We Accept:

We Accept

Reviews( 0 )

$8.50

Add to cart

We Accept:

We Accept

Instant download

Can't find what you want? Try our AI powered Search

OR

REQUEST DOCUMENT
338
2

Document information


Connected school, study & course


About the document


Uploaded On

Dec 01, 2020

Number of pages

12

Written in

Seller


seller-icon
QuizMaster

Member since 5 years

1095 Documents Sold


Additional information

This document has been written for:

Uploaded

Dec 01, 2020

Downloads

 2

Views

 338

Document Keyword Tags

What is Browsegrades

In Browsegrades, 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 are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Browsegrades · High quality services·