Answered You can buy a ready-made answer or pick a professional tutor to order an original one.

QUESTION

Quiz: 20 minutes 1) Which of the following for loops will add 1 to all the elements in the array numbers, assuming numbers has already been assigned a collection of numeric values? a- for i in range(l

Quiz: 20 minutes

1) Which of the following for loops will add 1 to all the elements in the array numbers, assuming numbers has already been assigned a collection of numeric values?

a- for i in range(len(numbers)):    numbers = numbers + 1

b- or i in range(numbers):    numbers[i] = numbers[i] + 1

c- for i in range(numbers):    numbers = numbers + 1

d- for i in range(len(numbers)):    numbers[i] = numbers[i] + 1

2) Which of the following is the correct output from this sequence of statements?

numbers = [1, 2, [3, 4], [5, 6], 7, 8]print(len(numbers))

a- 5

b- 8

c- 7

d- 6

3) Which of the following is the correct output from this sequence of statements?

numbers = [18, 27, 42, 13, 21, 8, 11]print(len(numbers))

a- 140

b- 8

c- 42

d- 7

4) Which of the following is the correct output from the following program?

sequence = [1, 4, 7, 10, 13]for i in range(len(sequence)):    if i > 2:         sequence[i] = sequence[i] - sequence[i-2]print(sequence)

a- [1, 4, 6, 6, 6]

b- [1, 4, 7, 6, 6]

c- [1, 4, 7, 10, 13]

d- [1, 4, 7, 10, 6]

5) Which of the following programs will output [1, 2, 3, 4, 5]?

a- numbers = [1, 3, 5]numbers.append([2, 4])numbers.sort()print(numbers)

b- numbers = [1, 3, 5]numbers.extend([2, 4])print(numbers.sort())

c- numbers = [1, 3, 5]numbers.extend([2, 4])numbers.sort()print(numbers)

d- numbers = [1, 3, 5]numbers.sort()numbers.append(2)numbers.append(4)print(numbers)

6) Which of the following is the correct output from this sequence of statements?

numbers = [1, 2, 3, 4, 5, 6, 7]first = numbers.pop()numbers.remove(4)del numbers[0]print(numbers)

a- [3, 5, 6, 7]

b- [5, 6]

c- [2, 3, 4, 6]

d- [2, 3, 5, 6]

7) Which of the following is the correct output from this sequence of statements?

letters = ['a', 'b', 'c']letters.extend(['A', 'B', 'C'])letters.sort()print(letters)

a- ['A', 'a', 'B', 'b', 'C', 'c']

b- ['a', 'A', 'b', 'B', 'c', 'C']

c- ['a', 'b', 'c', 'A', 'B', 'C']

d- ['A', 'B', 'C', 'a', 'b', 'c']

8) Which of the following is the correct output from this sequence of statements?

array1 = [1, 2, 3]array2 = [2, 3]print(array1 + array2 * 2)

a- [1, 2, 3, 2, 3, 1, 2, 3, 2, 3]

b- [1, 2, 3, 2, 3, 2, 3]

c- [1, 2, 3]

d- [1, 2, 3, 2, 3]

9) Which of the following is the correct output from this sequence of statements?

numbers = [1, 2, 3, 4, 5]numbers[2:4] = [4, 3]print(numbers[1:3])

a- [2, 3]

b- [2, 3, 4]

c- [2, 4]

d- [2, 4, 3]

10) Which of the following is the correct output from the following sequence of statements?

mixture = [3.14159, 'pi', [3, .14159], 'irrational']mixture[-2] = 'subarray'print(mixture[4])

a- subarray

b- It generates an IndexError

c- 3 .14159

d- irrational

Show more
  • @
  • 1198 orders completed
ANSWER

Tutor has posted answer for $10.00. See answer's preview

$10.00

****** ********

Click here to download attached files: Computer Science Python Quiz.docx
or Buy custom answer
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question