
Tuples Quiz - Vijayendra
Authored by Smart Noob
Computers
9th - 12th Grade
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code?
thistuple = (10, 20, 30, 40, 50, 60, 70, 80)
print(thistuple[2:5], thistuple[:4], thistuple[3:])
(30, 40, 50) (10, 20, 30, 40) (40, 50, 60, 70, 80)
(20, 30, 40, 50) (10, 20, 30, 40) (30, 40, 50, 60, 70, 80)
Error
None of the given options
Answer explanation
To get a sub tuple out of the tuple, we need to specify the range of indexes. We need to specify where to start and where to end the range.
Syntax: tuple[start:end] If the start is missing it takes 0 as the starting index.
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A Python tuple can also be created without using parentheses
False
True
Answer explanation
A tuple can also be created without using parentheses. It is called tuple packing.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following tuple operation
thistuple = (100,)
print(thistuple * 2)
(100, 100)
Error
(200)
Answer explanation
We can use * operator to repeat the tuple values n number of times
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the type of the following variable
thistuple = ("Orange")
print(type(thistuple))
Answer explanation
To create a tuple with a single item, you need to add a comma after the item. Otherwise, Python will not recognize the variable as a tuple, and it will treat it as a string type.
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following
aTuple = "Yellow", 20, "Red"
a, b, c = aTuple
print(a)
Answer explanation
The tuple unpacking is also possible
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code
aTuple = (100, 200, 300, 400, 500)
aTuple[1] = 800
print(aTuple)
Answer explanation
A tuple is immutable. Once a tuple is created, you cannot change its values. If you try to change its value, you will receive a TypeError: 'tuple' object does not support item assignment
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following code
aTuple = (100, 200, 300, 400, 500)
print(aTuple[-2])
print(aTuple[-4:-1])
Error as it is out of range
400
(200, 300, 400)
Answer explanation
Use the range of negative indexes to start a search from the end of the tuple.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
EMPTECH L4 Q2
Quiz
•
12th Grade
10 questions
PRE-ASSESSMENT ETECH M1
Quiz
•
12th Grade
10 questions
Server Administration- Quiz 1
Quiz
•
12th Grade - University
10 questions
Quiz Informatica Jornadas Orientación Asunción
Quiz
•
12th Grade - University
15 questions
Databases
Quiz
•
11th Grade
10 questions
Working with tables
Quiz
•
5th - 12th Grade
11 questions
Cascading Style Sheets
Quiz
•
8th - 12th Grade
15 questions
Chapter 3: Storage devices and media (Part 2):
Quiz
•
10th - 11th Grade
Popular Resources on Wayground
8 questions
Spartan Way - Classroom Responsible
Quiz
•
9th - 12th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
3 questions
Integrity and Your Health
Lesson
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
9 questions
FOREST Perception
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
Discover more resources for Computers
10 questions
Navigating Digital Citizenship and Online Safety
Interactive video
•
6th - 10th Grade
20 questions
Computer / Internet Companies
Quiz
•
9th Grade
10 questions
Exploring the Basics of Google Sheets
Interactive video
•
9th Grade
10 questions
Exponent Rules
Quiz
•
9th - 12th Grade
20 questions
JavaScript - Karel
Quiz
•
9th - 10th Grade