Understanding Python Lists

Understanding Python Lists

5th Grade

15 Qs

quiz-placeholder

Similar activities

Code.org: Express Course -> Lesson 1 and 2

Code.org: Express Course -> Lesson 1 and 2

5th - 7th Grade

13 Qs

Computer Science

Computer Science

4th - 6th Grade

11 Qs

Aahaan : Python Live Assessment

Aahaan : Python Live Assessment

5th - 7th Grade

20 Qs

PYTHON (FOR LOOP)

PYTHON (FOR LOOP)

1st - 10th Grade

10 Qs

Algorithms

Algorithms

2nd - 6th Grade

11 Qs

Python Quiz - 4

Python Quiz - 4

4th - 11th Grade

10 Qs

PYTHON QUIZ

PYTHON QUIZ

1st - 5th Grade

20 Qs

Sort and search algorithms

Sort and search algorithms

KG - 5th Grade

10 Qs

Understanding Python Lists

Understanding Python Lists

Assessment

Quiz

Computers

5th Grade

Easy

Created by

Sugeng Riyanto

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a list in Python?

A list in Python is a mutable, ordered collection of items defined by square brackets.

A list in Python is an immutable collection of items.

A list in Python is a collection of items defined by curly braces.

A list in Python is a fixed-size array of integers.

Answer explanation

A list in Python is defined by square brackets and is mutable, meaning its contents can be changed. This distinguishes it from immutable collections like tuples and sets, which have different characteristics.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How are items in a list separated?

spaces

semicolons

commas

dashes

Answer explanation

Items in a list are typically separated by commas. This is a standard convention in English writing, making 'commas' the correct choice among the options provided.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What symbols are used to define a list?

Angle brackets <>

Curly braces {}

Square brackets []

Parentheses ()

Answer explanation

Square brackets [] are used to define a list in programming languages like Python and JavaScript. Other symbols like angle brackets, curly braces, and parentheses serve different purposes, making square brackets the correct choice for lists.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can you change the items in a list after it is created?

You can only add items, not change them

No, lists are immutable

Yes

Only if they are empty

Answer explanation

Yes, you can change the items in a list after it is created. Lists in Python are mutable, meaning you can modify their contents, including adding, removing, or changing items.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of print(lst1) if lst1 = [1,2,2,3,5,4,6]?

[2, 2, 3, 4, 5]

[1, 2, 2, 3, 5, 4, 6]

[1, 2, 3, 4, 5, 6]

[1, 3, 4, 5, 6]

Answer explanation

The output of print(lst1) will be the original list itself, which is [1, 2, 2, 3, 5, 4, 6]. The other options represent modified versions of the list, but the correct choice is the unaltered list.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What type of data can be stored in a list?

A list can only store boolean values.

A list can only store integers.

A list can store multiple data types such as integers, floats, strings, booleans, and other lists or objects.

A list can only store strings.

Answer explanation

The correct choice states that a list can store multiple data types, including integers, floats, strings, booleans, and even other lists or objects. This flexibility is a key feature of lists in programming.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of print(details) if details = ['Abhijeet', 18, 'FYBScIT', 9.8]?

['Abhijeet', 18, 'FYBScIT']

['Abhijeet', 18, 9.8]

['Abhijeet', '18', 'FYBScIT', 9.8]

['Abhijeet', 18, 'FYBScIT', 9.8]

Answer explanation

The variable 'details' is a list containing four elements: a string, an integer, another string, and a float. Therefore, the output of print(details) will be exactly ['Abhijeet', 18, 'FYBScIT', 9.8], which matches the correct answer.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?