Students can read the important questions given below for Revision Of The Basics Of Python Class 12 Computer Science. All Revision Of The Basics Of Python Class 12 Notes and questions with solutions have been prepared based on the latest syllabus and examination guidelines issued by CBSE, NCERT and KVS. You should read all notes provided by us and Class 12 Computer Science Important Questions provided for all chapters to get better marks in examinations. Computer Science Question Bank Class 12 is available on our website for free download in PDF.
Important Questions of Revision Of The Basics Of Python Class 12
Very Short Answer Type Questions :
Question: What is None literal in Python?
Answer: Python has one special literal called “None”. It is used to indicate something that has not yet been created. It is a legal empty value in Python.
Question: Can List be used as keys of a dictionary?
Answer: No, List can’t be used as keys of dictionary because they are mutable. And a python dictionary can have only keys of immutable types.
Short Answer Type Questions :
Question: Rewrite the code after correcting errors: –
if N=>0
print(odd)
else
Print(“even”)
Answer: – if N>=0:
print(“odd”)
else:
print(“even”)
Question: What is a python variable? Identify the variables that are invalid and state the reason Class, do, while, 4d, a+
Answer: – A variable in python is a container to store data values.
a) do, while are invalid because they are python keyword
b) 4d is invalid because the name can’t be started with a digit.
c) a+ is also not validas no special symbol can be used in name except underscore ( _ ).
Question: Predict the output
for i in range( 1, 10, 3):
print(i)
Answer: – 1
4
7
Question: What will be the output of the following code snippet?
values =[ ]
for i in range (1,4):
values.append(i)
print(values)
Answer: [1]
[1 ,2 ]
[1,2,3]
Question: What problem occurs with the following code
X=40
while X< 50 :
print(X)
Answer: – The given code does not have the incrementing value of X, thus the loop becomes endless.
Question: Find the error in following code. State the reason of the error.
aLst = { ‘a’:1 ,’ b’:2, ‘c’:3 }
print (aLst[‘a’,’b’])
Answer: The above code will produce KeyError, the reason being that there is no key same as the list [‘a’,’b’] in dictionary aLst.
Application Based Questions :
Question: Find output of the following code fragment.
x=”hello world”
print(x[:2],x[:-2],x[-2:])
print(x[6],x[2:4])
print(x[2:-3],x[-4:-2])
Answer: he hello wor ld
w ll
llo wo or
Question: Rewrite the following programs after removing syntactical errors:
for=20
for1=50:
for3=for+for1+for2
print(for3)
Answer:
f=20 #( as for is a keyword in python)
for1=50 #(: can not be used here)
for3=f+for1 #(for2 not defined)
print(for3)