TCS Python Question Answers MCQ
Which of the following attributes shows the characteristics of Python? Python is everywhere (Webscripting, 3D Modelling , Games , and Desktop applications ). - ubiquity
Code written in Python 3 is
backward compatible with Python 2. - False
Which is the fastest
implementation of Python? - PyPY
Which of these are salient
features of Python, except? - Limited
Platfrom support
Python is Ubiquitous? Is this true
or false? - True
Python supports automatic garbage
collection. - True
When using the Python shell and
code block, what triggers the interpreter to begin evaluating block of code? - Blank Line
Which action should be avoided so
that you do not mistakenly overwrite names that you have already defined? - Use the wildcard import
What command is used to output
text from both the Python shell and within a Python module? - Print()
While using Python IDLE, by how
many space are the code suites indented? - 4
What is the output of bool(0)? - False
Which of the following will not
result in declaring x as datatype of float? - x=5
Is x,y=5,6 a valid statement? - True
While using 'bool', all zero
values are considered as false and non- zero values are considered as true. Is
this correct? - True
Which statement accurately defines
the bool class? - Boolean not returns
false if the operand is true
Equivalent operation for function
pow(x , y) is __. x**y
Which statement correctly assigns
X as an infinite number? - x=float('inf')
The bool class is subset of .- int
Which datatype is represented by
int in Python 3? -Long
What is the output of
min('Infinity')? - f
Which statements will result in
slice of tuple? - atuple[::2]atuple[:]
Empty list could be created with
list() alone. - False
While using slicing in lists,
list[0:2] is equivalent to . - list[:2]
bytearray provides an mutable
sequence (making it modifiable) - True
Which statements prevent the
escape sequence interpretation? - r'col\tcol2\tcol3
Using Pop in list will remove the
popped up item. - True
The class which provides immutable
sequence of elements - Tuple
Values in bytearray should be
integers between - 0-255
Which describes bytearrays? - Without an arguement
Which of these could be used in
tuple object - Sorted,Lens,max
Byte datatype can contain
only and - decimal & hexadecimal charecters
Which statement creates the bytes
literal when run? - bytes_literal=b'copyright
What is the output of
max('Infinity')? - y
Dictionary could be copied to
another dictionary using which of following syntax? - dicta=dictb.copy()
Empty dictionary is represented as
- {}
Consider b is frozen set, what
happen to b.add(3)? - Error as Frozen
sets cannot be modified
a.difference(b) highlights the . -
a - b
a.symmetricdifference(b) highlights
the _ a.union(b) - a.intersection(b)
All of these range types are
correct except ___ range(20,40,-2)
a = 0 if a: print("a's
value") else: print("Sorry nothing will get printed") - Sorry nothing will get printed
What is the output of the
following code? for x in (1,10,100): print (x) - 1 10 100
What is the output of below code
snippet - for char in 'Welcome': print (char, end='*') print() - w*e*l*c*o*m*e
What is the output of the
following code count = 0 while count < 2: print (count, " is less than
2") count = count + 2 else: print (count, " is not less than 2")
- 0 is less than 2; 2 is not less than 2
list[:] output would be printing
the __ Complete list
What will be output of below text.
info1 = 'Infinity' info1.find('a') - 0,-1
Code written in Python 3 is
backward compatible with Python 2. - True
------------------------------------------------------------------------------------------------------------
0 Comments