Programming and Problem Solving through Python (M3 R5) /100 130 1 / 100 How many keyword arguments can be passed to a function in a single function call? एक फ़ंक्शन कॉल में किसी फ़ंक्शन में कितने कीवर्ड तर्क पारित किए जा सकते हैं? zero one zero or more one or more 2 / 100 What will be the value of the following Python expression? 4 + 3 % 5 7 2 4 1 3 / 100 Which of the following is true about top-down design process? टॉप-डाउन डिज़ाइन प्रक्रिया के बारे में निम्नलिखित में से कौन सा सत्य है? The details of a program design are addressed before the overall design Only the details of the program are addressed The overall design of the program is addressed before the details Only the design of the program is addressed 4 / 100 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 5 / 100 What will be the output of the following Python code snippet? z=set('abc$de') 'a' in z Error True False No output 6 / 100 What will be the output of the following Python code? l=[1, 0, 2, 0, 'hello', '', []] list(filter(bool, l)) [1, 0, 2, ‘hello’, ”, []] Error [1, 2, ‘hello’] [1, 0, 2, 0, ‘hello’, ”, []] 7 / 100 What will be the output of the following Python expression? round(4.5676,2)? निम्नलिखित पायथन अभिव्यक्ति का आउटपुट क्या होगा? गोल(4.5676,2)? 4.5 4.6 4.57 4.56 8 / 100 Which of the following is the use of id() function in python? पायथन में id() फ़ंक्शन का उपयोग निम्न में से किसमें किया जाता है? Id returns the identity of the object Every object doesn’t have a unique id All of the mentioned None of the mentioned 9 / 100 Which type of Programming does Python support? object-oriented programming structured programming functional programming all of the mentioned 10 / 100 Which of the following is the use of id() function in python? Every object in Python doesn’t have a unique id In Python Id function returns the identity of the object None of the mentioned All of the mentioned 11 / 100 Which of these is false about a package? पैकेज के बारे में इनमें से कौन सा गलत है? A package can have subfolders and modules Each import package need not introduce a namespace import folder.subfolder.mod1 imports packages from folder.subfolder.mod1 import objects imports packages 12 / 100 Where is function defined? फ़ंक्शन कहां परिभाषित किया गया है? Module Class Another function All of the mentioned 13 / 100 Which function is called when the following Python program is executed? f = foo() format(f) str() format() __str__() __format__() 14 / 100 Which keyword is used for function? Function के लिए कौन सा कीवर्ड प्रयोग किया जाता है? Fun Define def Function 15 / 100 Is Python code compiled or interpreted? Python code is both compiled and interpreted Python code is neither compiled nor interpreted Python code is only compiled Python code is only interpreted 16 / 100 What is the length of sys.argv? Sys.argv की लंबाई कितनी है? number of arguments number of arguments + 1 number of arguments – 1 none of the mentioned 17 / 100 Does Lambda contains return statements? क्या लैम्ब्डा में रिटर्न स्टेटमेंट शामिल हैं? True False 18 / 100 Which of the following is not a valid namespace? निम्नलिखित में से कौन सा वैध नामस्थान नहीं है? Global namespace Public namespace Built-in namespace Local namespace 19 / 100 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 20 / 100 What will be the output of the following Python expression if x=56.236? print("%.2f"%x) 56.236 56.23 56.0000 56.24 21 / 100 Where are the arguments received from the command line stored? कमांड लाइन से प्राप्त तर्क कहाँ संग्रहीत हैं? sys.argv os.argv argv none of the mentioned 22 / 100 Which of the following is not a core data type in Python programming? Tuples Lists Class Dictionary 23 / 100 Which of the following is false about “from-import” form of import? आयात के "आयात से" रूप के बारे में निम्नलिखित में से कौन सा गलत है? The syntax is: from modulename import identifier This form of import prevents name clash The namespace of imported module becomes part of importing module The identifiers in module are accessed directly as: identifier 24 / 100 Which of these is false about recursion? रिकर्सन के बारे में इनमें से कौन सा गलत है? Recursive function can be replaced by a non-recursive function Recursive functions usually take more memory space than non-recursive function Recursive functions run faster than non-recursive function Recursion makes programs easier to understand 25 / 100 The following python program can work with ____ parameters. def f(x): def f1(*args, **kwargs): print("Sanfoundry") return x(*args, **kwargs) return f1 any number of 0 1 2 26 / 100 What arithmetic operators cannot be used with strings in Python? * - + All of the mentioned 27 / 100 Which of the following is the use of id() function in python? Every object doesn’t have a unique id Every object doesn’t have a unique id All of the mentioned None of the mentioned 28 / 100 Which of the following is the use of function in python? पायथन में निम्नलिखित में से किस फ़ंक्शन का उपयोग होता है? Functions are reusable pieces of programs Functions don’t provide better modularity for your application you can’t also create your own functions All of the mentioned 29 / 100 Which of the following character is used to give single-line comments in Python? // # ! /* 30 / 100 Who developed Python Programming Language? Wick van Rossum Rasmus Lerdorf Guido van Rossum Niene Stom 31 / 100 Which of the following refers to mathematical function? निम्नलिखित में से कौन सा गणितीय फ़ंक्शन को संदर्भित करता है? sqrt rhombus add rhombus 32 / 100 Which module in the python standard library parses options received from the command line? पायथन मानक लाइब्रेरी में कौन सा मॉड्यूल कमांड लाइन से प्राप्त विकल्पों को पार्स करता है? getopt os getarg main 33 / 100 Which of the following is used to define a block of code in Python language? Indentation Key Brackets All of the mentioned 34 / 100 Which of the following is the correct extension of the Python file? .python .pl .py .p 35 / 100 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 1 2 none of the mentioned 36 / 100 Which are the advantages of functions in python? पायथन में फ़ंक्शंस के क्या फायदे हैं? Reducing duplication of code Decomposing complex problems into simpler pieces Improving clarity of the code All of the mentioned 37 / 100 What is the maximum possible length of an identifier in Python? 79 characters 31 characters 63 characters none of the mentioned 38 / 100 Which of these is the definition for packages in Python? क्या पायथन कोड संकलित या व्याख्यायित है? A folder of python modules A set of programs making use of Python modules A set of main modules A number of files containing Python definitions and statements 39 / 100 What is returned by math.ceil(3.4)? Math.ceil(3.4) द्वारा क्या लौटाया जाता है? 3 4 4.0 3.0 40 / 100 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 41 / 100 What will be the output of the following Python statement? >>>"a"+"bc" bc abc a bca 42 / 100 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 43 / 100 What is called when a function is defined inside a class? जब किसी फ़ंक्शन को किसी क्लास के अंदर परिभाषित किया जाता है तो उसे क्या कहा जाता है? Module Class Another function Method 44 / 100 What does pip stand for python? Pip Installs Python Pip Installs Packages Preferred Installer Program All of the mentioned 45 / 100 Which keyword is used for function in Python language? Function def Fun Define 46 / 100 In top-down design every module is broken into same number of submodules. टॉप-डाउन डिज़ाइन में प्रत्येक मॉड्यूल को समान संख्या में सबमॉड्यूल में विभाजित किया गया है। True False 47 / 100 Which of the following statements is used to create an empty set in Python? ( ) [ ] { } set() 48 / 100 What is output of print(math.pow(3, 2))? 9.0 None 9 None of the mentioned 49 / 100 What will be the output of the following Python expression? round(4.576) 4 4.6 5 4.5 50 / 100 The function complex(‘2-3j’) is valid but the function complex(‘2 – 3j’) is invalid. फ़ंक्शन कॉम्प्लेक्स ('2-3j') मान्य है लेकिन फ़ंक्शन कॉम्प्लेक्स ('2 - 3j') अमान्य है। TRUE False 51 / 100 Is Python case sensitive when dealing with identifiers? no yes machine dependent none of the mentioned 52 / 100 Which of the following isn’t true about main modules? मुख्य मॉड्यूल के बारे में निम्नलिखित में से कौन सा सत्य नहीं है? When a python file is directly executed, it is considered main module of a program Main modules may import any number of modules Special name given to main modules is: __main__ Other main modules can import main modules 53 / 100 What will be the output of the following Python expression? round(4.576) निम्नलिखित पायथन अभिव्यक्ति का आउटपुट क्या होगा? गोल(4.576) 4.5 5 4 4.6 54 / 100 Which of the following is a Python tuple? {1, 2, 3} {} [1, 2, 3] (1, 2, 3) 55 / 100 What will be the output of the following Python function? min(max(False,-3,-4), 2,7) -4 -3 2 False 56 / 100 Which of the following is a feature of Python DocString? In Python all functions should have a docstring Docstrings can be accessed by the __doc__ attribute on objects It provides a convenient way of associating documentation with Python modules, functions, classes, and methods All of the mentioned 57 / 100 What will be the output of the following Python code snippet if x=1? x<<2 4 2 1 8 58 / 100 What are the two main types of functions in Python? System function Custom function Built-in function & User defined function User function 59 / 100 How are required arguments specified in the function heading? फ़ंक्शन शीर्षक में आवश्यक तर्क कैसे निर्दिष्ट किए जाते हैं? identifier followed by an equal to sign and the default value identifier followed by the default value within backticks (“) identifier followed by the default value within square brackets ([]) identifier 60 / 100 The function divmod(a,b), where both ‘a’ and ‘b’ are integers is evaluated as: फ़ंक्शन divmod(a,b), जहां 'a' और 'b' दोनों पूर्णांक हैं, का मूल्यांकन इस प्रकार किया जाता है: (a%b, a//b) (a//b, a%b) (a//b, a*b) (a/b, a%b) 61 / 100 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 62 / 100 What will be the output of the following Python function? any([2>8, 4>2, 1>2]) निम्नलिखित पायथन फ़ंक्शन का आउटपुट क्या होगा? कोई([2>8, 4>2, 1>2]) Error True False 4>2 63 / 100 All keywords in Python are in _________ Capitalized lower case UPPER CASE None of the mentioned 64 / 100 What is output of print(math.pow(3, 2))? 9.0 None 9 None of the mentioned 65 / 100 What are the two main types of functions? दो मुख्य प्रकार के कार्य क्या हैं? Custom function Built-in function & User defined function User function System function 66 / 100 What is a variable defined inside a function referred to as? किसी फ़ंक्शन के अंदर परिभाषित वेरिएबल को क्या कहा जाता है? A global variable A volatile variable A local variable An automatic variable 67 / 100 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 68 / 100 Which of the following functions does not necessarily accept only iterables as arguments? निम्नलिखित में से कौन सा फ़ंक्शन आवश्यक रूप से केवल पुनरावर्तनीय को तर्क के रूप में स्वीकार नहीं करता है? enumerate() all() chr() max() 69 / 100 Which of the following functions is a built-in function in python? निम्नलिखित में से कौन सा फ़ंक्शन पायथन में एक अंतर्निहित फ़ंक्शन है? seed() sqrt() factorial() print() 70 / 100 Which one of the following is not a keyword in Python language? pass eval assert nonlocal 71 / 100 How are keyword arguments specified in the function heading? फ़ंक्शन शीर्षक में कीवर्ड तर्क कैसे निर्दिष्ट किए जाते हैं? one-star followed by a valid identifier one underscore followed by a valid identifier two stars followed by a valid identifier two underscores followed by a valid identifier 72 / 100 Which of the following is false about “import modulename” form of import? आयात के "आयात मॉड्यूलनाम" रूप के बारे में निम्नलिखित में से कौन सा गलत है? The namespace of imported module becomes part of importing module This form of import prevents name clash The namespace of imported module becomes available to importing module The identifiers in module are accessed as: modulename.identifier 73 / 100 How are default arguments specified in the function heading? फ़ंक्शन शीर्षक में डिफ़ॉल्ट तर्क कैसे निर्दिष्ट किए जाते हैं? identifier followed by an equal to sign and the default value identifier followed by the default value within backticks (“) identifier followed by the default value within square brackets ([]) identifier 74 / 100 What happens if a local variable exists with the same name as the global variable you want to access? यदि कोई स्थानीय चर उस वैश्विक चर के समान नाम के साथ मौजूद है जिसे आप एक्सेस करना चाहते हैं तो क्या होगा? Error The local variable is shadowed Undefined behavior The global variable is shadowed 75 / 100 What will be the output of the following Python function? all([2,4,0,6]) निम्नलिखित पायथन फ़ंक्शन का आउटपुट क्या होगा? सभी([2,4,0,6]) Error True False 0 76 / 100 To add a new element to a list we use which Python command? list1.addEnd(5) list1.addLast(5) list1.append(5) list1.add(5) 77 / 100 The function pow(x,y,z) is evaluated as: फ़ंक्शन pow(x,y,z) का मूल्यांकन इस प्रकार किया जाता है: (x**y)**z (x**y) / z (x**y) % z (x**y)*z 78 / 100 What is a variable defined outside a function referred to as? किसी फ़ंक्शन के बाहर परिभाषित वेरिएबल को क्या कहा जाता है? A static variable A global variable A local variable An automatic variable 79 / 100 Which is the most appropriate definition for recursion? पुनरावर्तन के लिए सबसे उपयुक्त परिभाषा कौन सी है? A function that calls itself A function execution instance that calls another execution instance of the same function A class method that calls another class method An in-built method that is automatically called 80 / 100 Python supports the creation of anonymous functions at runtime, using a construct called __________ pi anonymous lambda none of the mentioned 81 / 100 What is the type of sys.argv? Sys.argv का प्रकार क्या है? set list tuple string 82 / 100 Which of the following functions is a built-in function in python? factorial() print() seed() sqrt() 83 / 100 What will be the output of the following Python function? len(["hello",2, 4, 6]) Error 6 4 3 84 / 100 Python supports the creation of anonymous functions at runtime, using a construct called __________ पायथन __________ नामक निर्माण का उपयोग करके रनटाइम पर अज्ञात कार्यों के निर्माण का समर्थन करता है lambda pi anonymous none of the mentioned 85 / 100 What will be the output of the following Python code? print('*', "abcde".center(6), '*', sep='') * abcde * *abcde * * abcde* * abcde * 86 / 100 Which of the following is the truncation division operator in Python? | // / % 87 / 100 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 88 / 100 What is the type of each element in sys.argv? Sys.argv में प्रत्येक तत्व का प्रकार क्या है? set list tuple string 89 / 100 If a function doesn’t have a return statement, which of the following does the function return? यदि किसी फ़ंक्शन में रिटर्न स्टेटमेंट नहीं है, तो निम्न में से कौन सा फ़ंक्शन रिटर्न करता है? int null None An exception is thrown without the return statement 90 / 100 What will be the output of the following Python code? x = [[0], [1]] print((' '.join(list(map(str, x))),)) 01 [0] [1] (’01’) (‘[0] [1]’,) 91 / 100 What is the base case in the Merge Sort algorithm when it is solved recursively? मर्ज सॉर्ट एल्गोरिथ्म में आधार मामला क्या है जब इसे पुनरावर्ती रूप से हल किया जाता है? n=0 n=1 A list of length one An empty list 92 / 100 Only problems that are recursively defined can be solved using recursion. केवल पुनरावर्ती रूप से परिभाषित समस्याओं को ही पुनरावर्तन का उपयोग करके हल किया जा सकता है। True False 93 / 100 What is the value stored in sys.argv[0]? Sys.argv[0] में संग्रहीत मान क्या है? null you cannot access it the program’s name the first argument 94 / 100 Which one of the following is the use of function in python? Functions don’t provide better modularity for your application you can’t also create your own functions Functions are reusable pieces of programs All of the mentioned 95 / 100 Which module in the python standard library parses options received from the command line? getarg getopt main os 96 / 100 All modular designs are because of a top-down design process. सभी मॉड्यूलर डिज़ाइन टॉप-डाउन डिज़ाइन प्रक्रिया के कारण होते हैं। True False 97 / 100 How are variable length arguments specified in the function heading? फ़ंक्शन शीर्षक में परिवर्तनीय लंबाई तर्क कैसे निर्दिष्ट किए जाते हैं? one star followed by a valid identifier one underscore followed by a valid identifier two stars followed by a valid identifier two underscores followed by a valid identifier 98 / 100 What will be the output of the following Python code? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin'))) Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’) Error Hello foo and bin None of the mentioned 99 / 100 Is Python code compiled or interpreted? क्या पायथन कोड संकलित या व्याख्यायित है? Python code is only compiled Python code is both compiled and interpreted Python code is only interpreted Python code is neither compiled nor interpreted 100 / 100 What is the output of the function complex()? फ़ंक्शन कॉम्प्लेक्स() का आउटपुट क्या है? 0j 0+0j 0 Error Your score is LinkedIn Facebook Twitter VKontakte 0% /100 39 1 / 100 Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))? [x**-1 for x in [(1, 2, 3)]] [1/x for x in [(1, 2, 3)]] [1/x for x in (1, 2, 3)] error 2 / 100 What will be the output of the following Python expression? 4^12 2 4 8 12 3 / 100 What is the value of the following expression? 8/4/2, 8/(4/2) (1.0, 4.0) (1.0, 1.0) (4.0. 1.0) (4.0, 4.0) 4 / 100 The expression shown below results in an error. print("-%5d0",989) True False 5 / 100 Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)? [3, 4, 5, 20, 5, 25, 1, 3] [1, 3, 3, 4, 5, 5, 20, 25] [3, 5, 20, 5, 25, 1, 3] [1, 3, 4, 5, 20, 5, 25] 6 / 100 Which of the following is a Python tuple? [1, 2, 3] (1, 2, 3) {1, 2, 3} {} 7 / 100 The one’s complement of 110010101 is: 001101010 110010101 001101011 110010100 8 / 100 Which of the following is an invalid statement? abc = 1,000,000 a b c = 1000 2000 3000 a,b,c = 1000, 2000, 3000 a_b_c = 1,000,000 9 / 100 What will be the output of the following Python code? l=list('HELLO') 'first={0[0]}, third={0[2]}'.format(l) ‘first=H, third=L’ ‘first=0, third=2’ Error ‘first=0, third=L’ 10 / 100 What will be the output of the following Python expression if X = -122? print("-%06d"%x) -000122 000122 –00122 -00122 11 / 100 Which of the following is invalid? _a = 1 __a = 1 __str__ = 1 none of the mentioned 12 / 100 To shuffle the list(say list1) what function do we use? list1.shuffle() shuffle(list1) random.shuffle(list1) random.shuffleList(list1) 13 / 100 What will be the output of the following Python code snippet? print('ab cd-ef'.title()) Ab cd-ef Ab Cd-ef Ab Cd-Ef None of the mentioned 14 / 100 Which of the following operators has its associativity from right to left? + // % ** 15 / 100 What will be the output of the following Python code snippet? print('abcd'.translate({97: 98, 98: 99, 99: 100})) bcde abcd error none of the mentioned 16 / 100 hat will be the output of the following Python code? d = {"john":40, "peter":45} d["john"] 40 45 “john” “peter” 17 / 100 What will be the output of the following Python code snippet? print([i+j for i in "abc" for j in "def"]) [‘da’, ‘ea’, ‘fa’, ‘db’, ‘eb’, ‘fb’, ‘dc’, ‘ec’, ‘fc’] [[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]] [[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]] [‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’] 18 / 100 Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()? [3, 4, 5, 20, 5, 25, 1, 3] [1, 3, 3, 4, 5, 5, 20, 25] [25, 20, 5, 5, 4, 3, 3, 1] [3, 1, 25, 5, 20, 5, 4, 3] 19 / 100 Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])? [3, 4, 5, 20, 5, 25, 1, 3, 34, 5] [1, 3, 3, 4, 5, 5, 20, 25, 34, 5] [25, 20, 5, 5, 4, 3, 3, 1, 34, 5] [1, 3, 4, 5, 20, 5, 25, 3, 34, 5] 20 / 100 What will be the output of the following Python expression if the value of x is 34? print(“%f”%x) 34.00 34.0000 34.000000 34.00000000 21 / 100 What is the maximum possible length of an identifier? 31 characters 63 characters 79 characters none of the mentioned 22 / 100 What will be the output of the following Python code? >>>t = (1, 2) >>>2 * t (1, 2, 1, 2) [1, 2, 1, 2] (1, 1, 2, 2) [1, 1, 2, 2] 23 / 100 What will be the output of the following Python code snippet? X=”hi” print(“05d”%X) 00000hi 000hi hi000 error 24 / 100 Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’? print(“-ns”%S) print(“-ns”%S) print(“%ns”%S) print(“%-ns”%S) 25 / 100 What will be the output of the following Python code snippet? x = [i**+1 for i in range(3)]; print(x); [0, 1, 2] [1, 2, 5] error, **+ is not a valid operator error, ‘;’ is not allowed 26 / 100 Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()? [3, 4, 5, 20, 5, 25, 1] [1, 3, 3, 4, 5, 5, 20, 25] [3, 5, 20, 5, 25, 1, 3] [1, 3, 4, 5, 20, 5, 25] 27 / 100 Suppose list1 is [1, 5, 9], what is sum(list1)? 1 9 15 Error 28 / 100 Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1. OR AND XOR NOT 29 / 100 What will be the output of the following Python code snippet? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'})) abcd 1234 error none of the mentioned 30 / 100 The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. True False 31 / 100 What will be the output of the following Python code? '{0:f}, {1:2f}, {2:05.2f}'.format(1.23456, 1.23456, 1.23456) Error ‘1.234560, 1.22345, 1.23’ No output ‘1.234560, 1.234560, 01.23’ 32 / 100 The output of the two codes shown below is the same. i. bin((2**16)-1) ii. '{}'.format(bin((2**16)-1)) True False 33 / 100 What will be the output of the following Python code? >>>t = (1, 2, 4, 3, 8, 9) >>>[t[i] for i in range(0, len(t), 2)] [2, 3, 9] [1, 2, 4, 3, 8, 9] [1, 4, 8] (1, 4, 8) 34 / 100 Which of the following is not a complex number? k = 2 + 3j k = complex(2, 3) k = 2 + 3l k = 2 + 3J 35 / 100 What will be the output of the following Python code? '{a}{b}{a}'.format(a='hello', b='world') ‘hello world’ ‘hello’ ‘world’ ‘hello’ ‘helloworldhello’ ‘hello’ ‘hello’ ‘world’ 36 / 100 What will be the output of the following Python expression if X=345? print(“%06d”%X) 345000 000345 000000345 345000000 37 / 100 What does 3 ^ 4 evaluate to? 81 12 0.75 7 38 / 100 What is the value of the following expression? 2+4.00, 2**4.0 (6.0, 16.0) (6.00, 16.00) (6, 16) (6.00, 16.0) 39 / 100 What are the values of the following Python expressions? 2**(3**2) (2**3)**2 2**3**2 64, 512, 64 64, 64, 64 512, 512, 512 512, 64, 512 40 / 100 What will be the output of the following Python code snippet? X=”san-foundry” print(“%56s”,X) 56 blank spaces before san-foundry 56 blank spaces before san and foundry 56 blank spaces after san-foundry no change 41 / 100 Which of the following is incorrect? x = 30963 x = 0x4f5 x = 19023 x = 03964 42 / 100 All keywords in Python are in _________ lower case UPPER CASE Capitalized None of the mentioned 43 / 100 Which of the following cannot be a variable? __init__ in it on 44 / 100 What will be the output of the following Python code snippet? print('ab'.zfill(5)) 000ab 00ab0 0ab00 ab000 45 / 100 What will be the output of the following Python code snippet? print('abcd'.translate('a'.maketrans('abc', 'bcd'))) bcde abcd error bcdd 46 / 100 Which of the following is an invalid variable? my_string_1 1st_string foo _ 47 / 100 What is the result of cmp(3, 1)? 1 0 True False 48 / 100 What will be the output of the following Python code snippet? print('+99'.zfill(5)) 00+99 00099 +0099 +++99 49 / 100 What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:-1] (1, 2) (1, 2, 4) (2, 4) (2, 4, 3) 50 / 100 Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)? 5 4 None Error 51 / 100 Which of the following is incorrect? float(‘inf’) float(‘nan’) float(’56’+’78’) float(’12+34′) 52 / 100 Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? print(list1[2:]) print(list1[:2]) print(list1[:-2]) all of the mentioned 53 / 100 Which of the following commands will create a list? list1 = list() list1 = [] list1 = list([1, 2, 3]) all of the mentioned 54 / 100 What will be the output of the following Python code snippet? print('ab cd ef'.title()) Ab cd ef Ab cd eF Ab Cd Ef None of the mentioned 55 / 100 Which of the following is not a keyword? eval assert nonlocal pass 56 / 100 Why are local variable names beginning with an underscore discouraged? they are used to indicate a private variables of a class they confuse the interpreter they are used to indicate global variables they slow down execution 57 / 100 What will be the output of the following Python code? >>>list("a#b#c#d".split('#')) [‘a’, ‘b’, ‘c’, ‘d’] [‘a b c d’] [‘a#b#c#d’] [‘abcd’] 58 / 100 What will be the output of the following Python code? '%s' %((1.23,),) ‘(1.23,)’ 1.23, (,1.23) ‘1.23’ 59 / 100 Is Python case sensitive when dealing with identifiers? yes no machine dependent none of the mentioned 60 / 100 What will be the output of the following Python code? hex(255), int('FF', 16), 0xFF [0xFF, 255, 16, 255] (‘0xff’, 155, 16, 255) Error (‘0xff’, 255, 255) 61 / 100 What is the result of round(0.5) – round(-0.5)? 1.0 2.0 0.0 Value depends on Python version 62 / 100 The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field. first, right second, left first, left second, right 63 / 100 What will be the value of the following Python expression? bin(10-2)+bin(12^4) 0b10000 0b10001000 0b1000b1000 0b10000b1000 64 / 100 What will be the output of the following Python code if a=10 and b =20? a=10 b=20 a=a^b b=a^b a=a^b print(a,b) 10 20 10 10 20 10 20 20 65 / 100 Which of the following is true for variable names in Python? unlimited length all private members must have leading and trailing underscores underscore and ampersand are the only two special characters allowed none of the mentioned 66 / 100 What will be the output of the following two codes? i. '{0}'.format(4.56) ii. '{0}'.format([4.56,]) ‘4.56’, ‘4.56,’ ‘4.56’, ‘[4.56]’ 4.56, [4.56,] 4.56, [4.56,] 67 / 100 What does ~4 evaluate to? -5 -4 -3 +3 68 / 100 What will be the output of the following Python code? 'The {} side {1} {2}'.format('bright', 'of', 'life') Error ‘The bright side of life’ ‘The {bright} side {of} {life}’ No output 69 / 100 What will be the output of the following Python code? >>>"Welcome to Python".split() [“Welcome”, “to”, “Python”] (“Welcome”, “to”, “Python”) {“Welcome”, “to”, “Python”} “Welcome”, “to”, “Python” 70 / 100 What is the value of the following expression? float(22//3+3/3) 8 8.0 8.3 8.33 71 / 100 What will be the output of the following Python code? D=dict(p='san', q='foundry') '{p}{q}'.format(**D) Error sanfoundry san foundry {‘san’, ‘foundry’} 72 / 100 What will be the output of the following Python code? l=list('HELLO') p=l[0], l[-1], l[1:3] 'a={0}, b={1}, c={2}'.format(*p) Error “a=’H’, b=’O’, c=(E, L)” “a=H, b=O, c=[‘E’, ‘L’]” Junk value 73 / 100 What will be the output of the following Python code snippet? print('Ab!2'.swapcase()) AB!@ ab12 ab12 aB1@ 74 / 100 What will be the output of the following Python code snippet? print('ab\ncd\nef'.splitlines()) [‘ab’, ‘cd’, ‘ef’] [‘ab\n’, ‘cd\n’, ‘ef\n’] [‘ab\n’, ‘cd\n’, ‘ef’] [‘ab’, ‘cd’, ‘ef\n’] 75 / 100 What will be the output of the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] prints all the vowels in my_string prints all the consonants in my_string prints all characters of my_string that aren’t vowels prints only on executing print(k) 76 / 100 What will be the output of the following Python expression? ~100? a) 101 b) -101 c) 100 d) -100 101 -101 100 -100 77 / 100 What does ~~~~~~5 evaluate to? +5 -11 +11 -5 78 / 100 What is the output when we execute list(“hello”)? [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] [‘hello’] [‘llo’] [‘olleh’] 79 / 100 Any odd number on being AND-ed with ________ always gives 1. Hint: Any even number on being AND-ed with this value always gives 0. 10 2 1 0 80 / 100 Evaluate the expression given below if A = 16 and B = 15. A % B // A 0.0 0 1.0 1 81 / 100 What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd', 2)) [‘ab’, ‘ef’, ‘ghcd’] [‘ab’, ‘efcdghcd’] [‘abcdef’, ‘ghcd’] none of the mentioned 82 / 100 What will be the output of the following Python expression if x=22.19? print("%5.2f"%x) 22.1900 22.00000 22.19 22.20 83 / 100 What is the type of inf? Boolean Integer Float Complex 84 / 100 Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]? [2, 33, 222, 14] Error 25 [25, 14, 222, 33, 2] 85 / 100 Which of the following is the truncation division operator? / % // | 86 / 100 What will be the value of x in the following Python expression? x = int(43.55+2/2) 43 44 22 23 87 / 100 Which of the following expressions can be used to multiply a given number ‘a’ by 4? a<<2 a<<4 a>>2 a>>4 88 / 100 What will be the output of the following Python expression if x=56.236? print("%.2f"%x) 56.00 56.24 56.23 0056.236 89 / 100 What is the two’s complement of -44? 1011011 11010100 11101011 10110011 90 / 100 Suppose t = (1, 2, 4, 3), which of the following is incorrect? print(t[3]) t[3] = 45 print(max(t)) print(len(t)) 91 / 100 Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? Error None 25 2 92 / 100 What is the output of print(k) in the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] print(k) all characters of my_string that aren’t vowels a list of Nones list of Trues list of Falses 93 / 100 It is not possible for the two’s complement value to be equal to the original value in any case. True False 94 / 100 What will be the value of the following Python expression? 4 + 3 % 5 4 7 2 0 95 / 100 What is the output of print 0.1 + 0.2 == 0.3? True False Machine dependent Error 96 / 100 Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)? 3 5 25 1 97 / 100 What will be the output of the following Python expression if x=456? print("%-06d"%x) 000456 456000 456 error 98 / 100 Suppose list1 is [2445,133,12454,123], what is max(list1)? 2445 133 12454 123 99 / 100 What will be the output of the following Python code snippet? print([i.lower() for i in "HELLO"]) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] ‘hello’ [‘hello’] hello 100 / 100 What will be the output of the following Python code? '%.2f%s' % (1.2345, 99) ‘1.2345’, ‘99’ ‘1.2399’ ‘1.234599’ 1.23, 99 Your score is LinkedIn Facebook Twitter VKontakte 0% Facebook WhatsApp Twitter