

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
54 questions
KS3 E-Safety 1: Account Security
Presentation
•
7th Grade
51 questions
3.0 Introduction to Java
Presentation
•
University
52 questions
LEAP REVIEW #1
Presentation
•
6th Grade
50 questions
Industrial Revolution 7.1 and 7.2
Presentation
•
8th - 10th Grade
50 questions
Family Members
Presentation
•
9th - 12th Grade
50 questions
1_Internet Concept
Presentation
•
8th Grade
50 questions
Electric Circuits
Presentation
•
8th - 11th Grade
Popular Resources on Wayground
20 questions
"What is the question asking??" Grades 3-5
Quiz
•
1st - 5th Grade
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
Discover more resources for Computers
11 questions
Positive Relationships
Presentation
•
KG
19 questions
Fire Safety
Quiz
•
KG - 2nd Grade
36 questions
8th Grade US History STAAR Review
Quiz
•
KG - University
20 questions
Capitalization in sentences
Quiz
•
KG - 4th Grade
25 questions
5th Grade Science STAAR Review
Quiz
•
KG - University
10 questions
Counting Nickels and Pennies
Quiz
•
KG - 2nd Grade
16 questions
Parallel, Perpendicular, and Intersecting Lines
Quiz
•
KG - Professional Dev...
13 questions
Time
Quiz
•
KG - 2nd Grade