wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Week 14 - Tuples

Total questions: 42

Worksheet time: 31mins

Name
Class
Date
1.

Mia, Ava, and Mason are having a debate about Python data structures. Mia says both lists and tuples are mutable, Ava thinks lists are mutable whereas tuples are immutable, and Mason believes both lists and tuples are immutable. Who is correct?

a)

Mia: List and tuples both are mutable.

b)

Ava: List is mutable whereas tuples are immutable.

c)

Mason: List and tuples both are immutable.

d)

None of them: List is immutable whereas tuples are mutable

2.

Zoe, Arjun, and Evelyn are on a treasure hunt. They found a mysterious note with a tuple c = ((7,5),(5,8),(0,-1),(4,3)). If the number 3 is the clue to the next location, how would they refer to it in the tuple?

a)

c[0][0]

b)

c(3)

c)

c[8]

d)

c[3][1]

3.

Luna, Noah, and Evelyn are playing a game of Python trivia. Luna creates an empty tuple: y = (). Evelyn, can you tell us what is the index of this tuple?

a)

0

b)

1

c)

There is none. It is an empty tuple

4.

Anika, Nora, and Mia are having a debate. Anika says you can have an empty tuple z = () and an empty string w = []. Nora and Mia are not sure. Who is correct?

a)

Anika

b)

Nora and Mia

5.

Aria, Aiden, and Isla are playing a game of 'Python Trivia'. Aiden asks, 'Given a = "Hello world", what does list(a) do in Python?' Can you help them answer?

a)

It creates a list where each word (separated by white spaces) is an item

b)

It creates a list where each character is an item

c)

It does nothing

d)

It creates a blank list named a

6.

Liam, Lily, and Benjamin are having a debate. Liam thinks you can have lists inside of tuples and vice versa, but Lily and Benjamin aren't so sure. Who do you think is correct?

a)

Liam

b)

Lily and Benjamin

7.

Imagine Kai, Lily, and Rohan are playing a game of Python trivia. Kai comes up with a tricky question:

He defines a tuple as follows:

t = ('They', 'bar', 'have', 'a', 'pepper')

He then asks, 'Which of the following Python statements would replace the second element ('bar') with the string 'quiznos'?

a)

t[1] = 'quiznos'

b)

t(1) = 'quiznos'

c)

t[1:1] = 'quiznos'

d)

It's a trick question—tuples can't be modified.

8.

David, Ethan, and Mason are having a friendly competition to see who can count the number of elements in a list the fastest. Which function should they use to win the competition?

a)

count( )

b)

find( )

c)

len( )

d)

index( )

9.

Sophia, Ava, and Noah are having a friendly debate about Python. They made several statements, but one of them is NOT correct. Can you spot it?

a)

Sophia said: 'A list is mutable.'

b)

Ava claimed: 'A tuple is immutable.'

c)

Noah mentioned: 'The append function is used to add an element.'

d)

Sophia argued: 'The extend function adds an element to a tuple.'

10.

Maya, Kai, and Luna are playing a game of 'Guess the Data Type!'. Maya shows them a data structure: a=[(1,1),(2,4),(3,9)]. Can you help Kai and Luna guess what type of data this is?

a)

Array of tuples

b)

List of tuples

c)

Tuples of lists

d)

Invalid type

11.

Sophia, Aiden, and Abigail are playing a game of 'Guess the Output'. They are trying to figure out the result of a certain program. Can you help them out?

a)

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

b)

(1, 2, 3, 4, 5)

c)

12345

d)

"12345"

12.

Nora, Michael, and Avery are playing a game of Python trivia. Nora says, 'If T=("A"), then what is the type of A?' Can you help them answer?

a)

tuple

b)

string

c)

int

d)

list

13.

Mia, Isla, and Arjun are having a friendly coding competition. They are trying to figure out how to create a single element tuple in Python. Can you help them out?

a)

(1,)

b)

(1)

c)

{1}

d)

[1]

e)

tuple([1])

14.

Isla, Aria, and Emma are having a friendly coding competition. They stumbled upon a program and are trying to figure out its output. Can you help them? What is the output of the program they are looking at?

a)

<class 'tuple'>

b)

<class 'None'>

c)

<class 'list'>

d)

<class 'int'>

15.

Imagine Daniel, Oliver, and Abigail are working on a Python project together. Daniel writes the following piece of code:


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

Then, Oliver tries to delete 'a' using the following command:

>>> del a

Abigail is unsure if this is valid. What do you think?

a)

No, because a tuple is immutable and cannot be deleted

b)

Yes, the entire tuple 'a' will be deleted

c)

No, this is an invalid syntax for the del method

d)

Yes, but only the first element in the tuple 'a' will be deleted

16.

1. Nora, Scarlett, and Harper are having a debate. They are discussing a certain data type in Python that consists of a number of values separated by a comma and enclosed within parentheses. Can you help them identify it?

a)

Lists

b)

Tuples

c)

Set

d)

Dictionary

17.

Ethan, Isla, and Grace are on a treasure hunt. They found a mysterious note that says, 'The elements of a secret code are enclosed by ________.' They need your help to solve this. What do you think the answer is?

a)

array bracket

b)

square brackets

c)

parenthesis

d)

Curly brace

18.

3. Imagine Luna, Benjamin, and Rohan are playing a game of Python trivia. Luna asks, 'Which function would you use to create Tuples from a list?' What would your answer be?

a)

tuple

b)

set()

c)

list()

d)

tuple( )

19.

7. Samuel, Maya, and Isla are playing a game of 'Tuple Tower'. In this game, when they stack a tuple inside another tuple, each tuple is considered as a separate what?

a)

element

b)

variable

c)

parameter

d)

none of these

20.

