Filters
Question type

Study Flashcards

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


A) A parameter is the name used in the function definition for an argument that is passed to the function when it is called.
B) A parameter is the name used for a function that is then referenced by other parts of the program.
C) A parameter is the name used for data that is returned from the execution of a function.
D) A parameter is the name given to an acceptable range of values that are output from a program.

E) A) and C)
F) A) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) contacts.delete()
B) contacts.remove()
C) contacts.clear()
D) contacts.dump()

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

What statement regarding the use of lists is accurate?


A) The individual elements within a list are immutable, in that the values cannot be changed.
B) Two lists cannot be concatenated together, without the creation of a third list.
C) A list can be sliced into sublists.
D) When a list is evaluated, the elements are not evaluated.

E) C) and D)
F) B) and C)

Correct Answer

verifed

verified

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.

A) True
B) False

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

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


A) list1.extend(list2)
B) list1.append(list2)
C) list2.append(list1)
D) list2.extend(list1)

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Lists of integers can be built using the range function.

A) True
B) False

Correct Answer

verifed

verified

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


A) A list is immutable, while a tuple is not.
B) A list is created with elements in parentheses, while a tuple is created with square brackets.
C) A tuple's contents cannot be changed.
D) A tuple can only hold integer and float data.

E) C) and D)
F) None of the above

Correct Answer

verifed

verified

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?


A) __parent__
B) __name__
C) __operating_mode__
D) __status__

E) B) and D)
F) C) and D)

Correct Answer

verifed

verified

B

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


A) ==
B) is
C) !=
D) @!

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

True

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

A) True
B) False

Correct Answer

verifed

verified

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


A) lists
B) tuples
C) dictionaries
D) strings

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

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


A) books.get()
B) books.pop()
C) books.fetch()
D) books.pull()

E) All of the above
F) A) and C)

Correct Answer

verifed

verified

B

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


A) The function will return a value of False.
B) The function will return a value of True, provided there are no errors.
C) The function will return a NULL value.
D) The function will return a special value of None.

E) B) and C)
F) A) and C)

Correct Answer

verifed

verified

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


A) A mutator is a method that converts immutable data into mutable data.
B) A mutator is a method used to encrypt text.
C) A mutator is a method that is devoted entirely to the modification of the internal state of an object.
D) A mutator is a method that changes the structure of a block of Python code.

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

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


A) matrices
B) tables
C) association lists
D) family trees

E) B) and D)
F) A) and D)

Correct Answer

verifed

verified

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?


A) lists
B) tuples
C) dictionaries
D) strings

E) C) and D)
F) B) and C)

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer