WorksheetsPython Programming Quiz
Total questions: 12
Worksheet time: 14mins
State True or False- “continue keyword skips remaining part of an iteration in a loop”
State the correct output of the following code- S1= “India is on the Moon” A=S1.split("o",3) print(A)
['India is ', 'n the M', ' ', 'n']
'India is ', 'n the M', ' ', 'n'
['India is n ', 'the ', ' ', 'Mn']
['India is', 'the', 'n']
Identify the output of the following code snippet: text = "PYTHONPROGRAM" text=text.replace('PY','#') print(text)
#THONPROGRAM
##THON#ROGRAM
#THON#ROGRAM
#YTHON#ROGRAM
str1=" Programming " str2=" is My Junoon" str3=str1.strip()+str2.replace("J", "j").lstrip() print(str3.partition("My"))
('Programmingis ', 'My', ' junoon')
['Programmingis ', 'My', ' junoon']
['Programming is ', 'My', ' Junoon']
(('Programmingis ', 'My', ' Junoon')
What will be the output of the following code snippet? message= "Olympics 2024" print(message[-2::-4])
Given the following tuple- T1= (10,30,20,50,40) Which of the following statement will result an error?
print(T1[0])
print(len(T1))
print(T1[-4:3])
print(T1.insert(2,3))
If dict1 is a dictionary defined below, then which of the following will raise an exception? dict1={“Dhoni”:95,”Virat”:99,”Rohit”:100}
print(str(dict1))
dict1.get(“Virat”)
print(dict1([“Dhoni”,”Rohit”])
dict1[“Rohit”]=158
What does this statement will do in python >>>L1=[10,20,30] # Statement 1 >>>L1.insert(-3,1) # Statement 2 >>>print(L1) # Statement 3
The statement 2 will insert the element -3 at index 1
The statement 2 will insert the element 1 at index -3
The statement 2 will insert the element 1 after the value 10
The statement 2 will insert the element -3 after the value 30
If a table which has one Primary key and two alternate keys. How many Candidate keys will this table have?
1
2
3
4
Which of the following modes keeps the file offset position at the end of file?
r
w
a
r+
What will be the output of the following Python statement: print(6-3**2**2+120/12)
What will be output of the following code? X=10 def exam(Y=20): X=30 Z=X+Y print(X,Z,end=”#”) exam(30) print(X,end=”$”)
30 60#10$
30 60 $10#
30 10#10$
30 50#10$
