Exam 5: Lists and Dictionaries

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What list method should you use in order to remove and return the element at the end of the list named "books"?

Free
(Multiple Choice)
4.8/5
(43)
Correct Answer:
Verified

B

You add a new key/value pair to a dictionary by using the subscript operator [].

Free
(True/False)
4.8/5
(40)
Correct Answer:
Verified

True

You are designing a script that may be imported as a module in other scripts. What variable can you use to check whether the script has been imported as a module, or is running as the main script?

Free
(Multiple Choice)
4.8/5
(43)
Correct Answer:
Verified

B

The main function usually expects no arguments and returns no value.

(True/False)
4.8/5
(38)

You are creating a Python script that will make use of user input contact names and their associated phone numbers. What would be ideal for storing and accessing these associated values?

(Multiple Choice)
4.8/5
(32)

What is the return value for a function that has no return statement defined?

(Multiple Choice)
4.8/5
(40)

The index of the first item in a list is 1.

(True/False)
4.7/5
(41)

What statement accurately describes what a mutator is in the Python language?

(Multiple Choice)
4.8/5
(40)

In computer science, what are two names that are used to describe data structures organized by association? (Choose two.)

(Multiple Choice)
4.7/5
(29)

What statement accurately describes the use of a parameter in Python?

(Multiple Choice)
4.9/5
(37)

Anytime you foresee using a list whose structure will not change, you can, and should, use a tuple instead.

(True/False)
4.8/5
(36)

If pop is used with just one argument and this key is absent from the dictionary, Python raises an error.

(True/False)
4.9/5
(32)

When creating a list of items whose structure will not change, what should you ideally use to contain the values?

(Multiple Choice)
4.9/5
(36)

What operator should you utilize if you wish to test for object identity between two objects?

(Multiple Choice)
4.9/5
(37)

What statement accurately describes the difference between a list and a tuple?

(Multiple Choice)
4.9/5
(38)

Lists of integers can be built using the range function.

(True/False)
4.8/5
(34)

What dictionary operation can you use to remove all the keys within the dictionary named contacts?

(Multiple Choice)
4.9/5
(43)

The == operator returns True if the variables are aliases for the same object. Unfortunately, == returns False if the contents of two different objects are the same.

(True/False)
4.9/5
(36)

What method should you utilize to add the elements of list2 onto the end of list1?

(Multiple Choice)
4.9/5
(36)

What statement regarding the use of lists is accurate?

(Multiple Choice)
4.9/5
(36)
Showing 1 - 20 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)