Python MCQ Quiz Hub

Python Mcq Set 3

Choose a topic to test your knowledge and improve your Python skills

What will be the output of the following Python code? hex(255), int('FF', 16), 0xFF





✅ Correct Answer: 4

What will be the output of the following Python code? '{a}{b}{a}'.format(a='hello', b='world')





✅ Correct Answer: 3

What will be the output of the following Python code? D=dict(p='san', q='foundry') '{p}{q}'.format(**D)





✅ Correct Answer: 2

What will be the output of the following Python code? 'The {} side {1} {2}'.format('bright', 'of', 'life')





✅ Correct Answer: 1

What will be the output of the following Python code? '{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456)





✅ Correct Answer: 4

What will be the output of the following Python code? '%.2f%s' % (1.2345, 99)





✅ Correct Answer: 2

What will be the output of the following Python code? '%s' %((1.23,),)





✅ Correct Answer: 1

What will be the output of the following two codes? i. '{0}'.format(4.56) ii. '{0}'.format([4.56,])





✅ Correct Answer: 2

Who developed Python Programming Language?





✅ Correct Answer: 3

Which type of Programming does Python support?





✅ Correct Answer: 4

Which of the following is the correct extension of the Python file?





✅ Correct Answer: 3

Is Python code compiled or interpreted?





✅ Correct Answer: 2

All keywords in Python are in _____





✅ Correct Answer: 4

Which of the following is used to define a block of code in Python language?





✅ Correct Answer: 1

Which keyword is used for function in Python language?





✅ Correct Answer: 2

Which of the following character is used to give single-line comments in Python?





✅ Correct Answer: 3

What will be the output of the following Python code? i = 1 while True: if i%3 == 0: break print(i) i + = 1





✅ Correct Answer: 2

Which of the following functions can help us to find the version of python that we are currently working on?





✅ Correct Answer: 1

Python supports the creation of anonymous functions at runtime, using a construct called __________





✅ Correct Answer: 3

What is the order of precedence in python?





✅ Correct Answer: 4

What does pip stand for python?





✅ Correct Answer: 3

What does pip stand for python?





✅ Correct Answer: 3

Which of the following is true for variable names in Python?





✅ Correct Answer: 2

Which of the following is the truncation division operator in Python?





✅ Correct Answer: 2

Which of the following functions is a built-in function in python?





✅ Correct Answer: 2

What will be the output of the following Python function? min(max(False,-3,-4), 2,7)





✅ Correct Answer: 4

Which of the following is not a core data type in Python programming?





✅ Correct Answer: 3

Which of these is the definition for packages in Python?





✅ Correct Answer: 2

What will be the output of the following Python function? len(["hello",2, 4, 6])





✅ Correct Answer: 3

What will be the output of the following Python code? x = 'abcd' for i in x: print(i.upper())





✅ Correct Answer: 4

What is the order of namespaces in which Python looks for an identifier?





✅ Correct Answer: 3

What will be the output of the following Python statement? >>>"a"+"bc"





✅ Correct Answer: 2

hich function is called when the following Python program is executed? f = foo() format(f)





✅ Correct Answer: 3

Which one of the following is not a keyword in Python language?





✅ Correct Answer: 2

Which of the following statements is used to create an empty set in Python?





✅ Correct Answer: 4

To add a new element to a list we use which Python command?





✅ Correct Answer: 3

What will be the output of the following Python code? print('*', "abcde".center(6), '*', sep='')





✅ Correct Answer: 2

Which one of the following is the use of function in python?





✅ Correct Answer: 3

What is the maximum possible length of an identifier in Python?





✅ Correct Answer: 4

What will be the output of the following Python program? i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0)





✅ Correct Answer: 3

What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i)





✅ Correct Answer: 4

What are the two main types of functions in Python?





✅ Correct Answer: 3

What will be the output of the following Python program? def addItem(listParam): listParam += [1] mylist = [1, 2, 3, 4] addItem(mylist) print(len(mylist))





✅ Correct Answer: 1

Which of the following is a Python tuple?





✅ Correct Answer: 4

What will be the output of the following Python code snippet? z=set('abc$de') 'a' in z





✅ Correct Answer: 2

What will be the output of the following Python expression? round(4.576)





✅ Correct Answer: 3

Which of the following is a feature of Python DocString?





✅ Correct Answer: 4

What will be the output of the following Python code? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))





✅ Correct Answer: 3

What is output of print(math.pow(3, 2))?





✅ Correct Answer: 1

Which of the following is the use of id() function in python?





✅ Correct Answer: 2

What will be the output of the following Python code? x = [[0], [1]] print((' '.join(list(map(str, x))),))





✅ Correct Answer: 4

The process of pickling in Python includes ______





✅ Correct Answer: 1

What will be the output of the following Python code? def foo(): try: return 1 finally: return 2 k = foo() print(k)





✅ Correct Answer: 3

What will be the output of the following Python code? class tester: def __init__(self, id): self.id = str(id) id="224" >>>temp = tester(12) >>>print(temp.id)





✅ Correct Answer: 1

What will be the output of the following Python program? def foo(x): x[0] = ['def'] x[1] = ['abc'] return id(x) q = ['abc', 'def'] print(id(q) == foo(q))





✅ Correct Answer: 4