123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 You Have 2 hours To Complete The Test / Quiz Programming and Problem Solving through Python (M3-R5.1) Total available questions is More than 1000. Each exam has 100 questions & Answers randomly. You will get 2 hrs to complete the test. Its Mandatory To Fill For Get Certificate After Complete Exam. NameEmail 1) Which one of the following is the correct extension of the Python file- a. .p b. None of these c. .py d. .python 2) Which of the following is not a legal integer type value in python. a. Octal b. Roman c. Decimal d. Hexadecimal 3) What will be the output of the following Python code? l=[1,2,3,4,5] [x&1 for x in l] a. [1, 0, 0, 0, 0] b. [1, 1, 1, 1, 1] c. [0, 1, 0, 1, 0] d. [1, 0, 1, 0, 1] 4) The operator used to check if both the operands reference the same object memory, is the ………. operator. a. id b. in c. is d. == 5) The _____ function converts the specified value into a string. a. int() b. None of these c. str() d. String() 6) To print the value of a variable, Python uses a. Print Function() b. print() Function c. Print Statement d. print Statement 7) The readlines() method reads and returns ______ . a. A list of remaining lines of the entire file b. None of the Above c. individual lines of a file d. Write individual lines 8) ___ in Python is a counter-controlled loop. a. for b. None of the above c. while d. Both A and B 9) The word comes form the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al khowarizami is a called? a. syntax b. Flowchart c. Flow d. Algorithm 10) In Python assignment of more than one behaviour to a particular function and the operation performed varies by the types of objects or arguments involved are known as_____ . a. operator overloading b. Function overloading c. None of these d. Both of the above. 11) What is the syntax of the following Python code? >>> a=frozenset(set([5,6,7])) >>> a a. frozenset({5,6,7}) b. Syntax error c. Error, not possible to convert set into frozenset d. {5,6,7} 12) You do not have pay Python and you can view its source code too. it means Python is _______ a. Freeware b. Free and Open Source c. Open source d. Shareware 13) What is the data type of (1)? a. Integer b. List c. Both tuple and integer d. Tuple 14) ( What will be the output of the following Python code? >>> a={5,4} >>> b={1,2,4,5} >>> a<b a. {1,2} b. True c. Invalid operation d. False 15) Which of the following is not Logical operator? a. or b. and c. Assignment d. not 16) Which inbuilt function is used to takes an iterable object as input and makes them immutable. a. obj() b. None of these c. input() d. frozenset() 17) What will be the output of the following Python code snippet? print([[i+j for i in "abc"] for j in "def"]) a. What will be the output of the following Python code snippet? print([[i+j for i in "abc"] for j in "def"]) b. [[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]] c. [[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]] d. [‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’] 18) What will be the output of the following Python code? print('*', "abcdef".center(7), '*', sep='') a. * abcdef * b. * abcdef * c. * abcdef* d. *abcdef * 19) . What will be the output of the following Python code? s1={3, 4} s2={1, 2} s3=set() i=0 j=0 for i in s1: for j in s2: s3.add((i,j)) i+=1 j+=1 print(s3) a. {(3, 1), (4, 2)} b. Error c. {(4, 2), (3, 1), (4, 1), (5, 2)} d. {(3, 4), (1, 2)} 20) What will be the output of the following Python code? x = "abcdef" i = "a" while i in x: x = x[1:] print(i, end = " ") a. no output b. error c. a d. a a a a a a 21) What will be the output of the following Python code? print("Hello {0} and {1}".format('foo', 'bin')) a. Hello 0 and 1 b. Error c. Hello {0} and {1} foo bin d. Hello foo and bin 22) Find the last element of list in Python? Assume ‘bikes’ is the name of list. a. bikes[:-1] b. None of the above c. bilkes[1] d. bikes (:-1) 23) What will be the output of the following Python code? matrix = [[1, 2, 3, 4], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]] for i in range(0, 4): print(matrix[i][1], end = " ") a. 4 5 6 7 b. 1 2 3 4 c. 2 5 9 13 d. 1 3 8 12 24) Which character is used in Python to make a single line comment? a. ! b. // c. # d. / 25) Which is Special type of literal in Python a. Integer b. Complex Number c. String d. None 26) The symbol used for both input and output is a _____ . a. None of the above b. Diamond shape c. parallelogram d. Circle shape 27) Which of the following is not a keyword? a. eval b. assert c. finally d. nonlocal 28) Which one of the following has the highest precedence in the expression? a. Addition b. Parentheses c. Exponential d. Multiplication 29) ____is a string literal denoted by triple quotes for providing the specifications of certain program elements. a. Docstring b. Interface c. Client d. Modularity 30) What will be the output of the following Python code snippet? {a**2 for a in range(4)} a. {0, 1, 4, 9, 16} b. {0, 1, 4, 9} c. {1, 4, 9, 16} d. Error 31) What is the output of the following code? list1=[2, 33, 222, 14, 25] print(list1[ : -1 ]) a. [2, 33, 222, 14] b. Error c. [25, 14, 222, 33, 2] d. 25 32) Every function has an implicit statement _____ as the last instruction in the function body. a. None of these b. Return c. for d. pass 33) What will be the output of the following Python code? print('*', "abcde".center(6), '*', sep='') a. * abcde * b. * abcde * c. * abcde* d. *abcde * 34) Which of the following declaration is incorrect? a. a?=3 b. All of These c. _a=3 d. a_=3 35) Python supports Object-Oriented style or technique of programming that encapsulates code within _____. a. style b. objects c. None d. memory 36) Which of the following is not a valid keyword of Python associated with loops? a. break b. range c. check d. continue 37) What will be the output of the following Python code snippet? print('11'.isnumeric()) a. False b. True c. None d. Error 38) The datatype whose representation is unknown are called a. Abstract datatype b. concrete datatype c. Derived datatype d. Built in datatype 39) Which one of the following has the same precedence level? a. Multiplication, Division and Addition b. Addition and Multiplication c. Multiplication, Division, Addition and Subtraction d. Addition and Subtraction 40) List structure in python where elements are stored in parenthesis. a. [] b. () c. {} d. none of these 41) What will be the output of the following Python code snippet? for i in ''.join(reversed(list('abcd'))): print (i) a. none of the mentioned b. d c b a c. a b c d d. error 42) What is the list comprehension equivalent for? {x : x is a whole number less than 20, x is even} (including zero) a. [x for x in range(0, 20) if (x//2==0)] b. [x for x in range(1, 20) if (x%2==0)] c. [x for x in range(1, 20) if (x//2==0)] d. [x for x in range(0, 20) if (x%2==0)] 43) Strings in Python are _____ a. fixed b. immutable c. mutable d. None of these 44) What will be the output of the following Python code? print("abcdef".center(10, '12')) a. abcdef1212 b. 12abcdef12 c. 1212abcdef d. error 45) What will be the output of the following Python code? a=[13,56,17] a.append([87]) a.extend([45,67]) print(a) a. [13, 56, 17, 87,[ 45, 67]] b. [13, 56, 17, [87], 45, 67] c. [13, 56, 17, 87, 45, 67] d. [13, 56, 17, [87], [45, 67]] 46) Which symbol is used as a flowline to connect two blocks in a flow chart? a. arrow b. circle c. parallelogram d. box 47) 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)] a. [1, 4, 8] b. [1, 2, 4, 3, 8, 9] c. (1, 4, 8) d. [2, 3, 9] 48) Which function is used to Writes the string(s) to the file and returns the number of characters written. a. writeline (s) b. None c. write(s) d. read(s) 49) elif can be considered to be abbreviation of a. nested if b. else if c. if..elif d. if..else 50) The process of drawing a flowchart for an algorithms is called a. Evaluation b. Performance c. Algorithmic Representation d. Flowcharting 51) will return the mathematical number PI from the constants module. a. Math.Pi b. Pandas c. None of these d. Circle() 52) What will be the output of the following Python code? myList = [1, 5, 5, 5, 5, 1] max = myList[0] indexOfMax = 0 for i in range(1, len(myList)): if myList[i] > max: max = myList[i] indexOfMax = i print(indexOfMax) a. 4 b. 3 c. 2 d. 1 53) What will be the output of the following Python code? >>> a=[(2,4),(1,2),(3,9)] >>> a.sort() >>> a a. [(2,4),(1,2),(3,9)] b. [(1, 2), (2, 4), (3, 9)] c. Error, tuple has no sort attribute d. Error because tuples are immutable 54) What will be the output of the following Python code? x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x) a. [‘ab’, ‘cd’, ‘AB’, ‘CD’] b. [‘ab’, ‘cd’] c. v[‘AB’, ‘CD’] d. Infinite Loop 55) In a flowchart an input or output instruction is represented by a. A rectangle b. A parallelogram c. A circle d. A rhombus 56) Which of the following is an invalid variable? a. my_string_1 b. 1st_string c. foo d. _myvar 57) What will be the value of p when p= int(17/2+11.5)? a. 20.0 b. 28.0 c. 28 d. 20 58) Testing is known as a. A stage of all projects b. Evaluating deliverable to find errors c. None of the above d. Finding broken code 59) Which character is used in Python to make a single line comment? a. ! b. // c. # d. / 60) What will be the output of the following Python code snippet? z=set(‘abc’) z.add('san') z.update(set(['p', 'q'])) z a. {‘a’, ‘b’, ‘c’, ‘p’, ‘q’, ‘san’} b. {‘a’, ‘b’, ‘c’, [‘p’, ‘q’], ‘san} c. {‘abc’, ‘p’, ‘q’, ‘san’} d. {‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’} 61) is used for data analysis and manipulations in tabular data in Python. a. block b. Pandas c. rhombus d. circle 62) Users write the programs in which language? a. Low-level Language b. Middle-level Language c. None of these d. High-level Language 63) What will be the output of the following Python code? >>> a={5,6,7,8} >>> b={7,8,10,11} >>> a^b a. Error as unsupported operand type of set data type b. {7,8} c. {5,6,7,8,10,11} d. {5,6,10,11} 64) Suppose t=(1,2,4,3), which of the following is incorrect? a. print(t[3]) b. print(max(t)) c. t[3] = 45 d. print(len(t)) 65) Read the information given below carefully and write a list comprehension such that the output is: [‘e’, ‘o’] w="hello" v=('a', 'e', 'i', 'o', 'u') a. [x for w in v if x in v] b. [x for x in v if w in v] c. [x for x in w if x in v] d. [x for v in w for x in w] 66) What will be the output of the following Python code? s=set() type(s) a. class set b. <class ‘set’> c. set d. <’set’> 67) Python programming language allows to use one loop inside another loop known as ? a. switch b. Nested Loop c. None d. foreach 68) What will be the output of the following Python code snippet? print('1.1'.isnumeric()) a. True b. Error c. False d. None 69) What is the output of the expression : 3*1**3 ? a. 1 b. 3 c. 9 d. 27 70) If we not see the rules of th programming language, we get ? a. Syntax Error b. Runtime Error c. None of the above d. Logical Error 71) filter() is used to a. B. filters the given sequence with the help of a function that tests each element in the sequence to be true or not. b. constructs an iterator from elements of an iterable for which a function returns true. c. None of the above d. Both of the above 72) What will be the output of the following Python code? >>> a={4,5,6} >>> b={2,8,6} >>> a+b a. Error as unsupported operand type for sets b. {4,5,6,2,8} c. Error as the duplicate item 6 is present in both sets d. {4,5,6,2,8} 73) Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9]. a. [x**3 in l] b. [x^3 for x in l] c. [x^3 in l] d. [x**3 for x in l] 74) What will be the output of the following Python code? True = False while True: print(True) break a. False b. None c. none of the mentioned d. True 75) ______ method parses the expression passed to it and runs python expression(code) within the program. a. a string b. fp.tell() c. Array d. The eval() 76) The ______ statement lets the program go through the piece of code without performing any action. a. Range b. None of these c. pass d. Get 77) What is the output of the code print(7%2). a. 3.5 b. None c. 5.5 d. 1.0 78) Write the list comprehension to pick out only negative integers from a given list ‘l’. a. [x for x<0 in l] b. [x<0 in l] c. [x in l for x<0] d. [x for x in l if x<0] 79) What will be the output of the following Python code? x = "abcdef" while i in x: print(i, end=" ") a. i i i i i i … b. a b c d e f c. error d. abcdef 80) A natural number 1 is also an ______. a. List Comprehensions b. Flow lines c. Algorithms d. integer number 81) What will be the output of the following Python code? >>> a=(2,3,4) >>> sum(a,3) a. 12 b. 9 c. The method sum() doesn’t exist for tuples d. Too many arguments for sum() method 82) What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i) a. 0 1 2 b. none of the mentioned c. 0 1 2 0 1 2 d. error 83) What is the output of the code print(7%2). a. 5.5 b. None of the above c. 1 d. 3.5 84) What will be the output of the following Python code? >>> a=(1,2,(4,5)) >>> b=(1,2,(3,4)) >>> a<b a. Error, < operator is valid for tuples but not if there are sub-tuples b. True c. Error, < operator is not valid for tuples d. False 85) Given a function that does not return any value, what value is shown when executed at the shell ? a. int b. bool c. void d. None 86) What is the output of the following program ? print 0.1+0.2==0.3 a. Machine dependent b. True c. Error d. False 87) What will be the output of the following Python code snippet? a. The sum of 2 and 10 is 12 b. None of the mentioned c. The sum of 0 and 1 is 2 d. Error 88) What will be the output of the following Python code? numberGames = {} numberGames[(1,2,4)] = 8 numberGames[(4,2,1)] = 10 numberGames[(1,2)] = 12 sum = 0 for k in numberGames: sum += numberGames[k] print len(numberGames) + sum a. 33 b. 30 c. 12 d. 24 89) What will be the output after the following statements? for i in range(1,6): print(i, end='') if i == 3: break a. 1 2 3 b. 1 2 c. 1 2 3 4 5 d. 1 2 3 4 90) Which of the following cannot be a variable? a. in b. on c. __init__ d. it 91) Which of the following expressions results in an error? a. int(’10.8’) b. float(‘10’) c. float(’10.8’) d. int(‘10’) 92) What will be the output of the following Python statement? >>>chr(ord('A')) a. Error b. A c. B d. a 93) What will be the output of the following Python code? values = [[3, 4, 5, 1 ], [33, 6, 1, 2]] for row in values: row.sort() for element in row: print(element, end = " ") print() a. The program prints two rows 3 4 5 1 followed by 33 6 1 2 b. The program prints on row 3 4 5 1 33 6 1 2 c. The program prints two rows 1 3 4 5 followed by 1 2 6 33 d. The program prints two rows 3 4 5 1 followed by 33 6 1 2 94) What will be the output of the following Python code? s=["pune", "mumbai", "delhi"] [(w.upper(), len(w)) for w in s] a. Error b. [(‘PUNE’, 4), (‘MUMBAI’, 6), (‘DELHI’, 5)] c. [PUNE, 4, MUMBAI, 6, DELHI, 5] d. [‘PUNE’, 4, ‘MUMBAI’, 6, ‘DELHI’, 5] 95) When _____ gets executed, ‘inner PI value’ is printed as that is ‘pi’ value inside the function namespace. a. Fun() b. None of these c. piFun() d. pi() 96) In Python, we can use _______ operators for list objects. a. '*' and '+' b. '+' and '*' c. '+' and '#' d. '#' and '*' 97) ____ is the output you get when ‘2’==2 is executed a. True b. TypeError occurs c. ValueError occurs d. false 98) Which operator is also called as Conditional operator? a. Relational b. Ternary c. Logical d. Assignment 99) What will be the output of the following Python code? num = ['One', 'Two', 'Three'] for i, x in enumerate(num): print('{}: {}'.format(i, x),end=" ") a. One Two Three b. Exception is thrown c. 0: One 1: Two 2: Three d. 1: 2: 3: 100) The contents inside the “for loop” are separated by? a. semicolon b. hyphen c. colon d. comma Your score is