Q.1 The following options are the salient features of Python except ___________.
A. Limited platform support
B. Simple to learn and understand
C. Broad standard library
D. Open source
Ans : Limited platform support
Q.2 The two main versions of Python include ___________.
A. Python 3.x and 4.x
B. Python 3.x and 6.x
C. Python 2.x and 3.x
D. Python 3.x and 5.x
Ans : Python 2.x and 3.x
Q.3 When using the Python shell and code block, what triggers the interpreter to begin evaluating a block of code?
A. Closed parenthesis
B. Semi colon symbol
C. Blank line
D. Colon symbol
E. Execute command
Ans : Blank line
Q.4 While using Python IDLE, by how many spaces are the code suites indented?
A. 1
B. 2
C. 3
D. 4
E. 5
Ans : 4
Q.5 Python supports automatic garbage collection.
A. True
B. False
Ans : True
Q.6 Is x, y = 5, 6 a valid statement?
A. True
B. False
Ans : True
Q.7 What command is used to output text from both the Python shell and within a Python module?
A. System.out.println()
B. count_print()
C. OutputStream()
D. print()
Ans : print()
Q.8 Equivalent operation for function pow(x, y) is __________.
A. x * y
B. x ** y
C. x // y
D. x ^ y
Ans : x ** y
Q.9 Which statement accurately defines the bool class?
A. Boolean first returns False then the True value
B. Boolean Not returns False if the operand is True
C. Zero values are considered True always
D. Bool class is a subclass of array class
Ans : Boolean Not returns False if the operand is True
Q.10 Which statement creates the bytes literal when run?
A. bytes_literal = bytes(str_literal,’utf-8′)
B. bytes_literal = b’Copyright xc2xa9′
C. bytes_literal = bytes.encoded.count(0x54)
D. bytes_literal = bytes.str.count(0x54)
Ans : bytes_literal = b’Copyright xc2xa9′
Q.11 Values in bytearray should be integers between ___________.
A. 0-512
B. 0-255
C. 0-1024
D. 0-63
Ans : 0-255
Q.12 Which statements prevent the escape sequence interpretation?
A. subtext’coltcol2tcol3t’
B. col1tcol2tcol3t
C. escape’coltcol2tcol3t’
D. r’coltcol2tcol3t’
Ans : r’coltcol2tcol3t’
Q.13 a.difference(b) highlights the ________.
A. a.union(b) – a.intersection(b)
B. a – b
C. a.union(b) – b.intersection(b)
D. a.intersection(b) – a.union(b)
Ans : a – b
Q.14 All of these range types are correct except ______.
A. range(20,40,-2)
B. range(20,20,30)
C. range(20,40,’-2′)
D. range(20,20,2)
Ans : range(20,40,’-2′)
Q.15 Dictionary could be copied to another dictionary using which of following syntax?
A. dict_a = dict_b.clear()
B. dict_a = copy(dict_b)
C. dict_a=dict_b.copy()
D. dict_a = dict_b
Ans : dict_a=dict_b.copy()
Q.16 What is the output of the following code?
for x in range(1,100, 10):
print(x)
A. 1 11 21 31 41 51 61 71 81 91
B. 2 20 200
C. Error
D. 2-20-200
Ans : 1 11 21 31 41 51 61 71 81 91
Q.17 What is the output of the following code snippet?
for char in ‘Welcome’:
print (char, end=’*’)
print()
A. W*e*l*c*o*m*e*
B. Welcome*
C. Welcome*******
D. Error
Ans : W*e*l*c*o*m*e*
Q.18 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″)
A. Error
B. 0 is less than 2; 2 is not less than 2
C. 2 is not less than 2
D. 1 is less than 2; 3 is not less than 2
Ans : 0 is less than 2; 2 is not less than 2
Q.19 What is the output of the following code? for x in (1,10,100): print (x)
A. 1
10
100
B. error
C. 110100
D. 1 10 100
Ans : error
Q.20 Consider b is frozen set, what happens to b.add(3)?
A. 3 will be added as a constant
B. 3 will not be available for other general operations
C. Error as frozen sets cannot be modified
Ans : Error as frozen sets cannot be modified
Q.21 What is the output of bool(0)?
A. 1
B. Valid
C. False
D. True
Ans : False
Q.22 The class that provides immutable sequence of elements is ______________.
A. byte
B. string
C. list
D. tuple
Ans : tuple
Q.23 Which datatype is represented by int in Python 3?
A. Long
B. Decimal
C. Float
D. Short
Ans : Long
Q.24 Using Pop in list will remove the popped up item.
A. True
B. False
Ans : True
Q.25 Python is Ubiquitous. Is the statement true or false?
A. True
B. False
Ans : True
Q.26 While using slicing in lists, list[0:2] is equivalent to ______.
A. list[0:3] -1
B. list[:2]
C. list[:-2]
D. list[-2:0]
Ans : list[:2]
Q.27 Which of these packages in Python help with scientific applications of Python?
A. SciPy and NumPy
B. ResearPy and AnalPy
C. MathPy and LabPy
D. Pygame and Pysci
Ans : SciPy and NumPy
Q.28 Which of these methods can be used with list objects, except ?
A. Reverse , Clear
B. Pop . Clear
C. Decode, Lambda
D. Reverse , Pop
Ans : Decode, Lambda
Q.29 What will be the output of below text?
info1 = ‘Infinity’
info1.find(‘a’)
A. -1
B. 0
C. infinity
D. 1
E. nan
Ans : -1
Q.30 Which methods can be used with list objects?
A. Lambda , Pop , Clear
B. Reverse , Decode, Lambda
C. Reverse , Pop , Clear
D. Decode , Pop , Clear
Ans : Reverse , Pop , Clear
Q.31 What characteristics describe the python programming language ?
A. Assembly compiled
B. Interpreted and open source
C. Interpreted and compiled
Ans : Interpreted and open source
Q.32 Which is the fastest implementation of Python?
A. Iron Python
B. CPython
C. Jython
D. Pypy
Ans : Pypy
Q.33 What is the output of min(‘Infinity’)?
A. 0
B. I
C. y
D. f
Ans : I
Q.34 Which of these could be used in tuple object
A. Sorted, Lens , Max
B. Append
C. Reverse , Max
Ans : Sorted, Lens , Max
Q.35 Which action should be avoided so that you do not mistakenly overwrite names that you have already defined?
A. use the wildcard import
B. Using aliases when importing
C. import selectively with aliases
D. import selective objects
Ans : use the wildcard import
Q.36 Which statement accurately defines the bool class?
A. Zero values are considered True some times.
B. Boolean Not returns False if the operand is True
C. Zero values are considered True always
D. Bool class is subclass of array class
Ans : Boolean Not returns False if the operand is True
Q.37 Which statements will result in slice of tuple?
A. a_tuple[0] =[5] a_tuple[::2]
B. a_tuple[::-1] a_tuple[0] =[5]
C. a_tuple[::2] a_tuple[:]
D. a_tuple[:] a_tuple[::-1]
Ans : a_tuple[::2] a_tuple[:]
Q.38 Which of these packages in python helps with scientific applications of Python ?
A. ResearPy & AnalPy
B. SciPy & NumPy
C. Pygame & Pysci
D. MathPy & LabPy
Ans : SciPy & NumPy
Q.39 Which of these is Desktop applications is created using Python ?
A. Sametime
B. Blender
C. Webscripting
D. Drop box
Ans : Drop box
Q.40 Which of the following attributes shows the characteristics of Python? Python is everywhere (Webscripting, 3D Modelling , Games , and Desktop applications ).
A. Ubiquity
B. Broad Standard Library
C. Powerful interpreter
D. Object Oriented
Ans : Ubiquity
Q.41 Python supports automatic garbage collection.
A. True
B. False
Ans : True
Q.42 Bitwise operators cannot be used on the float type.
A. True
B. False
Ans : True
Q.43 Python supports automatic garbage collection.
A. True
B. False
Ans : True