Programming Fundamentals I Exam 3

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

True/False: Invalid indexes do not cause slicing expression to raise an exception

True

True/False: List are dynamic data structures such that items may be added to them or removed from them

True

True/False: The index: -1 identifies the last element in a list

True

True/False: in slicing, if the end index specifies a position beyond the end of the list, Python will use the length of the list instead

True

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

[0, 2, 4, 6, 8]

What would be the value of the variable list after the execution of the following code? list =[1,2] list = list*3

[1, 2, 1, 2, 1, 2]

What would be the value of the variable list after the execution of the following code? list = [1, 2, 3, 4] list[3] = 10

[1, 2, 3, 10]

What are the data items in the list called?

elements

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

false

What method can be used to place an item in the list at a specific index?

insert()

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

list()

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]

list2 = [1,2,3]

When working with multiple sets of data, one would typically use a_____________.

nested list

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

once a tuple is created, it cannot be change

True/False: The first step in calculating the average of the values in a list is to get the total of the values.

true

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

tuple()

What would you use if an element is to be removed from a specif index?

'del' statement

What method or operator can be used to concatenate lists?

+(plus sign)

What is the first negative index in a list?

-1

True/False: A list cannot be passed as an argument to a function

False

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

False

True/False: The remove method removes all occurrences of the item from a list.

False

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

False

What is the advantage of using tuples over lists?

Processing a tuple is faster than processing a list


Kaugnay na mga set ng pag-aaral

CULTURA SPANISH MIDTERM, spanish midterm

View Set

MA RMV Practice Test 2 (my copy of notes)

View Set

Adult Medical Surgical Practice A

View Set

AP Euro Project Quarter 3 Quizlet #1

View Set

BIBL 104-Quiz: The Old Testament Books of Prophecy

View Set

Prep U: Chapter 24: Assessing Musculoskeletal System

View Set