Exam 5: Lists and Dictionaries

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

When replacing an element in a list, the subscript is used to reference the target of the assignment statement, which is not the list but an element's position within it.

(True/False)
4.7/5
(34)

If you use the range method with a single parameter of 50, what will be the range of integers included in the returned list?

(Multiple Choice)
5.0/5
(36)

An Identity function usually tests its argument for the presence or absence of some property.

(True/False)
4.8/5
(36)

What dictionary method can be utilized to access the entries in a dictionary variable with a name of parts?

(Multiple Choice)
4.7/5
(40)

What happens if you attempt to pop a key from a dictionary and the key does not exist, and you specified no default return?

(Multiple Choice)
4.9/5
(36)

What are the two arguments expected by the get method for a dictionary object? (Choose two.)

(Multiple Choice)
4.9/5
(37)

In order to create a docstring for a defined function, where should the docstring be?

(Multiple Choice)
4.7/5
(33)

The definition of the main function and the other function definitions can appear in no particular order in the script, as long as main is called at the very end of the script.

(True/False)
4.9/5
(33)

The index of the last item in a list is the length of the list.

(True/False)
4.8/5
(40)

Although a list's elements are always ordered by position, it is possible to impose a natural ordering on them as well.

(True/False)
4.8/5
(34)

Each item in a list has a unique index that specifies its position.

(True/False)
4.7/5
(33)

Which of the following assigns a dictionary list of keys and values to the variable named persons?

(Multiple Choice)
4.8/5
(37)

In scripts that include the definitions of several cooperating functions, it is often useful to define a special function named init that serves as the entry point for the script.

(True/False)
4.9/5
(35)

The list method ascending mutates a list by arranging its elements in ascending order.

(True/False)
4.9/5
(40)

When a Python script is running as a standalone program, what will the __name__ variable be set to?

(Multiple Choice)
4.9/5
(38)

To prevent aliasing, a new object can be created and the contents of the original can be copied to it.

(True/False)
4.9/5
(27)

In a Python dictionary, an association is formed between what two components of the dictionary? (Choose two.)

(Multiple Choice)
4.8/5
(39)

What happens if you use the following statement to sort a list of numbers called numbers? numbers = numbers.sort()

(Multiple Choice)
4.8/5
(40)

A list is a sequence of data values called indexes.

(True/False)
4.8/5
(31)

In a dictionary, a -> separates a key and its value.

(True/False)
4.8/5
(30)
Showing 21 - 40 of 50
close modal

Filters

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