CS 1101: Programming Fundamentals Questions with Verified Solutions
CS 1101: Programming Fundamentals Questions with Verified Solutions Consider the following Python program. fin = open('') for line in fin: word = () print(word) What does the program loop over? a. Lines in a file b. Lines in a list c. Words in a dictionary d. Words in a list e. Words in a string a. Lines in a file Assume the following Python code has already executed. import os cwd = d() Which answer is most likely output from the following Python statement? e(cwd) a. ['Music', 'Pictures', 'Desktop', 'Library', 'Documents', 'Downloads'] b. False c. True d. /Users/me e. /Users/me/Documents/ b. False Assume the following Python code has already executed. import os cwd = d() Which answer is most likely output from the following Python statement? th(cwd) Select one: a. ['Music', 'Pictures', 'Desktop', 'Library', 'Documents', 'Downloads'] b. False c. True d. /Users/me e. /Users/me/Documents/ d. /Users/me What is the output from the following interactive Python statement? >>> '%g' % (0,1) a. '0' b. '0.1' c. TypeError: float argument required, not str d. TypeError: not all arguments converted during string formatting e. TypeError: not enough arguments for format string d. TypeError: not all arguments converted during string formatting What is the output of the following Python program? try: fin = open('') ('Yes') except: print('No') print('Maybe') Select one: a. Yes b. No c. Maybe d. YesMaybe e. NoMaybe e. NoMaybe What is the output of the Python code below? print('%d + %d + %d = %d' % (1, 2, 3, 1+2+3)) a. 6 b. (1 + 2 + 3 = 6) c. None d. 1 + 2 + 3 = 6 e. "1 + 2 + 3 = 6" d. 1 + 2 + 3 = 6 Which of the following Python statements
Written for
- Institution
- CS 1101: Programming Fundamentals
- Course
- CS 1101: Programming Fundamentals
Document information
- Uploaded on
- May 18, 2024
- Number of pages
- 71
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
cs 1101 programming fundamentals questions with v
Also available in package deal