10. James and Arjun are having a friendly coding competition. They are trying to delete an entire tuple. Which command should they use to achieve this?

a)

remove

b)

delete

c)

del

d)

erase

21.

Abigail, Ethan, and Michael are playing a game of 'Symbol Masters'. In their game, the symbol + in a string means what?

a)

It's a secret code for addition

b)

It's a magic spell to swap places

c)

It's a special move for concatenation

d)

It's a power booster for multiplication

22.

Elijah, Ava, and Anika are playing a game of 'Python Trivia'. Elijah asks, 'A tuple in Python looks like a list, but what do we use instead of square brackets?'

a)

parentheses

b)

square brackets

c)

curly braces

23.

Mia, Kai, and Anika are having a friendly competition to see who knows the most about Python tuples. They are discussing which methods cannot be used with tuples. Can you help them out?

a)

append()

b)

len()

c)

insert()

d)

remove()

24.

Arjun, Abigail, and Rohan are having a friendly competition to see who knows Python the best! They're currently discussing tuples. Can you help them figure out which methods cannot be used with tuples?

a)

pop()

b)

max()

c)

min()

d)

sort()

25.

Olivia, Harper, and Lily are having a friendly competition to see who knows Python the best! They stumbled upon a question about tuples. Can you help them figure out which method cannot be used with tuples?

a)

sum()

b)

sorted()

c)

reverse()

d)

count()

26.

Priya, Aria, and Kai are having a friendly competition to see who can come up with the most functions that can be used with both lists and tuples. Can you help them out?

a)

len()

b)

append()

c)

sorted()

d)

sort()

27.

Imagine Abigail, Jackson, and William are creating a magical spell in their Python wizardry class. The spell requires them to create a tuple with a single element. Do they need to add a comma (,) after the single element?

a)

Yes, they do

b)

No, they don't

28.

Aria and David are having a friendly debate. Aria says that 'T = tuple(L)' will convert a list into a tuple. David is not so sure. Who do you think is correct?

a)

Aria

b)

David

29.

Aria, Arjun, and Ava are having a friendly debate about Python string formatters. They are trying to figure out what curly braces {} are known as. Can you help them settle this?

a)

Placeholders

b)

Variables

c)

Replacement Fields

d)

Options

30.

Imagine Olivia, Elijah, and Harper are in a coding class. They come across an 's' in string formatting. Olivia thinks it's because they are using strings, Elijah thinks it's for decimal integers, Harper thinks it's for floats, and their teacher thinks they are just using the letter s. Who is correct?

a)

Olivia

b)

Elijah

c)

Harper

d)

Their teacher

31.

Ethan, Zoe and Harper are playing a game of 'Python Trivia'. Ethan draws a card and reads out the question, 'When we use a 'd' in string formatting, what are we indicating?' Can you help them answer?

a)

It means we are using strings.

b)

It signifies we are using decimal integers.

c)

It indicates we are using floats.

d)

It suggests we are using the letter s.

32.

James, Ava, and Emma are having a debate. James says that when we use an 'f' in string formatting, we are using strings. Ava thinks we are using decimal integers. Emma believes we are using floats. Who is correct?

a)

James, who thinks we are using strings.

b)

Ava, who thinks we are using decimal integers.

c)

Emma, who thinks we are using floats.

d)

None of them.

33.

Avery, Aria, and James are playing a game of 'Guess the Number Format'. Avery is given the number 75.765367 and the format :.3f. Can you help Avery guess how the number will look like in this format?

a)

76

b)

75.76

c)

75.765

d)

75.7653

34.

Imagine Jackson, Abigail, and Evelyn are playing a game of 'Guess the Number'. Jackson types :.0f in a string formatter and the number 75.765367 pops up. Can you guess how this number will look like to Evelyn?

a)

76

b)

75.76

c)

75.765

d)

75.7653

35.

Aria, Benjamin, and Liam are playing a game of 'Guess the Output'. They come across a tricky question: If they see :.0d in a string formatter, what will the number 75.765367 look like?

a)

76

b)

75.76

c)

75.765

d)

ValueError

36.

Imagine Lily, Ava, and Elijah are playing a game of Python trivia. Lily draws a card that reads, '{0:4} in a string formatter, what does the second part indicate?'

a)

Field Size

b)

Position

c)

Index Number

d)

What we are entering in.

37.

Aria, Michael, and Noah are playing a game of coding trivia. They come across a question: "What do these symbols in a string formatter "<, >, ^" represent?" Can you help them answer?

a)

An Error

b)

Math

c)

Alignment

d)

Field Size

38.

Oliver, Emma, and Mia are playing a game of 'Python Trivia'. Oliver asks, 'What is the output of the following Python code: print(type(()))?' Can you help them answer?

a)

<class 'tuple'>

b)

<class 'None'>

c)

<class 'list'>

d)

<class 'int'>

39.

Lucas, Ava, and Sophia are having a debate. Lucas says that in Python, you can concatenate two tuples using the '+' operator. Ava and Sophia aren't so sure. Who do you think is correct?

a)

Lucas

b)

Ava and Sophia

40.

Imagine Noah, Isabella, and Mia are playing a game of 'Guess the Output'. They come across a tricky question: If they see :.2f in a string formatter, what will the number 123.456 look like?

a)

123

b)

123.45

c)

123.456

d)

123.46

41.

Emma, Aiden, and Ava are having a friendly debate about Python. Emma says that in Python, you can change the value of a tuple. Aiden and Ava aren't so sure. Who do you think is correct?

a)

Emma

b)

Aiden and Ava

42.

Oliver, Sophia, and Harper are playing a game of 'Guess the Output'. They come across a tricky question: If they see :.4f in a string formatter, what will the number 123.456789 look like?

a)

123

b)

123.45

c)

123.4567

d)

123.4568