Introduction to Programming 1-12 Exam

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

To determine the length of a string that's in a variable named city, you can use this code: - city.length() - len(city) - city.len() - length(city)

len(city)

Which of the following modules lets you work with decimal numbers instead of floating-point numbers? - math - locale - currency - decimal

locale

Which of the following modules provides a function for formatting currency in the US, UK, or parts of Europe? - math - locale - decimal - currency

locale

A dictionary stores a collection of ___. - ordered items - unordered items - mutable items - immutable items

unordered items

To delete all items from a dictionary you can ___. - use the pop() method without any arguments - use the clear() method - use the del keyword on a dictionary item - use the deleteAll() method

use the clear() method

Code Example 6-1 def main(): students = [["Lizzy", 73, "C"], ["Mike", 98, "A"], ["Joel", 88, "B+"], ["Anne", 93, "A"]] for student in students: for item in student: print(item, end=" ") if __name__ == "__main__": main() Refer to Code Example 6-1: What is in the second row of the students list? - "Mike", 98, "A" - "Joel", 88, "B+" - "C", "A", "B+", "A" - 73, 98, 88, 93

"Mike", 98, "A"

Given the following code, what will be displayed after the code executes? name = "Mervin the Magician" words = name.split() print(words[0] + ", you are quite a " + words[2].lower()) - Mervin, you are quite a magician - Mervin , you are quite the magician - Mervin , you are quite a magician - Mervin, you are quite a Magician

Mervin, you are quite a magician

Code Example 8-1 import csv import sys FILENAME = "names.csv" def main(): try: names = [] with open(FILENAME, newline="") as file: reader = csv.reader(file) for row in reader: names.append(row) except FileNotFoundError as e: print("Could not find " + FILENAME + " file.") sys.exit() except Exception as e: print(type(e), e) sys.exit() print(names) if __name__ == "__main__": main() Refer to Code Example 8-1. If the names.csv file is not in the same directory as the file that contains the Python code, what type of exception will be thrown and caught? - OSError - Exception - FileNotFoundError - All of the above

FileNotFoundError

Code Example 3-1 num_widgets = 0 while True: choice = input("Would you like to buy a widget? (y/n): ") if choice.lower() == "y": num_widgets += 1 else: break print("You bought", num_widgets , "widget(s).") Refer to Code Example 3-1. If the user enters "no" at the prompt, what does the program print to the console? - You bought 1 widget(s) today. - You bought 0 widget(s) today. - Nothing, the break statement will cause the program to end - You bought no widget(s) today.

You bought 0 widget(s) today.

The following is an example of __________. #!/usr/bin/env python 3 - bytecode - a shebang line - source code - Java code

a shebang line

The goal of ___ is to fix all the errors in a program. - testing - debugging - editing - interpreting

debugging

Which of the following doesn't follow the best naming practices for variables? - firstName - first_name - pay_rate - pRate

pRate

In 2017 New Year's Day fell on a Sunday. What would the following code display? from datetime import datetime new_year = datetime(2017, 1, 1) day_of_week = new_year.strftime("New Year's Day is on a %A") print(new_year) print(day_of_week) - 2017-01-01 New Year's Day is on a Sunday - Nothing; this code would cause a ValueError - 2017-01-01 00:00:00 New Year's Day is on a Sunday - 1/1/2017 New Year's Day is on a Sunday

2017-01-01 00:00:00 New Year's Day is on a Sunday

How many times will "Hi again!" be displayed after the following code executes? for i in range(0, 12, 2): print("Hi, again!") - 2 - 5 - 6 - 12

6

A binary file is like a text file in all but one of the following ways. Which one is it? - The data in a binary file can be grouped into records or rows. - A binary file can be used to store a Python list. - A binary file stores strings with character notation. - A binary file stores numbers with binary notation.

A binary file stores numbers with binary notation.

