

Untitled Presentation
Presentation
•
Computers
•
•
Practice Problem
•
Hard
Sonam Tenlo
Used 1+ times
FREE Resource
26 Slides • 30 Questions
1
2
3
4
Multiple Choice
What is the output of the following code? student = ("Alice", 17, 11) print(student)
('Alice', 17, 11)
('Alice', 11, 17)
('17', 'Alice', '11')
('11', '17', 'Alice')
5
6
Multiple Choice
Which of the following statements is true about tuples in Python?
Tuples are mutable.
Tuples are ordered.
Tuples can have duplicate elements.
Tuples use curly braces {} for initialization.
7
8
Multiple Choice
What attributes should be included in the tuple named book_info for the novel 'The Giver'?
Title
Author
Year of Publication
Publisher
9
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':
t[1] = 'qux'
t(1) = 'qux'
t[1:1] = 'qux'
It’s a trick question—tuples can’t be modified.
11
12
13
Multiple Choice
What are the two methods for accessing elements of a tuple in Python?
Index
Slice Operator
Append
Remove
14
15
Multiple Choice
What is the syntax for accessing elements in a tuple?
tuple_name=(element1,element2,element3,..)
tuple_name[element_no]
tuple_name{element1,element2}
tuple_name
16
17
18
Fill in the Blanks
Type answer...
19
20
Multiple Choice
What are the even numbers displayed at index 0 and 7 in the tuple?
100
102
104
106
21
22
Multiple Choice
Use a for loop to display all elements from the tuple.
for i in emp_name:
for i in range(len(emp_name))
for i in emp_name.items()
for i in emp_name.keys()
23
24
Multiple Choice
What are the names displayed using negative indexing in the tuple?
Pema
Tawjay
Timsina
Subb
25
26
Multiple Choice
What does the syntax `tuple_name[start : end : Step]` represent in tuple slicing?
It indicates the index where slice has to Start.
It indicates the index where slice has to End.
It refers to an incremental value.
It indicates the length of the tuple.
27
28
29
Multiple Choice
What are the steps to create a tuple named 'marks' and access specific elements from it in Python?
Create a tuple with marks
Access elements using slice operator
Use negative indexing
Access all elements of even index
30
31
Multiple Choice
What are the selected marks accessed using the slice operator in the given code?
45, 34, 56, 57, 78
40, 45, 34, 56, 57
78, 23, 48, 67
90, 91, 88, 99
32
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, 3, 5, 7, 9, 11, 13)
(3, 7, 11, 15, 19, 23)
(1, 5, 9, 13, 17, 21)
(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29)
34
35
Multiple Choice
What are the names of the months in the first quarter of the year?
January, February, March
April, May, June
July, August, September
October, November, December
36
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) ```
The last vowel in the tuple is: a
The last vowel in the tuple is: e
The last vowel in the tuple is: i
The last vowel in the tuple is: u
38
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)
ages = (25, 30, 18, 22, 35, 28, 20, 31, 29, 27)
ages_between_20_and_30 = ages[6:9]
print("Ages of people between 20 and 30 years old:", ages_between_20_and_30)
Ages of people between 20 and 30 years old: (20, 31, 29)
40
41
Multiple Choice
What does the len() method do in Python tuples?
Returns the number of times a specified value occurs in a tuple.
Searches the tuple for a specified value and returns the position of where it was found.
Determines the length of the tuple.
Removes a specified element from the tuple.
42
Multiple Choice
What is the purpose of the index() method in Python tuples?
Returns the number of times a specified value occurs in a tuple.
Searches the tuple for a specified value and returns the position of where it was found.
Determines the length of the tuple.
Removes a specified element from the tuple.
43
Multiple Choice
What does the method count() do in Python tuples?
Returns the number of times a specified value occurs in a tuple.
Searches the tuple for a specified value and returns the position of where it was found.
Determines the length of the tuple.
Removes a specified element from the tuple.
44
45
Multiple Choice
What is the syntax for the sum() method in Python?
sum(tuple_name)
total(tuple_name)
add(tuple_name)
calculate(tuple_name)
46
Multiple Choice
What does the max() method do in Python?
Finds the minimum value in a tuple
Finds the maximum value in a tuple
Calculates the average of elements in a tuple
Returns the sum of elements in a tuple
47
Multiple Choice
What is the purpose of the min() method in Python?
To find the maximum value in a tuple
To find the minimum value in a tuple
To calculate the sum of elements in a tuple
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)?
30
0
Error
29
49
50
Multiple Choice
What are the tasks that the Python program should perform based on the given student data?
Calculate the average mark of the students
Determine the highest mark achieved
Display the lowest mark among the students
All of the above
51
52
Multiple Choice
What is the lowest mark displayed in the output?
45
56
78
73
53
Multiple Choice
What is the highest mark achieved according to the code?
45
56
78
73
54
Multiple Choice
What is the average mark calculated in the code?
63.0
70.0
75.0
80.0
55
Multiple Choice
56
Poll
How confident do you feel about this topic now?
Show answer
Auto Play
Slide 1 / 56
SLIDE
Similar Resources on Wayground
52 questions
Endogenic Processes I
Presentation
•
11th Grade
50 questions
Subject and Verb Agreement
Presentation
•
7th - 10th Grade
50 questions
The Republic of Texas and Early Statehood
Presentation
•
7th Grade
52 questions
Atoms, Molecules, Compounds, Elements
Presentation
•
6th - 8th Grade
50 questions
Unit 6 Latin America Physical and Cultural Geography
Presentation
•
9th - 12th Grade
52 questions
Weather Maps and Tools
Presentation
•
6th Grade
52 questions
Space Exploration
Presentation
•
6th - 8th Grade
51 questions
EmTechWk2Lesson1.2
Presentation
•
11th - 12th Grade
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Assessment 1
Quiz
•
3rd Grade
15 questions
HCS SCI 05 Summer School Assessment 1 Review
Quiz
•
5th Grade
22 questions
Day 9 Equations and Inequalities Review
Quiz
•
9th Grade
10 questions
Writing and Identifying Ratios Practice
Quiz
•
5th - 6th Grade
7 questions
PYRAMID PERSPECTIVES part 1
Presentation
•
9th - 12th Grade
12 questions
Understanding the Fourth of July
Quiz
•
9th Grade
15 questions
Soccer World Cup Quiz Questions
Quiz
•
7th Grade