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? >>> s={5,6} >>> s*3 a. {5,6,5,6,5,6} b. Error as multiplication creates duplicate elements which isn’t allowed c. {5,6} d. Error as unsupported operand type for set data type 2) What will be the output of the following Python code snipped if x = 1? x<<2 a. 4 b. 8 c. None of these d. 2 3) When an algorithm is written in the form of a programming language it becomes a a. Syntax b. Flowchart c. Pseudo Code d. Program 4) A natural number 1 is also an ____ . a. Factor b. integer number c. None of these d. unique number 5) Function range(10, 5, -2) will yield an iterable sequence like a. [10, 8, 6] b. [9, 7, 5] c. [5, 7, 9] d. [6, 8, 10] 6) ____ is the output you get when ‘2’==2 is executed a. false b. ValueError occurs c. TypeError occurs d. True 7) Which one of the following has the highest precedence in the expression? a. Parentheses b. Multiplication c. Addition d. Exponential 8) What will be the output of the following Python code? print("abcdef".find("cd")) a. True b. None of the mentioned c. 3 d. 2 9) Which of the following is the use of id() function in python? a. None of the mentioned b. ID returns the identity of the object c. All of the mentioned d. Even object doesn't have a unique Id 10) Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)? a. None b. Error c. 5 d. 4 11) A program which translate a high-level language program into a machine language program is called a. Compiler b. Both Compiler and Interpreter c. Interpreters d. None of the above 12) Set makes use of __________ Dictionary makes use of ____________ a. keys, keys b. keys, key values c. key values, keys d. key values, key values 13) Is the following Python code valid? >>> a=(1,2,3) >>> b=a.update(4,) a. No because tuples are immutable b. Yes, a=(1,2,3) and b=(1,2,3,4) c. No because wrong syntax for update() method d. Yes, a=(1,2,3,4) and b=(1,2,3,4) 14) How many numbers will be printed by the following code? def fun(a,b): for x in range(a,b+1): if x%3==0: print(x,end=" ") fun(100,120) a. 8 b. 7 c. 9 d. 6 15) Is the following Python code valid? >>> a,b=1,2,3 a. Yes, this is an example of tuple unpacking. a=1 and b=(2,3) b. No, too many values to unpack c. Yes, this is an example of tuple unpacking. a=1 and b=2 d. Yes, this is an example of tuple unpacking. a=(1,2) and b=3 16) _____ reads one entire line from the file. a. None of these b. readinglines() c. read() d. readline() 17) All keywords in python are in ____ a. lowercase b. UPPERCASE c. None of the mentioned d. Capitalized 18) Empty list indicated by which symbol. a. None b. {} c. [] d. () 19) What is the output of the following ? print(int()) a. 1 b. 0 c. Error d. Any Random Number 20) A natural number 1 is also an ______. a. integer number b. Algorithms c. List Comprehensions d. Flow lines 21) To give a different separator with print() ______ argument is sued. a. end b. separator c. sep d. tab 22) The output of this code is ______ . a. 0 b. FALSE c. TrueFalse d. True 23) What is the output of the following code? a=set('abc') b=set('cdef') print(a&b) a. {c} b. {'a','b','c','d','e','r'} c. None of these d. {'c'} 24) Is the following Python code valid? a={3,4,{7,5}} print(a[2][0]) a. Error, elements of a set can’t be printed b. Yes, 7 is printed c. Yes, {7,5} is printed d. Error, subsets aren’t allowed 25) To use a module in another module, you must import it using an, statement a. include b. import c. both (A) and (B) d. none of the above 26) An algorithm that calls itself directly or indirectly is known as a. Sub algorithm b. Recursion c. Polish notation d. Traversal algorithm 27) Which of the following software translates source code into object code ? a. Compiler b. None c. Assembler d. Interpreter 28) ____ is a function of dictionary gets all the values from the dictionary. a. chr() b. values() c. None of these d. uni() 29) Operations to be repeated a certain number of times are done by a. Simple b. Sequential c. Selection d. Loop 30) What will be the output of the following Python code? d = {0: 'a', 1: 'b', 2: 'c'} for x, y in d.items(): print(x, y) a. 0 a 1 b 2 c b. 0 1 2 c. a b c d. none of the mentioned 31) The program must be able to handle unexpected situation like wrong input or no input. a. Expression b. Portability c. Error d. Reliability 32) ______ are the modes of both writing and reading in binary format in file. a. None of these b. bw+ c. bw+ d. rb+ 33) What will be the output of the following Python code snippet? z=set('abc$de') 'a' in z a. True b. Error c. False d. No output 34) An algorithm that calls itself directly or indirectly is called as a. Recursion b. Reverse Polish Notation c. Sub Function d. Traversal Algorithm 35) The operator used to calculate remainder after division. a. None of these b. / c. % d. 36) List structure in python where elements are stored in _______ parenthesis. a. open() b. {} c. [] d. * 37) Raw data assigned to a variable is called as, a. identifier b. literal c. variable d. comment 38) 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 3 8 12 c. 2 5 9 13 d. 1 2 3 4 39) ___ in Python is a counter-controlled loop. a. Both A and B b. for c. None of the above d. while 40) Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)? a. 1 b. 2 c. 4 d. 0 41) What will be the output of the following Python code snippet? for i in '': print (i) a. (nothing is printed) b. None c. error d. none of the mentioned 42) Which of these in not a core data type? a. Lists b. Class c. Tuples d. Dictionary 43) Method is used to display entire contents of the file. a. None b. Both c. readlines() d. read() 44) Which operator is also called as Comparative operator? a. Arithmetic b. Assignment c. Logical d. Relational 45) The symbol used for conditional statement n a flow chart is a ____ a. None of the above b. rectangular box c. Circle shape d. Diamond box 46) 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] 47) Which of the following operators has the lowest precedence ? a. % b. + c. and d. not 48) What is the output of the following code? list1=[2, 33, 222, 14, 25] print(list1[ : -1 ]) a. Error b. [25, 14, 222, 33, 2] c. 25 d. [2, 33, 222, 14] 49) Which of the following defines what an object can do? a. Interface b. Operating System c. Compiler d. None of these 50) Which function is used to Evaluates string and returns an object. a. str(x) b. None of the above c. exp(x) d. eval(str) 51) What will be the output of the following Python code? for i in range(10): if i == 5: break else: print(i) else: print("Here") a. 1 2 3 4 5 b. 0 1 2 3 4 c. 0 1 2 3 4 Here d. 0 1 2 3 4 5 Here 52) 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, duplicate item present in list d. Error, no method called intersection_update for set data type 53) If list1=[10,20,30], then operation list1*2 returns ____ . a. [20,40,60] b. [10,20,30,20,40,60] c. None d. [10,20,30,10,20,30] 54) 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 v in w for x in w] d. [x for x in w if x in v] 55) You can obtain a value in a ______using a key for a single element. a. dictionary b. None of these c. Tuple d. List 56) Which of the following is correct in respect of advantages of functions ? a. Decomposing complex problems into simpler pieces b. both c. None d. Reducing duplication of code 57) are set of procedures defined in library to find the minimum value function or the root of an equation. a. None of these b. scipy () c. Optimisers d. Pandas 58) Why are local variable names beginning with an underscore discouraged? a. they slow down execution b. they confuse the interpreter c. they are used to indicate global variables d. they are used to indicate a private variables of a class 59) What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i.upper()) a. a b c d b. error c. 1 2 3 4 d. 0 1 2 3 60) Which one of the following is the correct extension of the Python file- a. .python b. None of these c. .py d. .p 61) Which character is used in Python to make a single line comment? a. ! b. / c. # d. // 62) What will be the output of the following Python code? x = 'abcd' for i in x: print(i) x.upper() a. error b. a b c d c. a B C D d. A B C D 63) Function range(10, 5, 2) will yield an iterable sequence like a. [2, 5, 8] b. [] c. [8, 5, 2] d. [10, 8, 6] 64) Which of the following environment variable for Python tells the Python interpreter where to locate the module files imported into a program ? a. PYTHONHOME b. PYTHONSTARTUP c. PYTHONCASEOK d. PYTHONPATH 65) The _____ function converts the specified value into a string. a. None of these b. String() c. str() d. int() 66) What is the value of the expression 10 + 3 ** 3 * 2? a. 829 b. 739 c. 64 d. 28 67) What will be the output of the following Python code? for i in range(int(2.0)): print(i) a. none of the mentioned b. 0 1 c. error d. 0.0 1.0 68) What will be the output of the following Python code? >>>my_tuple = (1, 2, 3, 4) >>>my_tuple.append( (5, 6, 7) ) >>>print len(my_tuple) a. 2 b. 1 c. 5 d. Error 69) Algorithms cannot be represented by____ a. programs b. flowcharts c. pseudo codes d. syntax 70) The brain of computer system is a. CPU b. RAM c. Control Unit d. ROM 71) To which of the following the “in” operator can be used to check if an item is in it ? a. Set b. Lists c. Dictionary d. All of the mentioned 72) The process of finding errors in code is called as a. Debugging b. Running c. Compiling d. Testing 73) What will be the output of the following Python code snippet? print([i.lower() for i in "HELLO"]) a. hello b. ‘hello’ c. [‘hello’] d. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] 74) ____is a string literal denoted by triple quotes for providing the specifications of certain program elements. a. Docstring b. Interface c. Modularity d. Client 75) In a flowchart a calculation (process) is represented by a. A rectangle b. A rhombus c. A circle d. A parallelogram 76) Which of these about a frozenset is not true? a. Mutable data type b. Immutable data type c. Data type with unordered values d. Allows duplicate values 77) What will be the output of the following pseudo code ? Integer a Set a =4 do print a + 2 a = a-1 while (a not equals 0) end while a. 6 6 6 6 b. 6 5 4 3 c. 6 8 10 12 d. 6 7 8 9 78) What will be the output of the following Python code? a = [1, 5, 7, 9, 9, 1] <br class="blank" />b=a[0] <br class="blank" />x= 0 for x in range(1, len(a)): if a[x] > b: b = a[x] b= x print(b) a. 5 b. 3 c. 0 d. 4 79) Write a list comprehension to produce the list: [1, 2, 4, 8, 16……212]. a. [(2**x) for x in range(0, 13)] b. [(x**2) for x in range(1, 13)] c. [(x**2) for x in range(0, 13)] d. [(2**x) for x in range(1, 13)] 80) 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. Error d. [‘PUNE’, 4, ‘MUMBAI’, 6, ‘DELHI’, 5] 81) What is the output of the following program : a. 0 1 2 3 0 b. 0 1 2 c. 0 1 2 0 d. None of these 82) Which of the following environment variable for Python tells the Python interpreter where to locate the module files imported into a program? a. PYTHONCASEOK b. PYTHONSTARTUP c. PYTHONHOME d. PYTHONPATH 83) For two objects x and y, the expression x is y will yield True, if and only if a. id(x) == id(y) b. len(x) == len(y) c. x == y d. all of these 84) What will be the output of the following Python code? >>> a={1,2,3} >>> b=a.add(4) >>> b a. None b. {1,2,3} c. {1,2,3,4} d. Nothing is printed 85) What will be the output of the following Python code? 85) What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:3] a. (2, 4, 3) b. (1, 2, 4) c. (1, 2) d. (2, 4) 86) Which of the following symbols is used to represent output in a flow chart? a. Parallelogram b. Square c. Triangle d. Circle 87) What is the return value of trunc()? a. float b. None c. int d. bool 88) What will be the output of the following Python code? s={1, 2, 3} s.update(4) s a. Error b. {1, 2, 4, 3} c. {4, 1, 2, 3} d. {1, 2, 3, 4} 89) What is the syntax of the following Python code? >>> a=frozenset(set([5,6,7])) >>> a a. Syntax error b. frozenset({5,6,7}) c. Error, not possible to convert set into frozenset d. {5,6,7} 90) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [[col + 10 for col in row] for row in A] a. [11, 12, 13, 14, 15, 16, 17, 18, 19] b. [[11, 12, 13], [14, 15, 16], [17, 18, 19]] c. [11, 12, 13], [14, 15, 16], [17, 18, 19] d. Error 91) The functions which are coming with Python software automatically are called ____ . a. None of these b. built-in functions c. User-defined functions d. Both of the above 92) What will be the output of the following Python code? d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(x) a. 0 a 1 b 2 c b. a b c c. 0 1 2 d. none of the mentioned 93) The method used to removes all the items at once. a. clear() b. removelist () c. None of these d. remove () 94) Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))? a. [x**-1 for x in [(1, 2, 3)]] b. error c. [1/x for x in [(1, 2, 3)]] d. [1/x for x in (1, 2, 3)] 95) _____ help programmers to create lists in a concise way. a. Tuple b. List Comprehensions c. Dictionary d. None of these 96) What will be the output of the following Python code? d = {0: 'a', 1: 'b', 2: 'c'} for i in d: print(i) a. 0 1 2 b. none of the mentioned c. 0 a 1 b 2 c d. a b c 97) Which of the following is a floor division operator? a. // b. / c. % d. || 98) What will be the output of the following Python code? >>> a=(2,3,4) >>> sum(a,3) a. 9 b. 12 c. Too many arguments for sum() method d. The method sum() doesn’t exist for tuples 99) An algorithm is best describe as a. A branch of mathematics b. None of the above c. A step by step procedure for solving a problem d. A computer language 100) Write the list comprehension to pick out only negative integers from a given list ‘l’. a. [x for x<0 in l] b. [x in l for x<0] c. [x for x in l if x<0] d. [x<0 in l] Your score is