Search Header Logo
Bài 22

Bài 22

Assessment

Presentation

•

Science

•

10th Grade

•

Practice Problem

•

Hard

Created by

Truong Thi Dao (FE FSCHOOL BTL)

FREE Resource

26 Slides • 24 Questions

1

media

2

media

3

Open Ended

Can you find some examples of list-type data that are commonly encountered in real life?

4

media

5

Open Ended

How do you initialize a list in Python? How can you access, modify, and delete an element in a list?

6

media

7

Multiple Choice

Which of the following statements about Python lists is correct?

1

All elements in a Python list must be of the same data type.

2

Python lists can contain elements of different data types.

3

Python lists cannot be empty.

4

Python lists are immutable.

8

media

9

Multiple Select

Select all correct ways to access elements in a Python list.

1

Using the element's value directly

2

Using the index of the element

3

Using the length of the list

4

Using a loop with indices

10

media

11

Open Ended

Explain how you can change the value of an element in a Python list and how to remove an element from the list.

12

media

13

Multiple Choice

What is the result of the operation [1,2] + [3,4,5,6] in Python?

1

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

2

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

3

[1,2,3,4]

4

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

14

media

15

Fill in the Blanks

Fill in the blank: The index of the first element in a Python list is

Type answer...

.

16

media

17

Multiple Choice

Suppose A is a list of numbers. What does the command del(A[0]) do to the list?

1

Removes the first element from A

2

Deletes the entire list A

3

Removes the last element from A

4

Adds a new element to A

18

Multiple Choice

Given the list A = [1, 0, "One", 9, 15, "Two", True, False], what is the value of A[2]?

1

0

2

"One"

3

9

4

True

19

media

20

media

21

media

22

Multiple Select

Which of the following statements about iterating over a list in Python are correct?

1

You can use for i in range(len(A)) to access each element by index.

2

You can use for element in A to access each element directly.

3

Using range(2,5) allows you to access a subset of the list.

4

You cannot use a for loop to iterate over a list.

23

Open Ended

Explain how the for loop combined with the range function can be used to iterate over elements of a list.

24

media

25

Open Ended

Describe what the following code does: S = 0; for i in range(len(A)): if A[i] > 0: S = S + A[i]; print(S)

26

media

27

Fill in the Blanks

Fill in the blank: To add an element to the end of a list in Python, use the

Type answer...

method.

28

media

29

Multiple Select

Which of the following statements about the Python list append() method are correct?

1

It adds an element to the end of the list.

2

It can add multiple elements at once.

3

It modifies the original list.

4

It returns the new list.

30

Open Ended

Explain how the append() method works in Python lists. Give an example.

31

Multiple Choice

What is the result of the list A after executing the following code? A = [1,2]; A.append(10); print(A)

1

[1, 2, 10]

2

[1, 10, 2]

3

[10, 1, 2]

4

[1, 2]

32

media

33

Multiple Choice

Given a list A = [2,4,10,1,0], what will A look like after executing: A.append(100); del(A[1])?

1

[2,10,1,0,100]

2

[2,4,10,1,0,100]

3

[4,10,1,0,100]

4

[2,4,1,0,100]

34

Multiple Choice

After using the append() method to add an element to a list in Python, how does the length of the list change?

1

It increases by 1

2

It decreases by 1

3

It stays the same

4

It doubles

35

media

36

media

37

media

38

media

39

media

40

media

41

Open Ended

Explain how the program in images 0 and 1 counts the number of integers less than or equal to 100.

42

Multiple Choice

What is the output of the Python program if the input is '12 234 123 43 56 21'?

1

3

2

4

3

5

4

6

43

media

44

media

45

Fill in the Blanks

Fill in the blank: To calculate the average temperature for seven days, the program divides the total sum by

Type answer...

.

46

media

47

Multiple Choice

What is the output of the program in image 4 if the input is '2 4 2 5 4 4 5 2 5 4 5 5'?

1

2

2

3

3

4

4

5

48

media

49

Multiple Select

Which of the following are correct statements about lists in Python?

1

All high-level programming languages have a data type for storing a finite sequence of elements.

2

In Python, the list data type is a finite sequence of elements that allows access to each element.

3

Python requires all elements in a list to be of the same data type.

4

Lists in Python can only be created by assignment in the program, not by input from the keyboard.

50

Open Ended

Can you name some real-life examples of list-type data that you encounter?

pattern-tertiary
media

Show answer

Auto Play

Slide 1 / 50

SLIDE