To cancel the execution of a program in the catch clause of a try statement, you can use the ___. - exit() function of the sys module - cancel() function of the sys module - the built-in cancel() function - the built-in exit() function

exit() function of the sys module

Which of the following variable names uses camel case? - pay_rate - firstName - first_name - pRate

firstName

To insert the item "melon" after "grapes" in the following list, you would use which of these methods? fruit = ["apple", "banana", "grapes", "mangos", "oranges"] - fruit.append(3, "melon") - fruit.insert(3, "melon") - fruit.insert("melon", 3) - fruit.pop("melon", 3)

fruit.insert(3, "melon")

What line number of the following code contains an error and what type of error is it? 1. count = 1 2. while count <= 4: 3. print(count, end=" ") 4. i *= 1 5. print("\nThe loop has ended.") - line 5, logic error - line 2, syntax error - line 4, runtime error - line 3, syntax error

line 4, runtime error

What will the following print() function display? print("lions", "tigers", "bears", sep = ' & ', end = ' oh, my!!') - lions&tigers&bearsoh, my!! - lions, & tigers, & bears, oh, my!! - lions & tigers & bears oh, my!! - lions & tigers & bears & oh, my!!

lions & tigers & bears oh, my!!

The primary difference between a tuple and a list is that a tuple - is immutable - is indexed starting from 1 - has a limited range - is mutable

is immutable

The __________ method adds an item to the end of a list. - insert() - append() - index() - pop()

append()

Given the following 2-dimensional list of 3 rows and 3 columns, how would you write this list to a CSV file named prog.csv? programming = [["Python", "cop1000", 3], ["Java", "cop1020", 3], ["HTML5", "cop1040", 3]] - open("prog.csv", "w", newline ="") as csv_file: writer = csv.writer(file) writer.writerows(programming) - with open("programming.csv", "w", newline ="") as programming: writer = csv.writer(prog.csv) writer.writerows(programming) - with open("prog.csv", "w", newline ="") as file: writer = csv.writer(file) writer.writerows(programming) - with open("prog.csv", "w", newline ="") as programming: writer = csv.writer(programming) writer.writerows(prog.csv)

with open("prog.csv", "w", newline ="") as file: writer = csv.writer(file) writer.writerows(programming)

Code Example 7-2 import pickle def main(): courses = [["Python", 3], ["Trig", 3], ["Physics", 4], ["Yoga", 2]] with open("classes.bin", "wb") as file: pickle.dump(courses, file) with open("classes.bin", "rb") as file: course_list = pickle.load(file) i = 0 while i < len(course_list): course = course_list[i] print(course[0], str(course[1]), end=" ") i += 2 main() Refer to Code Example 7-2: What does the first with open statement do? - causes an exception if the file named courses.bin doesn't exist - writes the courses list to a binary file if the file named classes.bin doesn't exist Correct - causes an exception if the file named classes.bin doesn't exist - writes the courses list to a binary file if the file named courses.bin doesn't exist

writes the courses list to a binary file if the file named classes.bin doesn't exist

A Unicode character is represented by a ___. - 1-byte ASCII code - 2-character code - 2-digit code - 1-byte character code

2-digit code

What is the value of my_num after the following statement executes? my_num = (50 + 2 * 10 - 4) / 2 - 33 - 258 - 29 - 156

33

Given: x = 7 , y = 2 , z = 1.5 What is the value of new_num after the following statement executes? new_num = x / y + z - 3 - 5.0 - 4.5 - 2

5.0

Code Example 12-2 1. flowers = {"white": "lily", "red": "rose", "blue": "carnation", "yellow": "buttercup"} 2. colors = list(flowers.keys()) 3. colors.sort() 4. show_colors = "Colors of flowers: " 5. for color in colors: 6. show_colors += color + " " 7. print(show_colors) 8. pick_color = input("Enter a color: ") 9. pick_color = pick_color.lower() 10. if pick_color in flowers: 11. name = flowers[pick_color] 12. print("Flower name: " + name) 13. else: 14. print("There is no " + pick_color + " flower.") Refer to Code Example 12-2: What will the print statement on line 7 display? - Colors of flowers: lily rose carnation buttercup - Colors of flowers: buttercup carnation lily rose - Colors of flowers: blue red white yellow - Colors of flowers: white red blue yellow

