Programming in Python - - Unit 7 - Week 7 (Content)_ Introduction to tuples_
Programming in Python - - Unit 7 - Week 7 (Content)_ Introduction to tuples_
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/CEC)
mathavi.2007@gmail.com
Course Assessment-7-2024
outline The due date for submitting this assignment has passed.
Due on 2024-03-31, 23:59 IST.
Week 1 Score: 7/10=70%
(Contents) :
Planning the
Computer Assignment submitted on 2024-03-30, 13:56 IST
Program () 1) What will be the output of the following code? 1 point
Week 2 x=(1,6,7)
(Contents): print(2*x)
Techniques
of Problem (2,12,14)
Solving ()
(1,1,6,6,7,7)
(1, 6, 7, 1, 6, 7)
Week 3
(Contents): Error
Introduction Yes, the answer is correct.
to Python () Score: 1
Accepted Answers:
Week 4 (1, 6, 7, 1, 6, 7)
(Contents):
Conditional 2) Which of the following is correct about a tuple? 1 point
Statements
and Looping
() A tuple can be modified after it is created.
A tuple cannot contain mixed types of data.
Week 5
Elements in a tuple can be accessed using their index.
(Contents):
String Tuples are faster to iterate through than lists because they are mutable.
Manipulation Yes, the answer is correct.
()
S 1
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=38&assessment=98 1/5
4/23/24, 3:23 AM Programming in Python - - Unit 7 - Week 7 (Content): Introduction to tuples.
Score: 1
Week 6 Accepted Answers:
(Contents): Elements in a tuple can be accessed using their index.
Introduction
to list. () 3) How do you delete a tuple in Python? 1 point
Week 7
(Content): Using the del keyword: del tuple_name
Introduction
to tuples. ()
Using the remove() method: tuple_name.remove()
Lecture 1:
Introduction to
Tuples (unit?
unit=38&lesso Tuples cannot be deleted.
n=39)
Using the pop() method: tuple_name.pop()
Lecture 2:
Tuple No, the answer is incorrect.
operation Score: 0
(unit? Accepted Answers:
unit=38&lesso Using the del keyword: del tuple_name
n=40)
Lecture 3:
Working with 4) What will be the output of the following code? 1 point
Tuples (unit?
unit=38&lesso z=("amar","akbar","anthony")
n=41) print(z[-1:0])
Lecture
("amar")
Material (unit?
unit=38&lesso ("akbar")
n=42) ("anthony")
Quiz: ()
Assessment- Yes, the answer is correct.
7-2024 Score: 1
(assessment? Accepted Answers:
name=98) ()
Week 8
5) Which of the following is a Python tuple? 1 point
(Contents):
Introduction
to
{5,6,7}
dictionaries
()
[5,6,7]
Week 9
(Contents): (5,6,7)
Python
Functions ()
<5,6,7>
S 1
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=38&assessment=98 2/5
4/23/24, 3:23 AM Programming in Python - - Unit 7 - Week 7 (Content): Introduction to tuples.
Python Score: 1
Modules () Accepted Answers:
(5,6,7)
Week 11
(Contents):
6) Which of the following is the correct way to create a tuple with a single element? 1 point
Input-Output
()
my_tuple = (1,)
my_tuple = {1}
my_tuple = (1,)
Concatenation
Repetition
Modification
Slicing
False
True
Y h i
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=38&assessment=98 3/5
4/23/24, 3:23 AM Programming in Python - - Unit 7 - Week 7 (Content): Introduction to tuples.
9) How do you swap the values of two variables a and b in Python using tuple 1 point
unpacking?
a, b = (b, a)
a = b; b = a
(a, b) = b, a
ab=ba
(a, b) = b, a
a, b = my()
print(a)
print(b)
Error
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=38&assessment=98 4/5
4/23/24, 3:23 AM Programming in Python - - Unit 7 - Week 7 (Content): Introduction to tuples.
https://onlinecourses.swayam2.ac.in/cec24_cs01/unit?unit=38&assessment=98 5/5