Search Header Logo

Python - List and Tuples

Authored by Sreelekshmi S

Computers

11th - 12th Grade

Used 264+ times

Python - List and Tuples
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following piece of code when executed in Python shell?


>>> a=("Check")*3

>>> a



(‘Check’,’Check’,’Check’)

* Operator not valid for tuples

(‘CheckCheckCheck’)

Syntax error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Is the following piece of code valid?


>>> a=(1,2,3,4)

>>> del a

No because tuple is immutable

Yes, the entire tuple is deleted

No, invalid syntax for del method

Yes, first element in the tuple is deleted

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What type of data is: a=[(1,1),(2,4),(3,9)]?

Array of tuples

List of tuples

Tuples of lists

Invalid type

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is true for a tuple?

Tup = 1,2,3

Tup = (""1,"2)

Tup = (1,2,3,4)

None of the above

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Result of the program above is

('1', '2', '3', '4', '5')

(1, 2, 3, 4, 5)

12345

"12345"

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose you have the following tuple definition:


t = ('foo', 'bar', 'baz')


Which of the following statements replaces the second element ('bar') with the string 'qux':

t[1] = 'qux'

t(1) = 'qux'

t[1:1] = 'qux'

error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If list=[17,23,41,10] then list.append(32) will result

[32,17,23,41,10]

[17,23,41,10,32]

[10,17,23,32,41]

[41,32,23,17,10]

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?