Colors of flowers: blue red white yellow

If a program attempts to read from a file that does not exist, which of the following will catch that error? - NameError and OSError - FileNotFoundError and ValueError - FileNotFoundError and NameError - FileNotFoundError and OSError

FileNotFoundError and OSError

A programmer created this code for a client: def divide(numerator, denominator): quotient = numerator / denominator return quotient def main(): numerator = int(input("Enter the numerator: ")) denominator = int(input("Enter the denominator: ")) quotient = divide(numerator, denominator) print("The quotient is ", quotient) if __name__ == "__main__": main() The programmer tested this code with the following three sets of data: 1. numerator = 9, denominator = 3 2. numerator = -50, denominator = 5 3. numerator = 389, denominator = -26 The results were: 1. The quotient is 3.0 2. The quotient is -10.0 3. The quotient is -14.961538461538462 However, once the program was in use, the client reported that sometimes the program crashed. Can you explain why? - Programmer didn't round results to a specific number of decimal places. - Programmer didn't test for a 0 value in the denominator. - Programmer didn't account for a numerator that was larger than the denominator. - All three of the above would cause a crash.

Programmer didn't test for a 0 value in the denominator.

Which type of errors must be fixed before the program can be compiled? - exceptions - syntax errors - violations - logical errors

Syntax Errors

You can use the split() method to split a string into a list of strings based on a specified ___. - character - delimiter - punctuation mark - word

delimiter

Code Example 5-2 1. # This application displays a student's score after a 5-point curve 2. 3. def display_info(fname, lname, score): 4. print("Hello, " , fname, " " , Lname) 5. print("Your score on this exam is ", score) 6. score = score + 5 7. 8. def main(): 9. first = input("first name: ") 10. last = input("last name: ") 11. grade = input("exam score: ") 12. display_info(last, first, score) 13. 14. # if started as the main module, call the main function 15. if __name__ == "__main__": 16. main() Refer to Code Example 5-2: Assuming the coding errors have been fixed, what is the logic error in this program? - There is no logic error in this program. - The arguments are listed in the wrong order. - The display_info() function should be called before the input statements on lines 9-11. - The curve is calculated after the score has been displayed.

The curve is calculated after the score has been displayed.

Code Example 10-1 1. phone_number = input("Enter phone number: ").strip() 2. if len(phone_number) == 10: 3. phone_number = "(" + phone_number[:3] + ")" + phone_number[3:6] + "-" + phone_number[6:] 4. print("Phone number: ", phone_number) 5. else: 6. print("Phone number: ", "Phone number must be 10 digits") Refer to Code Example 10-1. If the user enters 555-123-4567 at the prompt, what will happen? - The hyphens will be ignored. - The length of the number will be greater than 10 so the else clause will execute. - Non-numeric characters will be ignored. - The strip() method on line 1 will strip away the extra characters..

The length of the number will be greater than 10 so the else clause will execute.

Code Example 7-1 import csv def main(): courses = [["Python", 3], ["Trig", 3], ["Physics", 4], ["Yoga", 2]] with open("courses.csv", "w", newline="") as file: writer = csv.writer(file) writer.writerows(courses) course_list = [] with open("courses.csv", newline="") as file: reader = csv.reader(file) for row in reader: course_list.append(row) for i in range(len(course_list) - 2): course = course_list[i] print(course[0] + " (" + str(course[1]) + ")") main() Refer to Code Example 7-1. If the first with open statement works, what is written to the file? - The list named courses. - The first column in the first row in the list named courses. - The first row in the list named courses. - The first list in the list named courses.

