
Python Revision Quiz

Quiz
•
Computers
•
12th Grade
•
Medium
VIJITHA M
Used 5+ times
FREE Resource
19 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Dictionaries in Python are mutable but Strings are immutable.
True
False
Answer explanation
Dictionaries in Python can be changed after creation (mutable), while strings cannot be altered once created (immutable). Therefore, the statement is true.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
str="R and Data Science"
z=str.split()
newstr="=".join([z[2].upper(),z[3],z[2]+z[3],z[1].capitalize()])
newstr is equal to
'DATA=Science=DataScience=And'
'DATA=DataScience=And'
'DATA=Science=And'
'DATA=Science==DataScience=And'
Answer explanation
The string is split into words: ['R', 'and', 'Data', 'Science']. The new string is formed by joining the uppercase of 'Data', 'Science', the concatenation of 'Data' and 'Science', and the capitalized 'and', resulting in 'DATA=Science=DataScience=And'.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the given expression:
True and not AAA and not True or True
Which of the following will be correct output if the given expression is evaluated
with AAA as False?
True
False
NONE
NULL
Answer explanation
Evaluating the expression with AAA as False: True and not False and not True or True simplifies to True and True and False or True, which further simplifies to True or True, resulting in True.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What shall be the output of the following statement?
“TEST”.split(‘T’,1)
[ ‘ ‘, ’ ES ’ ,’ ‘ ]
[ ‘T’, ’ ES ’ ,’T’]
[ ‘ ‘, ‘ EST ’]
Error
Answer explanation
The statement 'TEST'.split('T', 1) splits the string at the first occurrence of 'T'. It results in [' ', 'EST'], where the first part is before 'T' and the second part is after. Thus, the correct output is [' ', 'EST'].
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What shall be the output for the execution of the following statement? “ANTARTICA”.strip(‘A’)
NTRCTIC
[‘ ‘, ‘NT’, ‘RCTIC’, ‘ ‘]
'NTARTIC'
Error
Answer explanation
The method strip('A') removes 'A' characters from both ends of the string 'ANTARTICA'. The result is 'NTARTIC', as the leading and trailing 'A's are stripped, making 'NTARTIC' the correct output.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider The following: t=(12,13,14,16,[2,3])
What changes will be made in t after the execution of the following statement?
t.append(4)
t=(12,13,14,16,[2,3],4)
t= (12,13,14,16,[2,3,4])
t=(4,12,13,14,16,12,3)
It will give an error
Answer explanation
The tuple 't' is immutable in Python, meaning you cannot change it after creation. Attempting to use 't.append(4)' will result in an AttributeError, as tuples do not have an 'append' method. Thus, it will give an error.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
0
1
2
Error
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Scratch Text Operators

Quiz
•
KG - Professional Dev...
15 questions
Binary Addition

Quiz
•
9th Grade - University
20 questions
HTML & CSS Review

Quiz
•
7th - 12th Grade
15 questions
Translators

Quiz
•
9th - 12th Grade
20 questions
CMU Unit 1 Practice Test

Quiz
•
9th - 12th Grade
20 questions
Python while loops

Quiz
•
12th Grade
20 questions
Google Sheets Review

Quiz
•
KG - University
15 questions
Python - Chpt 1 - Review

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade