31. Which of the following will run without errors ?
a) round(45.8)
b) round(6352.898,2,5)
c) round()
d) round(7463.123,2,1)
32.What error occurs when you execute?
apple = mango
a) SyntaxError
b) NameError
c) ValueError
d) TypeError
33. In order to store values in terms of key and value we use what core data type.
a) list
b) tuple
c) class
d) dictionary
34.. What is the average value of the code that is executed below ?
>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2
a) 85
b) 85.1
c) 95
d) 95.1
35. What is the type of inf?
a) Boolean
b) Integer
c) Float
d) Complex
36. What is the output of the following?
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1
a) 1 2 3 4 5 6
b) 1 2 3 4 5 6 7
c) error
d) none of the mentioned
37. In which year was the Python language developed?
a) 1991
b) 1989
c) 1981
d) 1973
38.Which one of the following is the correct extension of the Python file?
a) .py
b) .python
c) .p
d) None of these
39. Which of the following is an invalid variable?
a) my_string_1
b) 1st_string
c) foo
d) _
40.Which of the following cannot be a variable?
a) __init__
b) in
c) it
d) on
41.Which is the correct operator for power(xy)?
a) X^y
b) X**y
c) X^^y
d) None of the mentioned
42.Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned
43. What is the answer to this expression, 22 % 3 is?
a) 7
b) 0
c) 1
d) 5
44.A function in Python begins with which keyword?
a) void
b) return
c) def
d) int
45.What do we use to define a block of code in Python language?
a) Key
b) Brackets
c) Indentation
d) None of these
46.Which character is used in Python to make a single line comment?
a) /
b) //
c) #
d) !
47.Which of the following option is not a core data type in the python language?
a) Dictionary
b) Lists
c) Class
d) All of the above
48.l = [ 4, 8, 9, 2.6, 5 ] is a type of which data type in python?
a) List
b) Tuple
c) Set
d) None of these
49.Correct way to declare a variable x of float data type in python:
a) x = 2.5
b) float x = 2.5
c) float(2.5)
d) All of the above
50.Special meaning words of Pythons, fixed for specific functionality are called ………. .
a) Identifiers
b) functions
c) Keywords
d) literals
51.Data items having fixed value are called ………. .
a) Identifiers
b) functions
c) Keywords
d) literals
52.Which of the following are keyword(s) ?
a) name
b) Print
c) print
d) output
53.Escape sequences are treated as ………. .
a) strings
b) characters
c) integers
d) none of these
54.Which of the following is an escape sequence for a tab character ?
a) \a
b) \t
c) \n
d) \b
55. Who developed the Python language?
(a)Zim Den
(b)Guido van Rossum
(c)Niene Stom
(d)Wick van Rossum
56.In which year was the Python 3.0 version developed?
(a)2008
(b)2000
(c)2010
(d)2005
57. In a Python program, a control structure:
(a) directs the order of execution of the statements in the program.
(b) dictates what happens before the program starts and after it terminates.
(c) defines program-specific data structures
(d) manages the input and output of control characters
58. An empty/null statement in Python is _____.
(a) go
(b) pass
(c) over
(d) ;
59. The order of statement execution in the form. of top to bottom, is known _____ as construct.
(a) selection
(b) repetition
(c)sequence
(d) flow
60. The _____ construct allows to choose statements to be executed, depending upon the result of a condition.
(a) selection
(b) repetition
(c)sequence
(d) flow
61. The _____ construct repeats a set of statements a specified number of times or as ng as a condition is true.
(a) selection
(b) repetition
(c)sequence
(d) flow
62. Which of the following statements will make a selection construct?
(a) if
(b) if-else
(c) for
(d) Both (a) and (b)
63. Which of the following statements will make a repetition construct?
(a) if
(b) if-else
(c) for
(d) while
64. In Python, which of the following will create a block in a compound statement ?
(a) colon
(b) statements indented at a lower, same level
(c) indentation in any form
(d) { }
65. What signifies the end of a statement block or suite in Python?
(a) A comment
(b) }
(c) end
(d) A line that is indented less than the previous line
66. Which one of the following if statements will not execute successfully?
(a)
if (1, 2) :
print('foo')
(b)
if (1, 2)
print('foo')
(c)
if (1, 2) :
print('foo')
(d)
if (1):
print('foo')
67. What does the following Python program display?
x = 3
if x == 8:
print ("Am I here?", end = '')
elif x == 3:
print("Or here?", end = "")
else:
pass
print ("Or over here?")
(a) Am I here?
(b) Or here?
(c) Am I here? Or here?
(d) Or here? Or over here ?
(e) Am I here? Or over here?
68. If the user inputs: 2<ENTER>, what does the following code snippet print ?
x = float(input())
if(x == 1):
print("Yes")
elif (x >= 2):
print("Maybe")
else:
print ("No")
(a) Yes
(b) No
(c) Maybe
(d) Nothing is printed
(e) Error
_____________________________________________________
Case Study
_____________________________________________________
a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))
if a <= 0:
b = b + 1
else:
a = a + 1
if a > 0 and b > 0:
print("W")
elif a > 0:
print("X")
if b > 0:
print("Y")
else:
print("Z")
69. What letters will be printed if the user enters 0 for a and 0 for b?
(a) Only W
(b) Only X
(c) Only Y
(d) W and X
(e) W, X and Y
70. What letters will be printed if the user enter; for a and 1 for b ?
(a) W and X
(b) W and Y
(c) X and Y
(d) X and Z
(e) W, X and Y
71. What letters will be printed if the user enter 1 for a and -1 for b?
(a) W and X
(b) X and Y
(c) Y and Z
(d) X and Z
(e) W and Z
72. What letters will be printed if the user enter 1 for a and 0 for b?
(a) W and X
(b) X and Y
(c) Y and Z
(d) X and Z
(e) W and Z
73. What letters will be printed if the user enter -1 for a and -1 for b?
(a) Only W
(b) Only X
(c) Only Y
(d) Only Z
(e) No letters are printed
_______________________________________________________
74. Which of the following is not a valid loop a in Python ?
(a) for
(b) while
(c) do-while
(d) if-else
75. Function range(3) is equivalent to :
(a) range(1, 3)
(b) range(0, 3)
(c) range(0, 3, 1)
(d) range(1, 3, 0)
76. Function range(3) will yield an iteratable sequence like
(a) [0, 1, 2]
(b) [0, 1, 2, 3]
(c) [1, 2, 3]
(d) [0, 2]
77. Function range(0, 5, 2) will yield on iteratable sequence like
(a) [0, 2, 4]
(b) [1, 3, 5]
(c) [0, 1, 2, 5]
(d) [0, 5, 2]
78. Function range(10, 5, -2) will yield an iteratable sequence like
(a) [10, 8, 6]
(b) [9, 7, 5]
(c) [6, 8, 10]
(d) [5, 7, 9]
79. Function range(10, 5, 2) will yield an iteratable sequence like
(a) [ ]
(b) [10, 8, 6]
(c) [2, 5, 8]
(d) [8, 5, 2]
80.Which of the following is an escape sequence for a newline character ?
(a) \a
(b) \t
(c) \n
(d) \b
81.Which of the following is not a legal integer type value in Python ?
(a) Decimal
(b) Octal
(c) Hexadecimal
(d) Roman
82.Which of the following value is not legal in an octal value ?
(a) 7
(b) 8
(c) 11
(d) 0
83.The lines beginning with a certain character, and which are ignored by a compiler and not executed, are called ……….
(a) operators
(b) operands
(c) functions
(d) comments
84. Which of the following functions print the output to the console ?
(a) Output( )
(b) Print( )
(c) Echo( )
(d) print( )
85. Select the reserved keyword in Python.
(a) else
(b) import
(c) print
(d) all of these
86. To convert the read value through input( ) into integer type, ……….( ) is used.
(a) floating
(b) float
(c) int
(d) integer
87. The input( ) returns the value as ………. type.
(a) integer
(b) string
(c) floating point
(d) none of these
88.To print a line a text without ending it with a newline, ………. argument is used with print( )
(a) sep
(b) newline
(c) end
(d) next
89.The default separator character of print( ) is ……….
(a) tab
(b) space
(c) newline
(d) dot
90. Python is____
(a) High-Level
(b) Interpreted
(c) Object-Oriented
(d) All Of The Above
91. Which symbol denotes the python prompt?
(a) >>>
(b) #
(c) ”’
(d) //
92.Which of the following is a valid string literal?
(a) “PythonMcq”
(b) ‘PythonMcq’
(c) ”’PythonMcq”’
(d) All of these
93.How many keywords present in the python programming language?
(a) 32
(b) 61
(c) 33
(d) 27
94.Which of the following keywords is not reversed keyword in python?
(a) None
(b) class
(c) goto
(d) and
95.Which of the following declarations is incorrect in python language?
(a)xyzp = 5,000,000
(b)x y z p = 5000 6000 7000 8000
(c)x,y,z,p = 5000, 6000, 7000, 8000
(d)x_y_z_p = 5,000,000
96.Which of the following operators is the correct option for power(ab)?
(a)a ^ b
(b)a**b
(c)a ^ ^ b
(d)a ^ * b
97. Which one of the following has the highest precedence in the expression?
(a)Division
(b)Subtraction
(c)Power
(d)Parentheses
98.Which of the following functions is a built-in function in python language?
(a)val()
(b)print()
(c)Print()
(d)None of these
99.Study the following code:
>>>"javatpoint"[5:]
What will be the output of this code?
(a)javatpoint
(b)java
(c)point
(d)None of these
100._____________ is fetching data from the storage devices for processing.
a. Data Capturing
b. Data Storage
c. Data Retrieval
d. None of the above