What is the output of the following piece of code when executed in Python shell?
>>> a=("Check")*3
>>> a
Python - List and Tuples
Quiz
•
Computers
•
11th - 12th Grade
•
Hard
Sreelekshmi S
Used 206+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following piece of code when executed in Python shell?
>>> a=("Check")*3
>>> a
(‘Check’,’Check’,’Check’)
* Operator not valid for tuples
(‘CheckCheckCheck’)
Syntax error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Is the following piece of code valid?
>>> a=(1,2,3,4)
>>> del a
No because tuple is immutable
Yes, the entire tuple is deleted
No, invalid syntax for del method
Yes, first element in the tuple is deleted
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What type of data is: a=[(1,1),(2,4),(3,9)]?
Array of tuples
List of tuples
Tuples of lists
Invalid type
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true for a tuple?
Tup = 1,2,3
Tup = (""1,"2)
Tup = (1,2,3,4)
None of the above
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Result of the program above is
('1', '2', '3', '4', '5')
(1, 2, 3, 4, 5)
12345
"12345"
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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'
error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If list=[17,23,41,10] then list.append(32) will result
[32,17,23,41,10]
[17,23,41,10,32]
[10,17,23,32,41]
[41,32,23,17,10]
15 questions
Problem Solving using Python and R - UNIT II - Tuples
Quiz
•
12th Grade
15 questions
Creating and Altering Data Structure
Quiz
•
9th - 12th Grade
20 questions
مراجعة هياكل البيانات _ الوحدة الأولى
Quiz
•
11th Grade
20 questions
12 CSC ATAR - programming skills and concepts
Quiz
•
12th Grade
16 questions
Data Types in Python
Quiz
•
10th - 11th Grade
22 questions
Python Fundamentals
Quiz
•
12th Grade
15 questions
Python Quiz
Quiz
•
12th Grade
20 questions
List Manipulations
Quiz
•
11th Grade
15 questions
Multiplication Facts
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
5 questions
capitalization in sentences
Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions
Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines
Quiz
•
Professional Development
12 questions
Dividing Fractions
Quiz
•
6th Grade