Python Revision Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
VIJITHA M
Used 6+ times
FREE Resource
Enhance your content in a minute
25 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
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
20 questions
Week 5: Test your understanding part 1
Quiz
•
University
20 questions
DI (EM24) - Diseño de Perfiles (T5)
Quiz
•
University - Professi...
20 questions
UH - 01 VII
Quiz
•
1st - 12th Grade
20 questions
Microsoft Excel
Quiz
•
KG - Professional Dev...
21 questions
CÂU HỎI ÔN TAP HKI
Quiz
•
5th Grade - University
20 questions
Siskomdig Harian
Quiz
•
12th Grade
20 questions
kollekvium 3
Quiz
•
University
20 questions
data structures1
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
