PYTHON QUIZ DESCRIPTION Total Questions −30 00 Max Time − 15:00 Which of the following functions is a built-in function in python? factorial() print() seed() sqrt() Which module in the python standard library parses options received from the command line? getarg getopt main os Python supports the creation of anonymous functions at runtime, using a construct called __________ pi anonymous lambda none of the mentioned What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i) error 1 2 3 4 a b c d 0 1 2 3 Which of the following is not a core data type in Python programming? Tuples Lists Class Dictionary Which of the following is the correct extension of the Python file? .python .pl .py .p What will be the output of the following Python code? x = 'abcd' for i in x: print(i.upper()) a B C D a b c d error A B C D Which of the following is true for variable names in Python? underscore and ampersand are the only two special characters allowed unlimited length all private members must have leading and trailing underscores none of the mentioned What will be the output of the following Python code snippet? for i in [1, 2, 3, 4][::-1]: print (i) 4 3 2 1 error 1 2 3 4 none of the mentioned What will be the output of the following Python code? i = 1 while True: if i%3 == 0: break print(i) i + = 1 1 2 3 error none of the mentioned 1 2 What will be the value of the following Python expression? 4 + 3 % 5 7 2 4 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)) Error None false True What will be the output of the following Python program? z=set('abc') z.add('san') z.update(set(['p', 'q'])) z {‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’} {‘abc’, ‘p’, ‘q’, ‘san’} {‘a’, ‘b’, ‘c’, ‘p’, ‘q’, ‘san’} {‘a’, ‘b’, ‘c’, [‘p’, ‘q’], ‘san} Which type of Programming does Python support? object-oriented programming structured programming functional programming all of the mentioned Which of the following is used to define a block of code in Python language? Indentation Key Brackets All of the mentioned Which one of the following is not a keyword in Python language? pass eval assert nonlocal Which of the following functions can help us to find the version of python that we are currently working on? sys.version(1) sys.version(0) sys.version() sys.version What is the order of precedence in python? Exponential, Parentheses, Multiplication, Division, Addition, Subtraction Exponential, Parentheses, Division, Multiplication, Addition, Subtraction Parentheses, Exponential, Multiplication, Division, Subtraction, Addition Parentheses, Exponential, Multiplication, Division, Addition, Subtraction What arithmetic operators cannot be used with strings in Python? + _ * All the mentioned What will be the output of the following Python code? print('*', "abcde".center(6), '*', sep='') * abcde * *abcde * * abcde* * abcde * 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) 12 224 None Error What will be the output of the following Python statement? "a"+"bc" bc abc a bca Which of the following is the truncation division operator in Python? | // / % What is the maximum possible length of an identifier in Python? 79 characters 31 characters 63 characters none of the mentioned Which of these is the definition for packages in Python? A set of main modules A folder of python modules A number of files containing Python definitions and statements A set of programs making use of Python modules What is the order of namespaces in which Python looks for an identifier? Python first searches the built-in namespace, then the global namespace and finally the local namespace Python first searches the built-in namespace, then the local namespace and finally the global namespace Python first searches the local namespace, then the global namespace and finally the built-in namespace Python first searches the global namespace, then the local namespace and finally the built-in namespace What will be the output of the following Python code snippet if x=1? x<<2 4 2 1 8 What will be the output of the following Python code? list1 = [1, 3] list2 = list1 list1[0] = 4 print(list2) [1, 4] [1, 3, 4] [4, 3] [1, 3] Which of the following character is used to give single-line comments in Python? // # ! /* What are the values of the following Python expressions? 2**(3**2) (2**3)**2 2**3**2 512, 64, 512 512, 512, 512 64, 512, 64 64, 64, 64 Previous Next Total Question16 Wrong Answer13 Right Answer13