CBSE
~ COMPUTER SCIENCE ~ CLASS XI ~ CHAPTER 3 #Python
CBSE ~ COMPUTER SCIENCE ~ CLASS XI ~ CHAPTER 5 #Python (New Syllabus)
1.
Create following Variables
i)
“mystring” to contain “hello‟
ii)
“myfloat‟ to contain “2.5‟
iii)
“myint‟ to contain “10‟
Answer:
mystring = 'hello'
myfloat = 2.5
myint = 10
2.
Write the value justification
i)
2*(3+4) ii) 2*3+4 iii) 2+3*4
Answer:
14,10,14
3.
What is the type of the following result:
i)
1+2.0+3
Answer:
float, adding/subtracting/multiplying/dividing an integer with a
float type results in float.
4.
Which of the following is the valid variable name:
i)
global ii) 99flag iii) sum iv) an$wer
Answer:
sum
5.
True of False
i)
Character Data type values should be delimited by using the single
quote.
ii)
None is one of the data type in python
iii)
The += operator is used to add the right hand side value to the left
hand side
variable.
iv)
The data type double is not a valid python data type.
v)
Python does not have any keywords
vi)
The equal to condition is written by using the == operator
Answer:
False,True,False,True,False,True
6.
Check all syntactically correct statements
a)
Which input statements are correct
i)
a = raw_input ( )
ii)
a = raw_input (“enter a number”)
iii)
a = raw_imput (enter your name)
Answer:
Only iii) is incorrect
b)
Which print statements are correct?
i)
_print “9” + “9”
ii)
_print int(“nine”)
iii)
_print 9+9
iv)
print 9
Answer:
iv)
c)
Which are correct arithmetical operations?
i)
a = 1*2
ii)
2 = 1+1
iii)
5 + 6 = y
iv)
Seven = 3 * 4
Answer:
i) and iv)
d)
Which are correct type conversions?
i)
int (7.0+0.1)
ii)
str (1.2 * 3.4)
iii)
float (“77”+“.0”)
iv)
str ( 9 / 0 )
Answer:
i) and ii)
e)
Which operations result in 8?
i)
65 // 8
ii)
17 % 9
iii)
2 * * 4
iv)
64 * * 0.5
Answer:
8,8,16,8.0
f)
Which lines are commented?
i)
“””This is a comment”””
ii)
# This is a comment
iii)
// this is a comment
iv)
'''This is a comment'''
Answer:
i) & ii)
g)
Find the matching pairs of expressions and values.
i)
1023 boolean
ii)
None int
iii)
[2, 4, 8, 16] tuple
iv)
True list
v)
17.54 str
vi)
('Roger', 1952) NoneType
vii)
“my fat cat”
float
Answer:
1023-int, None-NoneType, [2,4,8,16]-list,True-boolean, 17.54-float,
('Roger', 1952)-tuple,”my fat cat”-str
7.
MCQ
i)
The __________ data type allows only True/False values
[bool]
ii)
If the value of a = 20 and b = 20, then a+=b will assign ________ to
a
[40]
iii)
The ____________ operator is used to find out if division of two
number
yields
any remainder [%]
8.
When will following statement in interpreter result into error:
>>>
B+4
Answer:
when B is not defined before hand or B+4 is not being assigned to any
other variable
9.
How can we change the value of 6*1-2 to -6 from 4?
Answer:
6*(1-2)
10.
Is python case sensitive?
Answer:
YES
11.
What does 'immutable' mean; which data type in python are immutable.
Answer:
Integer & Long
, Float/floating point
, Complex
ReplyDeleteSuper Blog Article.Thanks for sharing information.
Python Training
Python Online Training
Python Training in Hyderabad
Python Training Institutes in Hyderabad
Python Online Training Course