Python Programing: Multiple Choice Questions (MCQs) with Answers

Python Programming MCQs

JIT stands for ____
A. Just-in-Time
B. Java-interpreter
C. Just-Interpreter
D. Java-in-Time
ANSWER: A

What will be the output of the following Python code?
x = 123
for i in x:
    print(i)
A.  1 2 3
B.  123
C.  error
D.   none of the mentioned
ANSWER:   C

IDE stands for _____
A. Internal Development Environment
B. Integrated Development Environment
C. Internal Debug Environment
D. Integrated Debug Environment
ANSWER: B
 
What is the output of the code?
x = 36 / 4 * (3 + 2) * 4 + 2
print(x)
A. 182.0
B. 37
C. 117
D. The Program executed with errors
ANSWER: A

The default input type in python is:
A. String
B. Int
C. Boolean
D. Void
ANSWER: A

Suppose t = (1, 2, 4, 3), which of the following is incorrect?
A.  print(t[3]) 
B.  t[3] = 45 
C.  print(max(t))
D.   print(len(t))
ANSWER:   B

Suppose list1 is [11, 14, 25, 30, 50], what is list1.index(50)?
A.  error
B.  none
C.  4
D.   5
ANSWER:  C

Which of the following statement is false?
A. Lists are mutable and Strings are immutable
B. Dictionaries are mutable and Tuples are immutable
C. Lists are mutable and Tuples are immutable
D. Strings are mutable and Tuples are immutable
ANSWER: D

Which of the following statement(s) is/are false?
A. A variable is basically a name that represents (or refers to) some value
B. Function is like a little program that you can use to perform a specific action
C. Modules are extensions that can be imported into Python to extend its capabilities.
D. Python does not support Unicode Strings
ANSWER: D

State the output of these two statements:
>>>a, b, c = 10, a+20, b+30
>>>print(a,b,c)
A. 10, 30, 60
B. 10, 20, 30
C. Any random values
D. Error
ANSWER: D

Which of the following statement is/are True?
A. >>> 'Apple'.lower() == 'APPLE'.lower()
B. >>> [1, 2] < [2, 1]
C. Both A & B
D. None of the A & B
ANSWER: C

Suppose list1 is [22, 33, 44, 55, 66], What is list1[-2+1]?
A.  22
B.  55
C.  66
D.   error
ANSWER: C 

To end a loop before the condition occurrence, you use ____
A. break
B. continue
C. skip
D. None of these
ANSWER: A

To skip subsequent steps of a program block based on certain condition, we use ______
A. break
B. continue
C. skip
D. None of these
ANSWER: B
 
What is the output when we execute- 
list("hello")?
A. ['h', 'e', 'l', 'l', 'o']
B. [‘hello’]
C. 'hello'
D. Error
ANSWER: A

State the output of the statement-
 >>>min(max(average([1,3,5,7,9])))
A. 5
B. 1
C. 9
D. Error
ANSWER: D

What is the correct method to load a module in python?
A. include math
B. import math
C. #include math.h
D. using math  
ANSWER:  B

Suppose list1 is [1, 5, 9], what is sum(list1)?
A. 1
B. 9
C. 15
D. Error
ANSWER: C

Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
A. Error
B. None
C. 25
D. 2
ANSWER: C

