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) What will be the output of the following Python code? print('ab'.isalpha()) a. None b. Error c. False d. True 2) What will be the output of the following Python code snippet? x = [i**+1 for i in range(3)]; print(x); a. error, ‘;’ is not allowed b. [1, 2, 5] c. [0, 1, 2] d. error, **+ is not a valid operator 3) In Python, _____ defines a block of statements. a. {} b. loop c. Block d. Indentation 4) What will be the output of the following Python code snippet? a = [0, 1, 2, 3] for a[-1] in a: print(a[-1]) a. error b. 3 3 3 3 c. 0 1 2 2 d. 0 1 2 3 5) What will be the output of the following Python code? >>>str1="helloworld" >>>str1[::-1] a. helloworld b. world c. hello d. dlrowolleh 6) Which amongst this is not a jump statement ? a. goto b. break c. continue d. for 7) In Python, we can use _______ operators for list objects. a. '+' and '#' b. '+' and '*' c. '#' and '*' d. '*' and '+' 8) What will be the output of the following Python code snippet? a. 0 1 2 3 4 … b. 0 1 c. 0 1 2 3 d. 3 4 9) Which one of the following is a valid Python if statement: a. if (a>= 2) b. if (a => 22) c. if a> = 2: d. if a >= 22 10) Python converts numbers internally in an expression containing mixed types to a Common type for evaluation. But sometimes, coerce a number explicitly from one type to another to satisfy the requirements of ____ parameter. a. list b. None of these c. tuple d. function 11) What will be the output of the following Python code? i = 1 while True: if i%2 == 0: break print(i) i += 2 a. 1 2 3 4 5 6 … b. 1 3 5 7 9 11 … c. 1 2 d. 1 12) Strings in Python are _____ a. None of these b. fixed c. immutable d. mutable 13) Function range(10, 5, 2) will yield an iterable sequence like a. [] b. [10, 8, 6] c. [2, 5, 8] d. [8, 5, 2] 14) An algorithm is best describe as a. A computer language b. A step by step procedure for solving a problem c. None of the above d. A branch of mathematics 15) What will be the output of the following Python code? >>> a={1,2,3} >>> a.intersection_update({2,3,4,5}) >>> a a. {2,3} b. {1,4,5} c. Error, no method called intersection_update for set data type d. Error, duplicate item present in list 16) What will be the output of the following Python code? >>> a={5,6,7,8} >>> b={7,8,10,11} >>> a^b a. {5,6,7,8,10,11} b. Error as unsupported operand type of set data type c. {7,8} d. {5,6,10,11} 17) Which of the following is not a keyword ? a. nonlocal b. finally c. eval d. assert 18) What will be the output of the following Python code? print("abcdef".center(10, '12')) a. 12abcdef12 b. error c. abcdef1212 d. 1212abcdef 19) What will be the output of the following Python code? string = "my name is x" for i in string: print (i, end=", ") a. m, y, , n, a, m, e, , i, s, , x, b. m, y, , n, a, m, e, , i, s, , x c. error d. my, name, is, x, 20) _____ reads one entire line from the file. a. None of these b. readinglines() c. readline() d. read() 21) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], [4, 4, 4], [5, 5, 5]] [B[row][col]*A[row][col] for row in range(3) for col in range(3)] a. 0 b. [0, 30, 60, 120, 160, 200, 300, 350, 400] c. [3, 6, 9, 16, 20, 24, 35, 40, 45] d. Error 22) What will be the output of the following Python code? >>> a,b=6,7 >>> a,b=b,a >>> a,b a. (7,6) b. Nothing is printed c. (6,7) d. Invalid syntax 23) Which of the following is not a valid identifier? a. 123 b. student c. _123 d. s12 24) What will be the output of the following Python code snippet? print([[i+j for i in "abc"] for j in "def"]) a. [[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]] b. [‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’] c. What will be the output of the following Python code snippet? print([[i+j for i in "abc"] for j in "def"]) d. [[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]] 25) Python uses a/an _______ to convert source a. Combination of Compiler and Interpreter b. Compiler c. Interpreter d. all of these 26) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [A[i][i] for i in range(len(A))] a. [2, 5, 8] b. [3, 5, 7] c. [4, 5, 6] d. [1, 5, 9] 27) Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)? a. 5 b. 1 c. 3 d. 25 28) In which language is Python written? a. English b. PHP c. All of the above d. C 29) What will be the output of the following Python expression if x=22.19? print(“%5.2f”%x) a. 22.19 b. 22.1900 c. 22.20 d. 22.00000 30) What will be the output of the following Python code? values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for lst in values: for element in lst: if v > element: v = element print(v) a. 6 b. 3 c. 1 d. 5 31) 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. {‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’} d. {‘abc’, ‘p’, ‘q’, ‘san’} 32) Which of the following will give error ? a. a,b,c=1 b. a, b, c = 1, "python", 1.5 c. a=b=c=1 d. None of the above 33) Which of the following carries out the instructions defined in the interface ? a. Operating System b. Interpreter c. Implementation d. Compiler 34) How can we create on empty list in Python? a. list=() b. null.list c. list=[] d. list.null 35) Select the reserved keyword in python. a. import b. All of the mentioned c. else d. raise 36) in python a variable named ‘num’ ,which type of value we can store in this variable a. All of These b. Float c. String d. Integer 37) Python operator always yields the result of a. all of these b. complex c. integer d. floating point 38) 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 v in w for x in w] b. [x for w in v if x in v] c. [x for x in v if w in v] d. [x for x in w if x in v] 39) Which translator is used to convert assembly language into machine language? a. Compiler b. Assembler c. None of these d. Interpreter 40) Raw data assigned to a variable is called as, a. variable b. identifier c. comment d. literal 41) A sequence of instruction, in a computer language, to get the desired result is known as _____ . a. An Algorithm b. None of the above c. A program d. A decision table 42) What will be the output of the following Python code? print("abcdef".center(7, '1')) a. 1abcdef b. error c. abcdef1 d. abcdef 43) Function range(3) will yield an iteratable sequence like a. [0, 1, 2] b. [0, 1, 2, 3] c. [1, 2, 3] d. [1, 2, 3] 44) Which one of the following is a valid Python if statement: a. if a> = 2: b. if (a>= 2) c. if (a => 22) d. if a >= 22 45) Which type of Programming does Python support? a. Structured programming b. All of the mentioned c. Object-oriented programming d. Functional programming 46) Which of the following is not a keyword in Python a. eval b. assert c. nonlocal d. pass 47) What will be the output of the following Python code snippet? x = 'abcd' for i in range(len(x)): x[i].upper() print (x) a. none of the mentioned b. error c. ABCD d. abcd 48) What will be the output of the following Python code snippet? z=set('abc$de') 'a' in z a. False b. Error c. True d. No output 49) Which of the following statement is false about recursion: a. Every recursive function must have a return value b. Every recursive function must have a base case c. Infinite recursion can occur if the base case isn't properly mentioned d. A recursive function makes the code easier to understand 50) What is the maximum possible length of an identifier for better redability? – a. No limit but 79 characters for better redability b. All of the above. c. 63 characters d. 31 characters 51) The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use whereas lists use square brackets. a. None of these b. curly brackets c. Angular brackets d. parentheses 52) What is the data type of (1)? a. Both tuple and integer b. Integer c. Tuple d. List 53) ___ in Python is a counter-controlled loop. a. for b. while c. None of the above d. Both A and B 54) What is the output of the following code? a=set('abc') b=set('cdef') print(a&b) a. {'a','b','c','d','e','r'} b. None of these c. {'c'} d. {c} 55) Python programming language was create by ______. a. Guido van Rossum b. Tim Berner c. D. d. Ray temilson 56) If the program executed as individual program then the value of this variable is ______. a. _main_ b. () c. numpy d. // 57) Which symbol is used to write single line comment ? a. # b. / c. . d. ? 58) Find the invalid variable among the following: a. infomax b. my_string_1 c. 1st_string d. _mySring 59) Algorithms cannot be represented by____ a. syntax b. programs c. flowcharts d. pseudo codes 60) Which operator is also called as Comparative operator? a. Arithmetic b. Logical c. Assignment d. Relational 61) Which of the following is correct about Python a. It can be easily integrated with C,C++,COM, ActiveX, CORBA, and java b. It supports automatic garbage collection c. None of the above d. Both of the above 62) For two objects x and y, the expression x is y will yield True, if and only if a. id(x) == id(y) b. x == y c. len(x) == len(y) d. all of these 63) What will be the output of the following Python expression if the value of x is 34? print(“%f”%x) a. 34.00 b. 34.000000 c. 34.0000 d. 34.00000000 64) What will be the output of the following Python code? >>>example = "helle" >>>example.find("e") a. Error b. -1 c. 0 d. 1 65) What will be the output of the following Python code? l1=[10, 20, 30] l2=[-10, -20, -30] l3=[x+y for x, y in zip(l1, l2)] l3 a. Error b. [0, 0, 0] c. [-20, -60, -80] d. 0 66) Python myfile.py is used to ____ file in command shell. a. compile b. Run c. Interpret d. None of the above 67) 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. none of the mentioned b. a a a a a a c. a a a a a d. i i i i i i 68) What will be the output of the following Python code? list1 = [1, 3] list2 = list1 list1[0] = 4 print(list2) a. [1, 3, 4] b. [1, 4] c. [1, 3] d. [4, 3] 69) A sentinel-controlled loop can be implemented using _____ a. if b. for c. None d. Both of the above 70) Which of the following software is required to run the hardware? a. Task Bar b. Program Manager c. Device Driver d. Task Manager 71) Flowchart and algorithms are used for a. All b. Efficient Coding c. Better programming d. easy testing and debugging 72) 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. 3 b. 4 c. 2 d. 1 73) What will be the output of the following Python code? >>> a={5,6,7,8} >>> b={7,8,9,10} >>> len(a+b) a. 8 b. 6 c. Nothing is displayed d. Error, unsupported operand ‘+’ for sets 74) What will be displayed by print(ord(‘b’) – ord(‘a’))? a. 2 b. -1 c. 1 d. 0 75) The function used to find power of a number. a. exp() b. tell() c. None of these d. pow() 76) Which one of the following has the same precedence level? a. Multiplication, Division, Addition and Subtraction b. Multiplication, Division and Addition c. Addition and Multiplication d. Addition and Subtraction 77) Which language is derived from many other language, including ABC, Modula- 3, C, C++, Algol-68, SmallTalk, and Unix shell and other scripting languages. a. Python b. Fortran c. None of the above d. Java 78) What will be the output of the following Python code? s=["pune", "mumbai", "delhi"] [(w.upper(), len(w)) for w in s] a. [PUNE, 4, MUMBAI, 6, DELHI, 5] b. [‘PUNE’, 4, ‘MUMBAI’, 6, ‘DELHI’, 5] c. [(‘PUNE’, 4), (‘MUMBAI’, 6), (‘DELHI’, 5)] d. Error 79) The function generates sequence of numbers from 1 to n. a. Pass b. Open c. Range d. Input 80) Shape() function in Numpy array is used to a. None of these b. Display elements c. Find the shape of the array d. change the shape of array 81) Which of the following statements is used to create an empty set? a. set() b. { } c. ( ) d. [ ] 82) Which of the following is not a Python IDE a. IDLE b. Spyder c. Jupyter Notes d. Sublime Test 83) Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? a. None b. 25 c. 2 d. Error 84) Converts a list into tuple. a. Tuples (seq) b. dict (seq) c. None d. list(seq) 85) What will be the output of the following algorithm for a=5, b-8, c=6 ? Step 1: Start Step 2: Declare variables a, b and c. Step 3 Read variables a, b and c. Step 4: If a < b If a a. stop b. b is the smallest number c. a is the smallest number d. cis the smallest number 86) Operators with the same precedence are evaluated in which manner? a. Left to Right b. Can’t say c. Right to Left d. None of the mentioned 87) In which year was the Python language developed? a. 1981 b. 1995 c. 1972 d. 1989 88) Which of the following functions will return the symmetric difference between two sets, x and y? a. x ^ y b. x – y c. x & y d. x | y 89) which function do you use to read a string? a. enter(“Enter a string”) b. eval(input(“Enter a string”)) c. input(“Enter a string”) d. eval(enter(“Enter a string”)) 90) If we overcome the rules of the programming language, we get a. None of the above. b. logical error c. Syntax error d. Runtime error 91) print(0xA + 0xB + 0xC): a. 0xA0xB0xC b. 33 c. 0x22 d. Error 92) A loop block in python starts with a.. - a. ,(Comma) b. ; (semicolon) c. None of these d. : (colan) 93) which function is used to get the ASCII value of any Character in PYthon? a. get_ascii() b. scii() c. ord() d. getAscii() 94) In a flowchart a calculation (process) is represented by a. A parallelogram b. A rectangle c. A circle d. A rhombus 95) What will be the output of the following Python code? list1 = [11, 2, 23] list2 = [11, 2, 2] a. None b. Error c. True d. False 96) Which function is used to Writes the string(s) to the file and returns the number of characters written. a. None b. write(s) c. read(s) d. writeline (s) 97) Suppose i is 5 and j is 4, i + j is same as ________ a. i.__ADD(j) b. i.__add(j) c. i.__add__(j) d. i.__Add(j) 98) The offset of the local DST time zone. a. alt.Timezone b. zone.altTime c. None d. Time.altzone 99) A Python tuple that is created without using the parentheses brackets () is called as ? a. None of the above b. Tuple sorting c. Tuple packing d. Tuple sampling 100) The _____ statement is used for exiting from the loop. a. None of these b. pass c. Continue d. Break Your score is