Lists in python

Quiz
•
Computers
•
University
•
Hard
Balasubramani Sivakumar
Used 2+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
What is the correct way to access the third element in a list named my_list?
my_list[3]
my_list[2]
my_list[0]
my_list(2)
2.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
Which of the following methods is used to add an element to the end of a list in Python?
append()
insert()
add()
extend()
3.
MULTIPLE SELECT QUESTION
20 sec • 2 pts
Functions that can be used for list operations
reverse ()
index()
sqrt()
zip()
4.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
How do you remove the element at index 2 from a list?
list.remove[2]
list.pop[2]
del list[2]
None of the above
5.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
What is the purpose of the extend() method in Python lists?
Adds an element to the end of the list
Concatenates another list to the end of the list
Sorts the elements in the list
Reverses the order of elements in the list
6.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What is the key difference between sort() and sorted() in Python?
sort() returns a new sorted list, while sorted() sorts the list in-place.
sort() works only on numeric lists, while sorted() works on any iterable.
sort() is a function, and sorted() is a method.
sort() is stable, and sorted() is unstable.
7.
MULTIPLE CHOICE QUESTION
20 sec • 2 pts
numbers = [1, 2, 3, 4, 5]
result = [x if x % 2 == 0 else x**2 for x in numbers]
print(result)
[1, 4, 9, 16, 25]
[1, 2, 3, 4, 5]
[2, 4, 6, 8, 10]
[1, 4, 3, 16, 5]
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python Sets

Quiz
•
University
15 questions
Python Quiz 1 : Variable, Data Types, Slicing

Quiz
•
University
10 questions
DATA STRUCTURES ACTIVITY OF THE WEEK

Quiz
•
University
10 questions
basic programming quiz

Quiz
•
University
7 questions
Final Practice

Quiz
•
University
15 questions
Dictionary Python

Quiz
•
University
10 questions
V1 unit 3 and 4Quiz

Quiz
•
University
10 questions
H466 - Arrays, Records, Tuples and Lists

Quiz
•
11th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University