Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 A tuple is mutable (its contents can be modified). True False QUESTION 2 A list can contain any type of object. True False

QUESTION 1

A tuple is mutable (its contents can be modified).

True

False

QUESTION 2

A list can contain any type of object.

True

False

QUESTION 3

What data structure is this?

x = []

A.

Dictionary

B.

List

C.

String

D.

Tuple

QUESTION 4

What is the output of this code?

x = [0, 1, 2] print(x[3])

A.

0

B.

1

C.

2

D.

An error is thrown

QUESTION 5

How would you use bracket notation to access the element 'cat' in this code?

x = [0, ['cat', 'dog'], 2]

A.

x[2, 1]

B.

x[1, 0]

C.

x[2][0]

D.

x[1][0]

QUESTION 6

What is the output of this code?

x = [0, 1, 2] x[1] = 'hello' print(x)

A.

hello

B.

['hello', 1, 2]

C.

[0, 'hello', 2]

D.

An error is thrown.

QUESTION 7

What is the output of this code?

x = [0, ['cat', 'dog'], 2] print(len(x))

A.

3

B.

4

C.

5

D.

An error is thrown.

QUESTION 8

What is the output of this code?

x = [0, 1, 2] x = x*2 print(x)

A.

[0, 1, 2]

B.

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

C.

[0, 2, 4]

D.

An error is thrown

QUESTION 9

What is the output of this code?

x = ['cat', 'dog', 'fish'] print('cat' in x)

A.

0

B.

cat

C.

True

D.

False

E.

An error is thrown.

QUESTION 10

What is the output of this code?

x = ['cat', 'dog', 'fish'] print(x[1:])

A.

cat

B.

['dog']

C.

['dog', 'fish']

D.

dog

E.

An error is thrown

QUESTION 11

What is the output of this code?

x = ['fish', 'cat', 'dog'] x.pop(1) print(x)

A.

['fish', 'dog']

B.

['cat', 'dog']

C.

['fish', 'cat', 'dog']

D.

['fish', 'cat', 'dog', 'cat']

E.

An error is thrown

QUESTION 12

What is the output of this code?

x = ['fish', 'cat', 'dog'] del x[1] print(x)

A.

['fish', 'dog']

B.

['cat', 'dog']

C.

cat

D.

None

E.

An error is thrown

QUESTION 13

What is the output of this code?

a = [0, 1, 2] x = a x[0] = 3 print(a)

A.

[0, 1, 2]

B.

[3, 1, 2]

C.

x

D.

An error is thrown

QUESTION 14

What is the output of this code?

m = ['Fred', 'Weasley'] x, y = m print(x)

A.

Fred Weasley

B.

Fred

C.

Weasley

D.

An error is thrown

QUESTION 15

What is the output of this code?

x = list(range(4))

print(x)

A.

[0, 1, 2, 3, 4]

B.

[0, 1, 2, 3]

C.

(0, 1, 2, 3, 4)

D.

(0, 1, 2, 3)

E.

An error is thrown.

QUESTION 16

What is the output of this code?

a = [a, 0, z, 1] x = sorted(a)

print(x)

A.

[0, 1, a, z]

B.

[a, 0, 1, z]

C.

[a, z, 0, 1]

D.

[0, a, z, 1]

E.

An error is thrown

QUESTION 17

What is the output of this code?

a = [a, 0, z, 1] a.append([1,0])

print(a)

A.

[a, 0, z, 1, 1, 0]

B.

[1, 0, a, 0, z, 1]

C.

[[1, 0], a, 0, z, 1, [1, 0]]

D.

[a, 0, z, 1, [1, 0]]

E.

An error is thrown.

QUESTION 18

What is the output of this code?

m = ('Fred', 'Weasley') x, y = m print(x)

Fred Weasley

Fred

Weasley

An error is thrown

QUESTION 19

What is the output of this code?

m = ('Fred', 'Weasley') x = m.append('Whilma')

print(x)

A.

('Fred', 'Weasley', 'Whilma')

B.

('Fred', 'Weasley')

C.

('Whilma', 'Fred', 'Weasley')

D.

An error is thrown

QUESTION 20

Which range function results in this sequence?

3 2 1

A.

range(1, 3, -1)

B.

range(3, 1, -1)

C.

range(0, 3, -1)

D.

range(3, 0, -1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Prepare for a successful job interview.

Answered: 1 week ago

Question

Describe barriers to effective listening.

Answered: 1 week ago

Question

List the guidelines for effective listening.

Answered: 1 week ago