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 among the following list of operators has the highest precedence? +, -, **, %, /, <<, >>, | a. ** b. % c. | d. << 2) Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? a. all of the mentioned b. print(list1[0]) c. print(list1[:2]) d. print(list1[:-2]) 3) Which can be an Identifier among them in Python ? a. 1abc b. _xy1 c. $12a d. @python 4) 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. Java b. None of the above c. Python d. Fortran 5) Shape() function in Numpy array is used to a. Display elements b. None of these c. change the shape of array d. Find the shape of the array 6) What will be the output of the following Python code? data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] def ttt(m): v = m[0][0] for row in m: for element in row: if v < element: v = element return v print(ttt(data[0])) a. 2 b. 4 c. 5 d. 1 7) Write a list comprehension equivalent for the Python code shown below. for i in range(1, 101): if int(i*0.5)==i*0.5: print(i) a. [i for i in range(1, 101) if int(i*0.5)=(i*0.5)] b. [i for i in range(1, 100) if int(i*0.5)==(i*0.5)] c. [i for i in range(1, 100) if int(i*0.5)=(i*0.5)] d. [i for i in range(1, 101) if int(i*0.5)==(i*0.5)] 8) All keywords in python are in ____ a. lowercase b. UPPERCASE c. None of the mentioned d. Capitalized 9) Which of the following precedence order is correct in Python? a. Parentheses, Exponential,Multiplication, Division, Addition, Subtraction b. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential c. Exponential,Parentheses,Multiplication, Division, Addition, Subtraction d. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential 10) ______ are the modes of both writing and reading in binary format in file. a. wb+ b. None of these c. rb+ d. bw+ 11) _____ help programmers to create lists in a concise way. a. Dictionary b. None of these c. Tuple d. List Comprehensions 12) What will be the output of the following Python code? >>> a={1,2,3} >>> a.intersection_update({2,3,4,5}) >>> a a. {1,4,5} b. {2,3} c. Error, no method called intersection_update for set data type d. Error, duplicate item present in list 13) What will be the output of the following Python code? lst=[3,4,6,1,2] lst[1:2]=[7,8] print(lst) a. Syntax error b. [3,[7,8],6,1,2] c. [3,4,6,7,8] d. [3, 7, 8, 6, 1, 2] 14) An empty / null statement in Python is _____ . a. pass b. None c. empty d. null 15) Suppose list1 is [1, 3, 2], What is list1 * 2? a. [2, 6, 4] b. [1, 3, 2, 3, 2, 1] c. [1, 3, 2, 1, 3, 2] d. [1, 3, 2, 1, 3] 16) What will be the output of the following Python code? print('a B'.isalpha()) a. True b. Error c. None d. False 17) What will be the output of the following pseudo code? integer a,b set a=9,b=5 a=a mod(a-3) b=b mod(b-3) print a+b a. 8 b. 5 c. 9 d. 4 18) Which function is used to get the Data Type of any value? a. data_type() b. datatype() c. type() d. datatype() 19) The Pandas ______ method returns a new Data Prame. a. dropna() b. None of these c. read_csv() d. Pandas 20) _____ help programmers to create lists in a concise way. a. Dictionary b. Tuple c. List Comprehensions d. None of these 21) What will be the output of the following Python code snippet? x = 'abcd' for i in range(len(x)): i.upper() print (x) a. error b. none of the mentioned c. 0 1 2 3 d. a b c d 22) What will be the output of the following Python code? [ord(ch) for ch in 'abc'] a. [97, 98, 99] b. Error c. [65, 66, 67] d. [‘97’, ‘98’, ‘99’] 23) What will be the value of the following Python expression? 4+2**5//10 a. 7 b. 77 c. 3 d. 0 24) It refers to the ability of an application to run on different platforms with or without minimal changes. a. Flexibility b. Error c. Reliability d. Portability 25) Which of the following is not a Python IDE a. IDLE b. Sublime Test c. Spyder d. Jupyter Notes 26) Which of the following symbol is used for input and output operations in a flow chart? a. Rectangle b. Parallelogram c. Circle d. Diamond 27) Python is a/an _________ language. a. Procedural b. High Level c. Difficult d. Low Level 28) What will be the output of the following Python code snippet? print(''.isdigit()) a. False b. None c. Error d. True 29) Which of the following function convert a sequence of tuples to dictionary in python? a. set (x) b. dict(d) c. frozenset(s) d. chr(x) 30) Is the following Python code valid? a={1,2,3} b={1,2,3,4} c=a.issuperset(b) print(c) a. Syntax error for issuperset() method b. Error, no method called issuperset() exists c. False d. True 31) Which of the following environment variable for Python tells the Python interpreter where to locate the module files imported into a program ? a. PYTHONSTARTUP b. PYTHONPATH c. PYTHONHOME d. PYTHONCASEOK 32) In a flowchart a calculation (process) is represented by a. A rhombus b. A parallelogram c. A circle d. A rectangle 33) The ______ mode of Python gives instant result of typed statement a. Combination of Interactive and Script modes b. Interactive Mode c. All of these d. Script Mode 34) What will be the output of the following Python code? print("xyyzxyzxzxyy".endswith("xyy")) a. True b. 1 c. 2 d. 3 35) What is the data type of (1)? a. List b. Tuple c. Both tuple and integer d. Integer 36) 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 4 5 b. 1 2 3 4 c. 1 2 d. 1 2 3 37) _____ reports all error with line numbers and produce faster object code then interpreter. a. Assembler b. Translator c. Compiler d. None of these 38) What will be the output of the following Python statement? >>>"a"+"bc" a. bc b. bca c. a d. abc 39) Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))? a. [1/x for x in [(1, 2, 3)]] b. [1/x for x in (1, 2, 3)] c. error d. [x**-1 for x in [(1, 2, 3)]] 40) What will be the output of the following Python code? >>> a={1,2,3} >>> b=a.copy() >>> b.add(4) >>> a a. Error, copying of sets isn’t allowed b. {1,2,3} c. {1,2,3,4} d. Error, invalid syntax for add 41) The complexity of linear search algorithm is a. O(n log n) b. O(log n) c. O(n) d. O(n2) 42) What will be the output of the following Python code? a = [5,5,6,7,7,7] b = set(a) def test(lst): if lst in b: return 1 else: return 0 for i in filter(test, a): print(i,end=" ") a. 5 6 7 b. 5 6 7 7 7 c. 5 5 6 d. 5 5 6 7 7 7 43) What will be the output of the following Python code? >>> a=(2,3,1,5) >>> a.sort() >>> a a. Error, tuple has no attribute sort b. (1,2,3,5) c. (2,3,1,5) d. None 44) Set of statements is executed again and again based upon conditional test. a. Looping b. None c. Selective d. Sequence 45) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], a. No output b. [[0, 30, 60], [120, 160, 200], [300, 350, 400]] c. Error d. What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], 46) What will be the output of the following Python code? print("ab\tcd\tef".expandtabs()) a. ab cd ef b. abcdef c. ab cd ef d. ab cd ef 47) 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. a a a a a a b. a a a a a c. i i i i i i d. none of the mentioned 48) 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 49) 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. 3 c. 6 d. 5 50) Which of the following operators has the lowest precedence ? a. % b. and c. not d. + 51) _____ reports all error with line numbers and produce faster object code then interpreter. a. Assembler b. Translator c. None of these d. Compiler 52) What is the default value of encoding in encode()? a. ascii b. qwerty c. utf-16 d. utf-8 53) Is the following Python code valid? >>> a=frozenset([5,6,7]) >>> a >>> a.add(5) a. Yes, now a is {5,6,7} b. Yes, now is a {5,5,6,7} c. No, invalid syntax for add method d. No, frozen set is immutable 54) _____ is also known as the alias array. a. alias b. array c. None of these d. ndarray 55) Which of the following mode will refer to binary data ? a. w b. b c. + d. r 56) What is the output of >>>float('12.6') a. syntax error b. 12.6' c. 12.6 d. 12 57) The expression _____ implies that the variable x is converted to integer. a. None of these b. chr (x) c. int (x) d. exp(x) 58) What will be the output of the following Python code? i = 5 while True: if i%0O9 == 0: break print(i) a. 5 6 7 8 9 10 11 12 13 14 15 .... b. error c. 5 6 7 8 d. 5 6 7 8 9 59) _____ symbols are used to connect one box of flow chart to another. a. diamond b. circle c. Flow Lines d. None of the above 60) What arithmetic operators cannot be used with strings? a. All of the mentioned b. – c. + d. * 61) What is identity array? a. None of these b. This is a array with ones on the main diagonal. c. This is a square array with ones on the main diagonal. d. This is a normal array. 62) 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. 0 1 2 3 b. error c. 0 1 2 2 d. 3 3 3 3 63) What will be the output of the following Python code snippet? a. 0 1 2 3 4 … b. 0 1 c. 3 4 d. 0 1 2 3 64) What will be the output of the following Python expression if the value of x is 34? print(“%f”%x) a. 34.0000 b. 34.00 c. 34.00000000 d. 34.000000 65) Is the following Python code valid? >>> a=(1,2,3,4) >>> del a a. Yes, the entire tuple is deleted b. Yes, first element in the tuple is deleted c. No because tuple is immutable d. No, invalid syntax for del method 66) What will be the output of the following Python code? x = ['ab', 'cd'] for i in x: i.upper() print(x) a. [‘AB’, ‘CD’] b. [‘ab’, ‘cd’] c. none of the mentioned d. [None, None] 67) The operator returns the quotent after division. a. None of these b. // c. & d. % 68) _____ returns the current time instant, a floating-point number of seconds since the epoch. a. Time.time() b. time.date() c. datetime() d. None of the above 69) The datatype whose representation is known are called a. Built in datatype b. Derived datatype c. Abstract datatype d. concrete datatype 70) For two objects x and y, the expression x is y will yield True, if and only if a. x == y b. id(x) == id(y) c. len(x) == len(y) d. all of these 71) A sentinel-controlled loop can be implemented using _____ a. if b. None c. Both of the above d. for 72) What will be the output of the following Python code? a=[1,2,3] b=a.append(4) print(a) print(b) a. Syntax error b. [1, 2, 3, 4] None c. [1,2,3,4] [1,2,3,4] d. [1,2,3] [1,2,3,4] 73) Which method is used to Write(s) a list of lines to the file. a. readlines (lines) b. write(s) c. writelines (lines) d. None of these 74) When an algorithm is written in the form of a programming language it becomes a a. Program b. Syntax c. Pseudo Code d. Flowchart 75) A process is expressed in a flowchart by a. A Circle b. Rectangle c. Parallelogram d. A Diamond 76) Which module is to be imported for using randint() function? a. randomrange b. random c. randrange d. rand 77) Python converts the source code into an intermediate form called ____ . a. human-readable code b. None of these c. bytecode d. Source-code 78) Which of the following is not valid Python identifiers? a. email b. ca$h c. marks10 d. Python2Shar 79) How is a function declared in Python? a. def function_name(): b. declare function function_name(): c. def function function_name() d. declare function_name(): 80) What will be the output of the following Python code? >>> import collections >>> a=collections.namedtuple('a',['i','j']) >>> obj=a(i=4,j=7) >>> obj a. obj(i=4, j=7) b. a(i=4, j=7) c. (4,7) d. An exception is thrown 81) What will be the output of the following Python code? s={2, 5, 6, 6, 7} s a. {2, 5, 6, 6, 7} b. {2, 5, 6, 7} c. Error d. {2, 5, 7} 82) What is called when a function is defined inside a class? a. Method b. Module c. Another function d. Class 83) Which of the following carries out the instructions defined in the interface ? a. Interpreter b. Implementation c. Compiler d. Operating System 84) What will be the output of the following Python code? >>> a={5,6,7,8} >>> b={7,8,9,10} >>> len(a+b) a. 6 b. 8 c. Error, unsupported operand ‘+’ for sets d. Nothing is displayed 85) What will be the output of the following Python code? print("ab\tcd\tef".expandtabs('+')) a. none of the mentioned b. ab++++++++cd++++++++ef c. ab cd ef d. ab+cd+ef 86) What is mean by dynamically typed language a. A variable can store any datatype type of value b. A variable can store only numeric value c. A value of a variable is change each type when it run d. A variable can store only one type of value 87) Which of the following is correct in respect of advantages of functions ? a. both b. Reducing duplication of code c. None d. Decomposing complex problems into simpler pieces 88) The operator used to calculate remainder after division. a. / b. % c. d. None of these 89) List structure in python where elements are stored in parenthesis. a. [] b. {} c. none of these d. () 90) In flowchart, parallelogram is used to show a. Output data screen b. Online use of keyboard c. General input symbol d. Operation on data 91) In Python, which of the following will create a block in a compound statement ? a. statements indented at a lower, same level b. colon c. indentation in any form d. { } 92) NumPY stands for. - a. Number In Python b. None of the above c. Numbering Python d. Numerical Python 93) What will following code segment print? a=True b=False c=False if not a or b: print(1) elif not a or not b and c: print(2) elif not a or b or not b and a: print(3) else: print(4) a. 3 b. 4 c. 2 d. 1 94) Which of the following operator in python evaluates to true if the variables on either side of the operator point to the same object and false otherwise? a. is b. // c. not in d. ** 95) What will be the output of the following Python code? print("abcdef".center(7, 1)) a. abcdef b. error c. abcdef1 d. 1abcdef 96) What will be the output of the following Python expression? 24//6%3, 24//4//2 a. (0,3) b. (3,1) c. (1,3) d. (1,0) 97) A graphical representation of a computer program in relation to its sequence of functions____ . a. Algorithm b. Both of the above c. flowchart d. None of these 98) Which is the most comfortable loop? a. if..elif b. do..while c. for d. while 99) Which of the following is not a keyword in Python a. pass b. assert c. eval d. nonlocal 100) The part of a machine level instruction, which tells the central processor what has to be done, is a. None of the above b. An operation code c. An address d. An operand Your score is