Filters
Question type

Study Flashcards

Arrays,which are allowed by most other programming languages,have more capabilities than Python list structures.

Correct Answer

verifed

verified

Lists are ___________,which means their elements can be changed in a program.

Correct Answer

verifed

verified

mutable

Which of the following would you use if an element is to be removed from a specific index?


A) a del statement
B) a remove method
C) an index method
D) a slice method

Correct Answer

verifed

verified

The index of the first element in a list is 1,the index of the second element is 2,and so forth.

Correct Answer

verifed

verified

The ___________ function can be used to convert a list to a tuple.

Correct Answer

verifed

verified

The __________ exception is raised when a search item is not in the list being searched.

Correct Answer

verifed

verified

Which method can be used to convert a tuple to a list?


A) append
B) tuple
C) insert
D) list

Correct Answer

verifed

verified

The remove method removes all occurrences of an item from a list.

Correct Answer

verifed

verified

The primary difference between a tuple and a list is that


A) you don't use commas to separate elements in a tuple
B) a tuple can only include string elements
C) a tuple cannot include lists as elements
D) once a tuple is created, it cannot be changed

Correct Answer

verifed

verified

The index -1 identifies the last element in a list.

Correct Answer

verifed

verified

The __________ method is commonly used to add items to a list.

Correct Answer

verifed

verified

In order to create graphs using the matplotlib package,you need to import the pyplot module.

Correct Answer

verifed

verified

The built-in function __________ returns the length of a sequence.

Correct Answer

verifed

verified

Invalid indexes do not cause slicing expressions to raise an exception.

Correct Answer

verifed

verified

True

What will be the value of the variable list2 after the following code executes? What will be the value of the variable list2 after the following code executes?   A)  [1, 2, 3] B)  [4, 5, 6] C)  [1, 2, 3, 4, 5, 6] D)  Nothing; this code is invalid


A) [1, 2, 3]
B) [4, 5, 6]
C) [1, 2, 3, 4, 5, 6]
D) Nothing; this code is invalid

Correct Answer

verifed

verified

Which method can be used to convert a list to a tuple?


A) append
B) tuple
C) insert
D) list

Correct Answer

verifed

verified

What is an advantage of using a tuple rather than a list?


A) Tuples are not limited in size.
B) Tuples can include any data as an element.
C) Processing a tuple is faster than processing a list.
D) There is never an advantage to using a tuple.

Correct Answer

verifed

verified

Which list will be referenced by the variable number after the following code is executed? Number = range(0,9,2)


A) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
B) [1, 3, 5, 7, 9]
C) [2, 4, 6, 8]
D) [0, 2, 4, 6, 8]

Correct Answer

verifed

verified

What will be the output after the following code is executed? What will be the output after the following code is executed?   A)  It will display a simple line graph. B)  It will display a simple bar graph. C)  Nothing; plt is not a Python method. D)  Nothing; the number of x-coordinates do not match the number of y-coordinates.


A) It will display a simple line graph.
B) It will display a simple bar graph.
C) Nothing; plt is not a Python method.
D) Nothing; the number of x-coordinates do not match the number of y-coordinates.

Correct Answer

verifed

verified

D

A(n)__________ is an object that holds multiple items of data.

Correct Answer

verifed

verified

Showing 1 - 20 of 40

Related Exams

Show Answer