The list named courses.

Within the try clause of a try statement, you code ___. - only the statements that might cause an exception - all the statements of the program - a block of the statements that are most likely to cause an exception - a block of statements that might cause an exception

a block of statements that might cause an exception

To call a function, you code the function name and ___. - a set of parentheses - a set of parentheses that contains one or more arguments - a set of parentheses that contains zero or more arguments - a set of parentheses that contains a list of the local variables

a set of parentheses that contains zero or more arguments

When you subtract one datetime object from another, you get ___. - the number of seconds between the two times - the number of microseconds between the two times - a datetime object - a timedelta object

a timedelta object

A local variable is defined ___. - outside of all functions - inside a function - inside an if statement - inside the main() function

inside a function

A Python program should use try statements to handle ___. - only the exceptions related to file and database I/O - all exceptions that might be thrown by a program - all exceptions that can't be prevented by normal coding techniques - all the exceptions that aren't caused by coding errors

all exceptions that can't be prevented by normal coding techniques

Python comments ___. - are ignored by the compiler - can be used so certain lines of code are not executed during testing - can be used to document what a program or portion of code does - all of the above

all of the above

Using floating-point numbers can lead to arithmetic errors because floating-point numbers ___. - can't be used in expressions with integers - are approximate values - usually don't have enough significant digits - require the use of exponents

are approximate values

You can access the parts of a date/time object by using its ___. - attributes - methods - functions - properties

attributes

To jump to the end of the current loop, you can use the ___. - continue statement - end statement - switch statement - break statement

break statement

A return statement ___. - can only be used once in each function - can be used to return a local variable to the calling function - can be used to allow the function to modify the value of a global variable - must be coded within every function

can be used to return a local variable to the calling function.

To compare two datetime objects, you ___. - must use the equals(), greater(), and lesser() methods of the datetime objects - can use just the == and != comparison operators - subtract one from the other and evaluate the resulting timedelta object - can use any of the comparison operators

can use any of the comparison operators

It's a common practice to throw your own exceptions to test error handling routines that ___. - that handle complexities like lists within lists - handle many varieties of input - catch exceptions that are hard to produce otherwise - provide for many different types of exceptions

catch exceptions that are hard to produce otherwise

Code Example 5-1 1. count = 1 2. item_total = 0 3. item = 0 4. while count < 4: 5. item = int(input("Enter item cost: ")) 6. item_total += item 7. count += 1 8. average_cost = round(item_total / count) 9. print("Total cost:", item_total, "\nAverage cost:", average_cost) Refer to Code Example 5-1: If the user enters 5, 10, and 15 at the prompts, the output is: Total cost: 30 Average cost: 8 Which line should be changed to fix this logic error? - change line 6 to: item_total += item - 1 - change line 8 to: average_cost = round(item_total / (count - 1)) - change line 1 to: count = 0 - change line 4 to: while count <= 4:

change line 8 to: average_cost = round(item_total / (count - 1))

Which of the following functions randomly selects one item in a list? - shuffle() - lrandom() - randomitem() - choice()

choice()

To retrieve the fourth character in a string that's stored in a variable named city, you can use this code: - city(3) - city(4) - city[3] - city[4]

city[3]

To assign a default value to an argument when you define a function, you ___. - set the default value for the argument in the first line of code inside the function - code the name of the argument, the default operator (:), and the default value - code the name of the argument, the assignment operator (=), and the default value - code the default value instead of its name in the arguments list

code the name of the argument, the assignment operator (=), and the default value

To store just the year, month, and day for a date, you use a ___. - datedelta object - datetime object - either a date or a datetime object - date object

date object

To work with a file when you're using Python, you must do all but one of the following. Which one is it? - open the file - close the file - write data to or read data from the file - decode the data in the file

decode the data in the file

When you trace the execution of a program, you insert print() functions at key points in the program. It makes sense for these functions to do all but one of the following. Which one is it? - display the values of the global constants used by the function - display the values of the global variables used by the function - display the values of the local variables in the function - display the name of the function that the print() function is in

display the values of the global constants used by the function

Which of the following creates a Boolean variable? - flag = True or False - flag == "False" - if flag == True: - flag = True

flag = True

Which of the following data types would you use to store the number 25.62? - int - str - num - float

float

To define a variable named number that contains 123.4567 as a decimal number, not a floating-point number, which block of code would you use? - import decimal number = new Decimal(123.4567) - from decimal import Decimal number = Decimal(123.4567) - import decimal number = Decimal(123.4567) - from decimal import Decimal number = new Decimal(123.4567)

from decimal import Decimal number = Decimal(123.4567)

To read the rows in a CSV file, you need to ___. - get a reader object by using the reader() function of the file object - get a row object by using the row() function of the file object - get a reader object by using the reader() function of the csv module - get a rows object by using the rows() function of the file object

get a reader object by using the reader() function of the csv module

Code Example 12-3 pets = { "dog": {"type": "poodle", "color": "white"}, "cat": {"type": "Siamese", "color": "black and white"}, "bird": {"type": "parrot", "color": "green"} } pet = pets["dog"] pet = pets["bird"] print(pet["color"], pet["type"]) Refer to Code Example 12-3: What will display after the code executes? - parrot green - white poodle - green parrot - poodle white

green parrot

Before you can use a standard module like the random module, you need to ___. - import the module into its default namespace - import the module into a custom namespace - import the module into the global namespace - import the module

import the module

To test the functions of a module from the IDLE shell, you ___. - import the module and then call any function from the IDLE shell - run the module and then call any function from the IDLE shell - call any function in the module by using the default namespace - run the module with varying input values

import the module and then call any function from the IDLE shell

Code Example 4-1 def get_username(first, last): s = first + "." + last return s.lower() def main(): first_name = input("Enter your first name: ") last_name = input("Enter your last name: ") username = get_username(first_name, last_name) print("Your username is: " + username) if __name__ == "__main__": main() Refer to Code Example 4-1: If the user enters 'Lopez' for the first prompt in main() and 'Maria' for the second prompt, what will display? - maria.lopez - Maria.Lopez - Lopez.Maria - lopez.maria

lopez.maria

To compare two strings with mixed uppercase and lowercase letters, a programmer can first use the ___. - lower() method to convert all characters after the first character in each string to lowercase. - upper() method to convert all characters after the first character in each string to uppercase. - lower() method to convert all characters in each string to lowercase. - upper() method to convert the first character in each string to uppercase.

lower() method to convert all characters in each string to lowercase.

The data in ___ is lost when an application ends. - the CPU - disk storage - the application software - main memory

main memory

A file that contains reusable code is called a ___. - function - namespace - hierarchy chart - module

module

Given the following code, what is the value of my_name and what does the list consist of after the second statement is executed? names = ["Lizzy", "Mike", "Joel", "Anne", "Donny"] my_name = name.pop() - my_name = "Lizzy", names = ["Mike", "Joel", "Anne", "Donny"] - Error: must specify item number with the pop() method - my_name = "Donny", names = ["Lizzy", "Mike", "Joel", "Anne", "Donny"] - my_name = "Donny", names = ["Lizzy", "Mike", "Joel", "Anne"]

my_name = "Donny", names = ["Lizzy", "Mike", "Joel", "Anne"]

Which of the following is not an acceptable way to code a nested structure? - nest a for loop inside a while loop - nest an if statement inside a for loop - nest a while loop inside an elif clause - nest an else clause within an elif clause

nest an else clause within an elif clause

To create a datetime object for the current date and time, you can use the ___. - today() method of the date class - today() method of the datetime class - now() method of the datetime class - now() method of the date class

now() method of the datetime class