What is the output of the code: print (9//2)?
A. 4
B. 4.5
C. 5
D. Error
ANSWER: A

What is the output of the following program:
i = 0
while i < 5:
       print (i)
       i+=2
A. 0, 2, 4
B. 1, 2, 4
C. None of these
D. Error
ANSWER: A

Guess the correct output of the following String operations:
str1 = 'Welcome'
print(str1*2)
A. WelcomeWelcome
B. TypeError: unsupported operand type(s) ...
C. None of these
D. No output

What will be the output of the Python expression? 24//6%3, 24//4//2
A. (1, 3)
B. (0, 3)
C. (1, 0)
D.  error
ANSWER:   A
 
What is the output of the following string comparison
print("John" > "Jhon")
print("Emma" < "Emm")
A. True False
B. True True
C. False True
D. False False
ANSWER: A

Strings are immutable in Python, which means a string cannot be modified.
A. True
B. False
C. Depends on the string
D. None of these
ANSWER: A

Which of the following Boolean expressions is not logically equivalent to the other three?
A. not(-6<0 or-6>10)
B. -6>=0 and -6<=10
C. not(-6<10 or-6==10)
D. not(-6>10 or-6==10)
ANSWER:  D

What is the output of the code: print(bool(0), bool(3.14159), bool(-3))
A. False True True
B. False True False
C. True True True
D. False False False
ANSWER: A

What will be the output of the following Python code?
d = {"jagdeesh":40, "manpreet":45}
d["jagdeesh"]
A.  40
B.  45
C.  "jagdeesh"
D.   "manpreet"
ANSWER:   A

What will be the output of the following Python code?
i = 1
while False:
    if i%2 == 0:
        break
    print(i)
    i += 2
A. 1
B. 1 3 5 7 …
C. 1 2 3 4 …
D. none of the mentioned
ANSWER: D

Which of the following is/are Core Native Data Types in Python?
A. Strings (str)
B. Lists (list)
C. Tuples (tuple)
D. All these
ANSWER:  D

Suppose list1 is [22, 33, 44, 555, 66], What is list1[:-1]?
A.  [22, 33, 44]
B.  [22, 33, 44, 555, 66]
C.  [22, 33, 44, 555] 
D.   error
ANSWER:   D

Out of list and tuple which are mutable?  
A.  tuples 
B.  list
C.  both are mutable
D.   none is mutable
ANSWER:   B

In python which keyword is used to start a function? 
A. function
B. def
C. try   
D. import
ANSWER: B

Which of the following expressions results in an error?
A.  float(‘10’)
B.  int(‘10’)
C.  int(’10.8’)
D.   all these
ANSWER:   C

Suppose list1 is [1, 3, 5], What is list1 * 2?
A.  [2, 6, 10]
B.  [1, 3, 5, 1, 3, 5]
C.  none
D.   error
ANSWER: B

Which among the list of operators has the highest precedence?  +, -, **, %, /, <<, >>, |
A. <<, >> 
B. **
C. |
D.  %
ANSWER:   B

What will be the value of the Python expression? float(4+int(3.39)%2)
A.  4.0 
B.  5.0
C.  error
D.   none
ANSWER:   B

Which of the following operator in python evaluates to true if it does not finds a variable in the specified sequence and false otherwise? 
A. ** 
B. // 
C.  is 
D.  not in  
ANSWER:   D

What does the operator // do in Python?
A. Float division 
B. Integer division 
C. returns remainder 
D. same as a**b  
ANSWER:   B

What arithmetic operators cannot be used with strings?
A.  +
B.   *
C.  -
D.   All of these
ANSWER:   C

Which of the following commands will create a list?
A.  list1 = list()
B.  list1 = []
C.  list1 = list([1, 2, 3])
D.   all of the mentioned
ANSWER:   D

What will be the output of the following Python code?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
    print(x)
A.  0 1 2
B.  a b c
C.  0 a   1 b   2 c
D.   none of the mentioned
ANSWER:   B

What will be the output of the following Python code snippet?
x = 2
for i in range(x):
    x -= 2
    print (x)
A.  0 1 2 3 4
B.  0 -2
C.  0
D.   error
ANSWER:  B 

What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
    i.upper()
print(x)
A.  [‘ab’, ‘cd’] 
B.  [‘AB’, ‘CD’]
C.  [None, None]
D.   none of the mentioned
ANSWER:   A

What will be the output of the following Python code?
t=(1,2,4,3)
t[1:-1]
A.  (2, 4, 3) 
B.  (2, 4) 
C.  (1, 2, 4)
D.   error
ANSWER:   B  
 
What will be the output of the following Python code?
t1 = (1, 2, 4, 3)
t2 = (1, 2, 3, 4)
t1 < t2
A.  True 
B.  False
C.  Error
D.   None of these
ANSWER:   B

What is the output when we execute list(“hello”)?
A.  [‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
B.  [‘hello’]
C.  [‘llo’]
D.  [‘olleh’]
ANSWER:  A

Which of the following statement is false with respect to Python?
A. Python is a domain-specific language.
B. Python is well suited to data analysis, econometrics and statistics.
C. The basic numeric data type in Python is a 1-dimensional scalar.
D. None of these
ANSWER:  A

Which of the following is incorrect?
A. x = 0b101
B. x = 0x4f5
C. x = 19023
D. x = 03964
ANSWER: D

What does 3 ^ 4 evaluate to?
A. 81
B. 12
C. 0.75
D. 7
ANSWER: D
Python Programing: Multiple Choice Questions (MCQs) with Answers Python Programing: Multiple Choice Questions (MCQs) with Answers Reviewed by Green Voice India on September 19, 2020 Rating: 5

No comments:

Powered by Blogger.