Exam 7: Lists and Tuples

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

What would be the value of the variable list2 after the execution of the following code? List1 = [1, 2, 3] List2 = [] For element in list1 List2.append(element) List1 = [4, 5, 6]

Free
(Multiple Choice)
4.9/5
(35)
Correct Answer:
Verified

A

Arrays, which most other programming languages allow, have much more capabilities than list structures.

Free
(True/False)
4.9/5
(35)
Correct Answer:
Verified

False

What would be the value of the variable list2 after the execution of the following code? List1 = [1, 2, 3] List2 = list1 List1 = [4, 5, 6]

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

B

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

(Multiple Choice)
4.8/5
(42)

Indexing starts at 1, so the index of the first element is 1, the index of the second element is 2, and so forth.

(True/False)
4.8/5
(41)

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

(Short Answer)
4.9/5
(32)

Each element in a tuple has a(n) _______________ that specifies its position in the tuple.

(Short Answer)
4.9/5
(30)

What is the advantage of using tuples over lists?

(Multiple Choice)
4.9/5
(40)

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

(True/False)
4.8/5
(36)

Tuples are _______________ sequences, which means that once a tuple is created, it cannot be changed.

(Short Answer)
4.8/5
(43)

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

(True/False)
4.9/5
(38)

The sort method rearranges the elements of a list so they appear in ascending or descending order.

(True/False)
4.9/5
(34)

A list cannot be passed as an argument to a function.

(True/False)
4.9/5
(33)

The primary difference between a tuple and list is that _____.

(Multiple Choice)
4.9/5
(35)

What are the data items in the list called?

(Multiple Choice)
4.9/5
(30)

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

(Multiple Choice)
4.9/5
(46)

What is the first negative index in a list?

(Multiple Choice)
4.8/5
(40)

When working with multiple sets of data, one would typically use a(n) _____.

(Multiple Choice)
4.7/5
(40)

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

(Multiple Choice)
4.9/5
(32)

Lists are _______________, which means their elements can be changed.

(Short Answer)
4.9/5
(43)
Showing 1 - 20 of 35
close modal

Filters

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