Which of the following would create a list named numbers consisting of 3 floating-point items? - numbers[3] = (5.3, 4.8, 6.7) - numbers = [0] * 3 - numbers[1] = 5.3 numbers[2] = 4.8 numbers[3] = 6.7 - numbers = [5.3, 4.8, 6.7]

numbers = [5.3, 4.8, 6.7]

If number equals .15605, which of the following will display it as: 16% - print("{:.0%}".format(number)) - print("{:d}".format(number)) - print("{:.2%}".format(number)) - print("{:.1%}".format(number))

print("{:.0%}".format(number))

If word = "a horse", which of the following snippets of Python code will display this result? a horse! a horse! My kingdom for a horse! - print((word * 2) + "! My kingdom for " + word + "!") - print(word * 2 + " My kingdom for " + word + "!") - print((word + "! " + " My kingdom for " + word + "!") * 2) - print((word + "! ") * 2 + " My kingdom for " + word + "!")

print((word + "! ") * 2 + " My kingdom for " + word + "!")

To throw an exception with Python code, you use the ___. - throw statement - raise statement - build-in raise() function - built-in throw() function

raise statement

Code Example 12-1 1. flowers = {"red": "rose", "white": "lily", "yellow": "buttercup"} 2. print(flowers) 3. flowers["blue"] = "carnation" 4. print(flowers) 5. print("This is a red flower:", flowers.get("red", "none")) 6. key = "white" 7. if key in flowers: 8. flower = flowers[key] 9. print("This is a", key, "flower:", flower) 10. key = "green" 11. if key in flowers: 12. flower = flowers[key] 13. del flowers[key] 14. print(flower + " was deleted") 15. else: 16. print("There is no " + key + " flower") Refer to Code Example 12-1: Which of the following represents a key/value pair for the dictionary named flowers defined on line 1? - yellow/flower - blue/carnation - lily/white - red/rose

red/rose

Code Example 9-2 number = float(input("Enter a number: ")) result1 = number * .15 result2 = result1 / 3 result3 = result1 + result2 print(result3) Refer to Code Example 9-2. To be sure that the results are accurate to 2 decimal places, you should ___. - round all three results to 2 decimal places - round just the result1 and result2 variables to 2 decimal places - round just the result that's displayed to 2 decimal places - round the result of each expression to 2 decimal places

round the result of each expression to 2 decimal places

Code Example 9-2 number = float(input("Enter a number: ")) result1 = number * .15 result2 = result1 / 3 result3 = result1 + result2 print(result3) Refer to Code Example 9-2. To be sure that the results are accurate to 2 decimal places, you should ___. - round the result of each expression to 2 decimal places - round just the result that's displayed to 2 decimal places - round all three results to 2 decimal places - round just the result1 and result2 variables to 2 decimal places

round the result of each expression to 2 decimal places

One of the ways to deal with the inaccuracies that may result from floating-point arithmetic operations is to ___. - round the results of all calculations - round the results of those calculations that may lead to more decimal places than you want in the final result - round the user entries to the right number of decimal places - round the results before you print or display them

round the results of those calculations that may lead to more decimal places than you want in the final result

The following is an example of ___. #!/usr/bin/env python 3 - source code - Java code - bytecode - a shebang line

shebang line

When two strings are compared, they are evaluated based on the ___ of the characters in the string. - alphabetical order - sort sequence - uppercase/lowercase sequence - string method

sort sequence

The following is an example of ___. print("Hello out there!") # get input name = input("Who are you?") print("Goodbye, " , name) - shebang line - bytecode - source code - Java code

source code

To create a datetime object by parsing a string, you can use the ___. - strptime() method of the datetime class - parse() method of the datetime class - strParse() method of the datetime class - strptime() method of the date class

strptime() method of the datetime class

Which type of error prevents a program from compiling and running? - syntax - runtime - exceptional - logic

syntax

