Search Header Logo
Untitled Presentation

Untitled Presentation

Assessment

Presentation

•

Computers

•

•

Practice Problem

•

Hard

Created by

Sonam Tenlo

Used 1+ times

FREE Resource

26 Slides • 30 Questions

1

media

2

media

3

media

4

Multiple Choice

What is the output of the following code? student = ("Alice", 17, 11) print(student)

1

('Alice', 17, 11)

2

('Alice', 11, 17)

3

('17', 'Alice', '11')

4

('11', '17', 'Alice')

5

media

6

Multiple Choice

Which of the following statements is true about tuples in Python?

1

Tuples are mutable.

2

Tuples are ordered.

3

Tuples can have duplicate elements.

4

Tuples use curly braces {} for initialization.

7

media

8

Multiple Choice

What attributes should be included in the tuple named book_info for the novel 'The Giver'?

1

Title

2

Author

3

Year of Publication

4

Publisher

9

media

10

Multiple Choice

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':

1

t[1] = 'qux'

2

t(1) = 'qux'

3

t[1:1] = 'qux'

4

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

11

media

12

media

13

Multiple Choice

What are the two methods for accessing elements of a tuple in Python?

1

Index

2

Slice Operator

3

Append

4

Remove

14

media

15

Multiple Choice

What is the syntax for accessing elements in a tuple?

1

tuple_name=(element1,element2,element3,..)

2

tuple_name[element_no]

3

tuple_name{element1,element2}

4

tuple_name

16

media

17

media

18

Fill in the Blank

Write the first line needed in a for loop that will repeat its code 4 times

19

media

20

Multiple Choice

What are the even numbers displayed at index 0 and 7 in the tuple?

1

100

2

102

3

104

4

106

21

media

22

Multiple Choice

Use a for loop to display all elements from the tuple.

1

for i in emp_name:

2

for i in range(len(emp_name))

3

for i in emp_name.items()

4

for i in emp_name.keys()

23

media

24

Multiple Choice

What are the names displayed using negative indexing in the tuple?

1

Pema

2

Tawjay

3

Timsina

4

Subb

25

media

26

Multiple Choice

What does the syntax `tuple_name[start : end : Step]` represent in tuple slicing?

1

It indicates the index where slice has to Start.

2

It indicates the index where slice has to End.

3

It refers to an incremental value.

4

It indicates the length of the tuple.

27

media

28

media

29

Multiple Choice

What are the steps to create a tuple named 'marks' and access specific elements from it in Python?

1

Create a tuple with marks

2

Access elements using slice operator

3

Use negative indexing

4

Access all elements of even index

30

media

31

Multiple Choice

What are the selected marks accessed using the slice operator in the given code?

1

45, 34, 56, 57, 78

2

40, 45, 34, 56, 57

3

78, 23, 48, 67

4

90, 91, 88, 99

32

media

33

Multiple Choice

What will be the output of the following code? ```python odd_num=(1,3,5,7,9,11,13,15,17,19,21,23,25,27,29) print(odd_num[1:13:2]) ```

1

(1, 3, 5, 7, 9, 11, 13)

2

(3, 7, 11, 15, 19, 23)

3

(1, 5, 9, 13, 17, 21)

4

(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29)

34

media

35

Multiple Choice

What are the names of the months in the first quarter of the year?

1

January, February, March

2

April, May, June

3

July, August, September

4

October, November, December

36

media

37

Multiple Choice

What is the output of the following Python program? ```python vowels = ('a', 'e', 'i', 'o', 'u') last_vowel = vowels[-1] print("The last vowel in the tuple is:", last_vowel) ```

1

The last vowel in the tuple is: a

2

The last vowel in the tuple is: e

3

The last vowel in the tuple is: i

4

The last vowel in the tuple is: u

38

media

39

Multiple Choice

Write a Python Program to print the ages of people who are between 20 and 30 years old using slice operators using the tuple given below: ages = (25, 30, 18, 22, 35, 28, 20, 31, 29, 27)

1

ages = (25, 30, 18, 22, 35, 28, 20, 31, 29, 27)

2

ages_between_20_and_30 = ages[6:9]

3

print("Ages of people between 20 and 30 years old:", ages_between_20_and_30)

4

Ages of people between 20 and 30 years old: (20, 31, 29)

40

media

41

Multiple Choice

What does the len() method do in Python tuples?

1

Returns the number of times a specified value occurs in a tuple.

2

Searches the tuple for a specified value and returns the position of where it was found.

3

Determines the length of the tuple.

4

Removes a specified element from the tuple.

42

Multiple Choice

What is the purpose of the index() method in Python tuples?

1

Returns the number of times a specified value occurs in a tuple.

2

Searches the tuple for a specified value and returns the position of where it was found.

3

Determines the length of the tuple.

4

Removes a specified element from the tuple.

43

Multiple Choice

What does the method count() do in Python tuples?

1

Returns the number of times a specified value occurs in a tuple.

2

Searches the tuple for a specified value and returns the position of where it was found.

3

Determines the length of the tuple.

4

Removes a specified element from the tuple.

44

media

45

Multiple Choice

What is the syntax for the sum() method in Python?

1

sum(tuple_name)

2

total(tuple_name)

3

add(tuple_name)

4

calculate(tuple_name)

46

Multiple Choice

What does the max() method do in Python?

1

Finds the minimum value in a tuple

2

Finds the maximum value in a tuple

3

Calculates the average of elements in a tuple

4

Returns the sum of elements in a tuple

47

Multiple Choice

What is the purpose of the min() method in Python?

1

To find the maximum value in a tuple

2

To find the minimum value in a tuple

3

To calculate the sum of elements in a tuple

4

To return the length of a tuple

48

Multiple Choice

A tuple is declared as

T = (2,5,6,9,8)

What will be the value of sum(T)?

1

30

2

0

3

Error

4

29

49

media

50

Multiple Choice

What are the tasks that the Python program should perform based on the given student data?

1

Calculate the average mark of the students

2

Determine the highest mark achieved

3

Display the lowest mark among the students

4

All of the above

51

media

52

Multiple Choice

What is the lowest mark displayed in the output?

1

45

2

56

3

78

4

73

53

Multiple Choice

What is the highest mark achieved according to the code?

1

45

2

56

3

78

4

73

54

Multiple Choice

What is the average mark calculated in the code?

1

63.0

2

70.0

3

75.0

4

80.0

55

Multiple Choice

What is the syntax to get the median?
1
np.median
2
arr.mean
3
mean()
4
np(arr.mean)

56

Poll

How confident do you feel about this topic now?

Very confident
Somewhat confident
Not confident
media

Show answer

Auto Play

Slide 1 / 56

SLIDE