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) _______ is latest high level language. a. Delphi b. MATLAB c. LISP d. Ruby 2) Write the list comprehension to pick out only negative integers from a given list ‘l’. a. [x in l for x<0] b. [x for x<0 in l] c. [x for x in l if x<0] d. [x<0 in l] 3) What will be the output of the following Python code? print("xyyzxyzxzxyy".endswith("xyy", 0, 2)) a. 0 b. True c. 1 d. False 4) Which can contain multiple lines of text. a. Python Package Index b. Docstring c. both a & b d. none of the mentioned 5) What function do you use to read a string? a. eval(input(“Enter a string”)) b. enter(“Enter a string”) c. eval(enter(“Enter a string”)) d. input(“Enter a string”) 6) In python language, which of the following operators is the correct option for raising k to the power 1? a. k^1 b. k^*1 c. k^ ^1 d. k**1 7) Which of the following is a Python tuple? a. (1, 2, 3) b. {} c. [1, 2, 3] d. {1, 2, 3} 8) What will be the output of the following code snippet? a = 2.19 b=3.999999 C= -3.30 printint((a), floor(b), ceil(c), fabs(c)) a. 23-3 -3.3 b. 2 3-3 3.3 c. 23-33 d. 3 4 -33 9) What will be the output of the following Python code? True = False while True: print(True) break a. None b. False c. none of the mentioned d. True 10) What will be the output of the following Python code? l1=[1,2,3] l2=[4,5,6] [x*y for x in l1 for y in l2] a. [4, 10, 18] b. [18, 12, 6, 15, 10, 5, 12, 8, 4] c. [4, 5, 6, 8, 10, 12, 12, 15, 18] d. [4, 8, 12, 5, 10, 15, 6, 12, 18] 11) Which of the following is incorrect regarding variables in Python? a. Data type of variable names should not be declared. b. Variable names can start with an underscore. c. None of the above. d. Variable names in Python cannot start with number. However, it can contain number in any other position of variable name. 12) A step by step method for solving a problem using English Language a. program b. Flowchart c. statement d. Algorithm 13) Which of the following is not valid Python identifiers? a. Python2Shar b. marks10 c. ca$h d. email 14) What will be the output of the following Python code? values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for row in range(0, len(values)): for column in range(0, len(values[row])): if v < values[row][column]: v = values[row][column] print(v) a. 33 b. 6 c. 3 d. 5 15) In which language is Python written? a. All of the above b. C c. PHP d. English 16) What will be the output of the following Python code? names = ['Amir', 'Bear', 'Charlton', 'Daman'] print(names[-1][-1]) a. Daman b. Error c. A d. n 17) A graphical representation of a computer program in relation to its sequence of functions____ . a. flowchart b. Both of the above c. None of these d. Algorithm 18) Users write the programs in which language? a. High-level Language b. Low-level Language c. None of these d. Middle-level Language 19) 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. Infinite Loop c. [‘ab’, ‘cd’] d. v[‘AB’, ‘CD’] 20) Python programming language was create by ______. a. D. b. Tim Berner c. Guido van Rossum d. Ray temilson 21) Which one of the following is the correct extension of the Python file- a. .py b. .python c. .p d. None of these 22) Which of the following declarations is incorrect in python language? a. xyzp = 5000 6000 7000 8000 b. xyzp = 5,000,000 c. x_y_z_p = 5,000,000 d. x, y, z,p = 5000, 6000, 7000, 8000 23) ( What will be the output of the following Python code? >>> a={5,4} >>> b={1,2,4,5} >>> a<b a. True b. {1,2} c. False d. Invalid operation 24) ______ are the modes of both writing and reading in binary format in file. a. bw+ b. None of these c. rb+ d. bw+ 25) The default separator character of print() is ___ a. newline b. space c. tab d. dot 26) What will be the output of the following Python code? print('*', "abcdef".center(7), '*', sep='') a. * abcdef * b. * abcdef* c. * abcdef * d. *abcdef * 27) Which of the following operators has the lowest precedence ? a. and b. not c. + d. % 28) Which of these in not a core data type? a. Dictionary b. Lists c. Tuples d. Class 29) In python we can change the value of variable a. Two Time b. Any Number of Time c. One Time d. we can not change the value of variable 30) The GCD of the numbers 136 and 170 is ______ . a. 34 b. None c. 40 d. 50 31) Which of the following is not a keyword ? a. nonlocal b. eval c. finally d. assert 32) _____ is also known as the alias array. a. ndarray b. alias c. array d. None of these 33) What will be the result of the expression 5 and 10? a. 0 b. 5 c. 10 d. 1 34) What will be the output of the following Python code? print("abcdef".center()) a. cd b. abcdef c. error d. none of the mentioned 35) Which of the following is an invalid statement? a. abc = 1,000,000 b. a,b,c = 1000, 2000, 3000 c. a b c = 1000 2000 3000 d. a_b_c = 1,000,000 36) Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)? a. 5 b. 3 c. 25 d. 1 37) Which of the following is not a keyword? a. nonlocal b. finally c. eval d. assert 38) Which of the following statement will be true. a. You can assign multiple values to multiple variables by separating variables and values with commas. b. All of the above c. You can assign the same value to multiple variables by using = consecutively.. d. Python allows you to assign a single value to multiple variables simultaneously. 39) A sentinel-controlled loop can be implemented using _____ a. Both of the above b. if c. for d. None 40) Which can be an Identifier among them in Python ? a. @python b. $12a c. 1abc d. _xy1 41) ___ in Python is a counter-controlled loop. a. while b. None of the above c. for d. Both A and B 42) Which of the following is a valid arithmetic operator in Python ? a. ? b. < c. and d. // 43) Which operator is also called as Comparative operator? a. Assignment b. Arithmetic c. Relational d. Logical 44) 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. i i i i i i b. a a a a a c. none of the mentioned d. a a a a a a 45) The _____ function converts the specified value into a string. a. String() b. None of these c. int() d. str() 46) What will be the output of the following pseudocode, where ^ represent XOR operation ? Integer a, b, c set b = 4, a = 3 c =a ^ b Print c a. 3 b. 4 c. 7 d. 5 47) What will be the output of the following Python code snippet? x = 2 for i in range(x): x -= 2 print (x) a. error b. 0 1 2 3 4 … c. 0 -2 d. 0 48) What will be the output of the following Python statement? >>>print(chr(ord('b')+1)) a. a b. c c. A d. b 49) What will be the output of the following Python code snippet? print('for'.isidentifier()) a. Error b. True c. False d. None 50) Which of the following mode will refer to binary data ? a. r b. + c. w d. b 51) What will be the output of the following Python code? >>> a=(2,3,1,5) >>> a.sort() >>> a a. (2,3,1,5) b. None c. (1,2,3,5) d. Error, tuple has no attribute sort 52) Is it safe to directly use the == operator to determine whether objects of type float are equal ? a. Yes, if the values are > 100 b. Yes, if the values are < 100 c. No d. Yes 53) Is the following Python code valid? a={3,4,{7,5}} print(a[2][0]) a. Yes, {7,5} is printed b. Error, subsets aren’t allowed c. Error, elements of a set can’t be printed d. Yes, 7 is printed 54) What is the answer to this expression, 22 % 3 is? a. 5 b. 7 c. 1 d. 0 55) What will be the output of the following Python code? myList = [1, 2, 3, 4, 5, 6] for i in range(1, 6): myList[i - 1] = myList[i] for i in range(0, 6): print(myList[i], end = " ") a. 2 3 4 5 6 1 b. 1 1 2 3 4 5 c. 6 1 2 3 4 5 d. 2 3 4 5 6 6 56) What will be the output of the following Python code? a=["Apple","Ball","Cobra"] <br class="blank" />a.sort(key=len) print(a) a. [‘Apple’, ‘Ball’, ‘Cobra’] b. [‘Cobra’, ‘Apple’, ‘Ball’] c. Invalid syntax for sort() d. [‘Ball’, ‘Apple’, ‘Cobra’] 57) The output of this expression, >>>6*1**3 is ____ . a. 6 b. 10 c. None of these d. 18 58) What will be the output of the following Python code snippet? a. Error b. The sum of 2 and 10 is 12 c. The sum of 0 and 1 is 2 d. None of the mentioned 59) What will be the output of the following Python code, if s1= {1, 2, 3}? s1.issubset(s1) a. False b. No output c. Error d. True 60) Which of the following will give error ? a. a=b=c=1 b. None of the above c. a,b,c=1 d. a, b, c = 1, "python", 1.5 61) An empty/null statement in Python is a. over b. pass c. go d. ; 62) 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. Exception is thrown b. 0: One 1: Two 2: Three c. One Two Three d. 1: 2: 3: 63) Python converts the source code into an intermediate form called _______. a. ndarray b. return c. Flow lines d. bytecode 64) Operations to be repeated a certain number of times are done by a. Simple b. Selection c. Sequential d. Loop 65) Which of the following functions cannot be used on heterogeneous sets? a. pop b. sum c. update d. remove 66) If a={5,6,7}, what happens when a.add(5) is executed? a. a={5,6,7} b. a={5,5,6,7} c. Error as there is no add function for set data type d. Error as 5 already exists in the set 67) 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 not valid for tuples b. Error, < operator is valid for tuples but not if there are sub-tuples c. False d. True 68) Which of the following defines what an object can do? a. Operating System b. Interface c. None of these d. Compiler 69) ______ is used for efficient operation on homogeneous data that are stored in arrays. a. Array b. None of these c. Numpy d. fp.tell() 70) What will be the output of the following Python code? a. 0 a 1 b 2 c b. 0 1 2 c. none of the mentioned d. a b c 71) What will be the result of the expression 15 and 10? a. 0 b. 10 c. 1 d. 5 72) What will be the output of the following Python code snippet? x = 2 for i in range(x): x += 1 print (x) a. 0 b. error c. 0 1 2 3 4 … d. 0 -2 73) _____ reports all error with line numbers and produce faster object code then interpreter. a. Translator b. None of these c. Assembler d. Compiler 74) Algorithm when transalated into a programming language is called a. Identifier b. Debugging c. Flowchart d. code 75) It is a combination of Operators, Operands and Constants a. Syntax b. Identifier c. Expression d. Task 76) What will be the output of the following Python code? def power(x, y=2): r=1 for i in range(y): r=r*x return r print(power(3)) print(power(3,3)) (A) 212 32 (B) 9 27 (C) 567 98 (D) None of the above a. (C) b. (A) c. (D) d. (B) 77) When _____ gets executed, 'inner PI value' is printed as that is 'pi' value inside the function namespace. a. None of these b. pi() c. Fun() d. piFun() 78) What will be the output of the following Python code? def f(values): values[0] = 44 v = [1, 2, 3] f(v) print(v) a. [1, 44] b. [1, 2, 3] c. [1, 2, 3, 44] d. [44, 2, 3] 79) ______ are the modes of both writing and reading in binary format in file. a. wb+ b. bw+ c. rb+ d. None of these 80) Set makes use of __________ Dictionary makes use of ____________ a. key values, key values b. keys, keys c. keys, key values d. key values, keys 81) Tool ________ is used for program design. a. Algorithm b. All of the above c. Psuedocode d. Flowchart 82) What will be the output of the following Python code? >>> a={1,2,3} >>> {x*2 for x in a|{4,5}} a. Error, set comprehensions aren’t allowed b. {8, 2, 10, 4, 6} c. {8,10} d. {2,4,6} 83) 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. None of these b. function c. tuple d. list 84) What will be the output of the following Python code? print("ab\tcd\tef".expandtabs('+')) a. ab+cd+ef b. none of the mentioned c. ab cd ef d. ab++++++++cd++++++++ef 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) c. (2, 4) d. (1, 2, 4) 86) What is the output of the code print(7%2). a. 3.5 b. None c. 5.5 d. 1.0 87) The operator used to check if both the operands reference the same object memory, is the .......... operator. a. id b. == c. is d. in 88) In computer science, refers to a special method usable by a computer for the solution to a problem. a. Graph b. program c. None of these d. algorithm 89) _____function takes a list of lines to be written to file. a. tell() b. write() c. writelines() d. None of these 90) Which of the following is not an advantage of using modules? a. Provides a means of testing individual parts of the program b. Provides a means of reducing the size of the program c. Provides a means of dividing up tasks d. Provides a means of reuse of program code 91) The _____ statement is used for exiting from the loop. a. pass b. None of these c. Break d. Continue 92) What will be the output of the following Python code? print("xyyzxyzxzxyy".count('yy')) a. 2 b. none of the mentioned c. 0 d. error 93) 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. 5 b. 1 c. Error d. 2 94) Which operator is also called as Conditional operator? a. Logical b. Ternary c. Relational d. Assignment 95) An algorithm is best describe as a. A step by step procedure for solving a problem b. A computer language c. A branch of mathematics d. None of the above 96) If we have two sets, s1 and s2, and we want to check if all the elements of s1 are present in s2 or not, we can use the function: a. s1.isset(s2) b. s2.issubset(s1) c. s1.issuperset(s2) d. s2.issuperset(s1) 97) Function range(0, 5, 2) will yield on iterable sequence like a. [0, 1, 2, 5] b. [1, 3, 5] c. [0, 5, 2] d. [0, 2, 4] 98) The operator returns the quotent after division. a. None of these b. & c. % d. // 99) What will be the output of the following Python expression? print(4.00/(2.0+2.0)) a. 1.00 b. 1 c. Error d. 1.0 100) Which of the following is correct in respect of advantages of functions ? a. None b. Reducing duplication of code c. both d. Decomposing complex problems into simpler pieces Your score is