To run a Python program from IDLE, you use: - IDLE's interactive shell - the command line - the F5 key - IDLE's editor

the F5 Key

Pseudocode can be used to plan ___. - the coding of control structures - the conditions for control statements - the modules used in a program - the functions used by a program

the coding of control structures

To work with dates, you need to import ___. - the date class from the date module - the date class from the datetime module - the date and datetime classes from the datetime module - the date, time, and datetime classes from the datetime module

the date class from the datetime module

The join() method of a list can be used to combine ___. - the items in the list into a string that's separated by delimiters - the items in the list into a string - two or more strings into a list - two or more lists

the items in the list into a string that's separated by delimiters

To read a list of lists that's stored in a binary file, you use ___. - the load() method of the binary module - the load() method of the pickle module - the read() method of the pickle module - the read() method of the binary module

the load() method of the pickle module

A naive datetime object doesn't account for ___. - daylight savings time - international date formatting - time zones - time zones and daylight savings time

time zones and daylight savings time

The isdigit() method of a string returns ___. - true if the string contains only digits and a decimal point - the string if it only contains digits - true if the string contains only digits - the digits that are in the string

true if the string contains only digits

Which of the following is the correct way to code a try statement that catches any type of exception that can occur in the try clause? - try: number = float(input("Enter a number: ")) print("Your number is: ", number) - try: number = float(input("Enter a number: ")) print("Your number is: ", number) except: print("Invalid number.") - try: number = float(input("Enter a number: ")) print("Your number is: ", number) else: print("Invalid number.") - try: number = float(input("Enter a number: ")) print("Your number is: ", number) except ValueError: print("Invalid number.")

try: number = float(input("Enter a number: ")) print("Your number is: ", number) except: print("Invalid number.")

To avoid a KeyError when using the pop() method of a dictionary, you can ___. - use the optional second argument to supply a default value - use the optional second argument to supply the correct key - use the exists keyword to check whether the key exists before you call the pop() method - use the del keyword to check whether the pop() method can delete the key without a KeyError

use the optional second argument to supply a default value

A console application runs ___. - with a GUI - through another application - through a browser - via a command prompt

via a command prompt

The items() method returns a ___. - view object containing all of the values in a dictionary - list object containing all of the values in a dictionary - view object containing all of the key/value pairs in a dictionary - list object containing all of the key/value pairs in a dictionary

view object containing all of the key/value pairs in a dictionary

The keys() method returns a ___. - list object containing all of the key/value pairs in a dictionary - list object containing all of the keys in a dictionary - view object containing all of the key/value pairs in a dictionary - view object containing all of the keys in a dictionary

view object containing all of the keys in a dictionary

The keys() method returns a ___. - view object containing all of the key/value pairs in a dictionary - list object containing all of the keys in a dictionary - view object containing all of the keys in a dictionary - list object containing all of the key/value pairs in a dictionary

view object containing all of the keys in a dictionary

When the IDLE debugger reaches a breakpoint, you can do all but one of the following. Which one is it? - view the values of all the variables that you've stepped through - run the program until the next breakpoint is reached - view the values of the local variables that are in scope - step through the program one statement at a time

view the values of all the variables that you've stepped through

Given the tuple that follows, which of the following assigns the values in the tuple to variables? numbers = (22, 33, 44, 55) - w, x, y, z = numbers - w = numbers x = numbers y = numbers z = numbers - w, x, y, z = numbers.unpack() - for item in numbers: item[i] = numbers[i]

w, x, y, z = numbers


Kaugnay na mga set ng pag-aaral

EC3 Uni 1 ASD 1-3 español a inglés

View Set

Unit 3: Forces and Newton's Laws

View Set

ATI Pedi Book Ch 23 More GI disorders

View Set

Sociální psychologie pro pedagogy: Sociální kognice - sociální vnímání, postoje, kognitivní disonance, spotlight efekt

View Set