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) Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? a. print(list1[:-2]) b. print(list1[:2]) c. print(list1[0]) d. all of the mentioned 2) A sentinel-controlled loop can be implemented using _____ a. None b. if c. Both of the above d. for 3) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [A[i][len(A)-1-i] for i in range(len(A))] a. [4, 5, 6] b. [3, 5, 7] c. [2, 5, 8] d. [1, 5, 9] 4) What will be the output of the following Python code? x = 'abcd' for i in range(len(x)): print(i) a. 0 1 2 3 b. error c. a b c d d. 1 2 3 4 5) What will be the output of the following Python code? a=[10,23,56,[78]] b=list(a) a[3][0]=95 a[1]=34 print(b) a. [10,23,56,[95]] b. [10,34,56,[78]] c. [10,34,56,[95]] d. [10,23,56,[78]] 6) What will be the output of the following Python code? points = [[1, 2], [3, 1.5], [0.5, 0.5]] points.sort() print(points) a. [[3, 1.5], [1, 2], [0.5, 0.5]] b. [[0.5, 0.5], [1, 2], [3, 1.5]] c. [[0.5, 0.5], [3, 1.5], [1, 2]] d. [[1, 2], [3, 1.5], [0.5, 0.5]] 7) What will be the output of the following Python code? x = "abcdef" i = "a" while i in x: print('i', end = " ") a. i i i i i i … b. a b c d e f c. no output d. a a a a a a … 8) Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)? a. 4 b. 0 c. 1 d. 2 9) What is the output of >>>float(‘12.6’) a. 12 b. 12.6 c. Syntax Error d. '12.6' 10) The complexity of linear search algorithm is a. O(log n) b. O(n2) c. O(n log n) d. O(n) 11) What will be the output of the following Python code snippet? x = 'abcd' for i in range(len(x)): print(x) x = 'a' a. a b. abcd abcd abcd abcd c. a a a a d. none of the mentioned 12) Which translator is used to convert assembly language into machine language? a. None of these b. Assembler c. Compiler d. Interpreter 13) What will be the output of the following Python code ? a. None b. 1 2 c. 1 2 3 4 d. error 14) What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))? a. [-1**x for x in [1, 2, 3]] b. [x^-1 for x in range(4)] c. [x**-1 for x in [1, 2, 3]] d. [1|x for x in [1, 2, 3]] 15) Part of an algorithm which is repeated for fixed number of times is classified as a. iteration b. reverse action c. sequence d. selection 16) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] A[1] a. [3, 6, 9] b. [1, 2, 3] c. [1, 4, 7] d. [4, 5, 6] 17) What will be the output of the following Python code? >>> a=(1,2,3,4) >>> del(a[2]) a. Now, a=(1,2,4) b. Error as tuple is immutable c. Now a=(3,4) d. Now, a=(1,3,4) 18) What will be the output of the following Python code? >>>example = "helle" >>>example.find("e") a. -1 b. Error c. 1 d. 0 19) Find the last element of list in Python? Assume ‘bikes’ is the name of list. a. bilkes[1] b. None of the above c. bikes[:-1] d. bikes (:-1) 20) Given a function that does not return any value, what value is shown when executed at the shell ? a. void b. bool c. None d. int 21) Operations to be repeated a certain number of times are done by a. Selection b. Simple c. Loop d. Sequential 22) Which of the following expressions results in an error? a. int(‘10’) b. int(’10.8’) c. float(‘10’) d. float(’10.8’) 23) Which of the following is not a valid identifier? a. _123 b. 123 c. s12 d. student 24) Which of the following carries out the instructions defined in the interface ? a. Operating System b. Interpreter c. Compiler d. Implementation 25) In which year was the Python language developed? a. 1989 b. 1972 c. 1995 d. 1981 26) The output of this expression, >>>6*1**3 is ____ . a. None of these b. 10 c. 18 d. 6 27) What will be the output of the following Python code snippet? print('a@ 1,'.islower()) a. True b. None c. Error d. False 28) The ______ can be accessed only inside the function in which they are declared, whereas global variables can be accessed throughout the program body by all functions. a. Global variables b. datatype c. None of these d. local variables 29) What will be the output of the following Python code? names = ['Amir', 'Bear', 'Charlton', 'Daman'] print(names[-1][-1]) a. Error b. n c. A d. Daman 30) Which is the correct operator for power(x,y)? a. None of the mentioned b. X^^y c. X**y d. X^y 31) Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))? a. error b. [1/x for x in [(1, 2, 3)]] c. [x**-1 for x in [(1, 2, 3)]] d. [1/x for x in (1, 2, 3)] 32) elif can be considered to be abbreviation of a. nested if b. if..else c. if..elif d. else if 33) Leading white space at the beginning of each element, which is used to determine the group of statement a. Debugging b. Indentation c. None of the above d. Testing 34) In a flowchart a calculation (process) is represented by a. A rhombus b. A rectangle c. A circle d. A parallelogram 35) Which one of the following has the same precedence level? a. Addition and Multiplication b. Multiplication, Division, Addition and Subtraction c. Addition and Subtraction d. Multiplication, Division and Addition 36) 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. abcd b. error c. ABCD d. none of the mentioned 37) What will be the output of the following Python code? print('ab,12'.isalnum()) a. None b. Error c. True d. False 38) If we overcome the rules of the programming language, we get a. Runtime error b. Syntax error c. None of the above. d. logical error 39) ______ is used for efficient operation on homogeneous data that are stored in arrays. a. fp.tell() b. Array c. Numpy d. None of these 40) What is the output of the following? n=5 while n>0: n-=1 if n==2: continue print(n) a. 4 3 2 b. 4 3 1 0 c. none of these d. 5 4 3 1 0 41) The part of a machine level instruction, which tells the central processor what has to be done, is a. An address b. An operand c. None of the above d. An operation code 42) _______ is latest high level language. a. MATLAB b. LISP c. Delphi d. Ruby 43) What will be the output of the following Python code? >>> a=(2,3,1,5) >>> a.sort() >>> a a. (1,2,3,5) b. (2,3,1,5) c. Error, tuple has no attribute sort d. None 44) Function blocks begin with the keyword _. a. function b. def c. None of the above d. method 45) Which of the following statement(s) will terminate only the current pass of the loop and proceed with the next iteration of the loop? a. break b. goto c. continue d. pass 46) What will be the output of the following Python code snippet? print('0xa'.isdigit()) a. Error b. False c. True d. None 47) Method is used to display entire contents of the file. a. readlines() b. Both c. read() d. None 48) By using function _____ ,we can change the shape of the Numpy array in python. a. change() b. None of these c. reshape() d. shape () 49) What will be the output of the following Python code? print("abcdef".center(7, 1)) a. 1abcdef b. abcdef1 c. error d. abcdef 50) It defines the accessibility and the lifetime of a variable. a. scope b. None c. keyword d. Lifetime 51) Which character is used in Python to make a single line comment? a. // b. # c. ! d. / 52) What will be the output of the following Python code? print('Hello!2@#World'.istitle()) a. True b. None c. False d. error 53) What will be the output of the following Python code? >>>t1 = (1, 2, 4, 3) >>>t2 = (1, 2, 3, 4) >>>t1 < t2 a. False b. True c. None d. Error 54) 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] 55) Which of the following is the use of function in python ? a. None b. 20 c. 21 d. 22 56) What is the output of >>>float(‘12.6’) a. 12.6 b. 12 c. syntax error d. 12.6' 57) Is the following Python code valid? >>> a,b=1,2,3 a. No, too many values to unpack b. Yes, this is an example of tuple unpacking. a=1 and b=2 c. Yes, this is an example of tuple unpacking. a=1 and b=(2,3) d. Yes, this is an example of tuple unpacking. a=(1,2) and b=3 58) NumPY stands for. – a. Numbering Python b. Number In Python c. None of the above d. Numerical Python 59) What will be the output of the following Python code? >>> a={1,2,3} >>> b=a.add(4) >>> b a. {1,2,3,4} b. None c. {1,2,3} d. Nothing is printed 60) To remove string “hello” from list1, we use which command? a. list1.removeAll(“hello”) b. list1.removeOne(“hello”) c. list1.remove(hello) d. list1.remove(“hello”) 61) ____ is the output you get when ‘2’==2 is executed a. ValueError occurs b. false c. True d. TypeError occurs 62) What will be the output of the following Python code snippet? for i in 'abcd'[::-1]: print (i) a. none of the mentioned b. d c b a c. error d. a b c d 63) The data type of an expression int(m)/int(n) will result in: a. None of these b. int or float c. Float d. Int 64) 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 65) Is the following Python code valid? a={1,2,3} b={1,2,3,4} c=a.issuperset(b) print(c) a. True b. False c. Syntax error for issuperset() method d. Error, no method called issuperset() exists 66) What function do you use to read a string? a. input(“Enter a string”) b. enter(“Enter a string”) c. eval(input(“Enter a string”)) d. eval(enter(“Enter a string”)) 67) What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i) a. 0 1 2 b. 0 1 2 0 1 2 c. none of the mentioned d. error 68) In the Python statement x = a + 5 – b : a and b are a. operators b. Expression c. Operands d. Equation 69) ____is a string literal denoted by triple quotes for providing the specifications of certain program elements. a. Client b. Interface c. Modularity d. Docstring 70) Which of the following is correct about Python a. Both of the above b. None of the above c. It supports automatic garbage collection d. It can be easily integrated with C,C++,COM, ActiveX, CORBA, and java 71) Which of the following Boolean expressions is not logically equivalent to the other three? a. not(-6>10 or-6==10) b. not(-6<10 or-6==10) c. not(-6<0 or-6>10) d. -6>=0 and -6<=10 72) 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. 3 b. 6 c. 1 d. 5 73) Which one is the type of algorithm: a. Connector b. Pseudo c. Flowchart d. Greedy 74) Which of the following Python statements will result in the output: 6? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] a. A[2][1] b. A[1][2] c. A[3][2] d. A[2][3] 75) What is the symbol used to represent start and stop of a flowchart ? a. Oval b. Diamond c. Rectangle d. Arrow 76) Which of the following is not an advantage of using modules? a. Provides a means of reducing the size of the program b. Provides a means of testing individual parts of the program c. Provides a means of reuse of program code d. Provides a means of dividing up tasks 77) What arithmetic operators cannot be used with strings? a. – b. * c. All of the mentioned d. + 78) The write method returns ________. a. Algorithm b. None c. Variables d. connector 79) What will be the output of the following Python code? print("abcdef".center()) a. none of the mentioned b. error c. abcdef d. cd 80) What will be the output of the following Python code? >>>str1="helloworld" >>>str1[::-1] a. helloworld b. dlrowolleh c. world d. hello 81) What will be the output of the following Python code? print("Hello {0} and {1}".format(('foo', 'bin'))) a. Hello foo and bin b. Error c. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’) d. None of the mentioned 82) Which of the following is not a relational opeartor in Python? a. = b. <= c. >= d. != 83) Which of the following environment variable for Python is an alternative module search path ? a. PYTHONSTARTUP b. PYTHONPATH c. PYTHONCASEOK d. PYTHONHOME 84) What is the return type of function id? a. float b. dict c. int d. bool 85) The ______ statement lets the program go through the piece of code without performing any action. a. pass b. Range c. Get d. None of these 86) A program that convert a high-level language program to a set of instructions that can run on a computer is called a a. None of the above b. Debugger c. Editor d. Compiler 87) Function range(10, 5, 2) will yield an iterable sequence like a. [2, 5, 8] b. [10, 8, 6] c. [] d. [8, 5, 2] 88) Identify the correct sequence of steps to run a program. a. Code, Compile, Link, Execute & load b. Compile, Code, Link, load & Execute c. Link, load, Code, Compile, & Execute d. Code, Compile, Link, load & Execute 89) What will be the output of the following Python expression if x=56.236? print(“%.2f”%x) a. 56.00 b. 56.24 c. 0056.236 d. 56.23 90) What will be the output of the following Python expression if x=456? print(“%-06d”%x) a. 000456 b. error c. 456 d. 456000 91) Python is ________ Programming Language a. Object Oriented b. Heigh Level c. Both A and B d. Low Level 92) Istrip() method is used for : a. delete upper case characters b. delete all the trailing characters c. delete all the leading and trailing characters d. delete all the leading characters 93) What will be the output of the following expression ? x =4 print(x<<2) a. 16 b. 6 c. 4 d. 2 94) Escape sequences are treated as ____ a. None of These b. Characters c. Integers d. Strings 95) What will be the output of the following Python code? for i in range(2.0): print(i) a. error b. 0 1 c. 0.0 1.0 d. none of the mentioned 96) In Python, ________ is not supported. a. None b. Tuple assignment c. return values d. Tuple comprehension 97) 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. [44, 2, 3] c. [1, 2, 3, 44] d. [1, 2, 3] 98) What is the answer to this expression, 22 % 3 is? a. 5 b. 0 c. 7 d. 1 99) A sequence of instruction, in a computer language, to get the desired result is known as a. A program b. An algorithm c. A decision table d. None of the above 100) _______ is a group of characters. a. String b. Decision box c. rectangular d. indentation Your score is