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 snippet? print('__foo__'.isidentifier()) a. False b. None c. True d. Error 2) Suppose list1 is [1, 5, 9], what is sum(list1)? a. 9 b. 15 c. 1 d. Error 3) What will be the output of the following Python code? x = 123 for i in x: print(i) a. 123 b. 1 2 3 c. none of the mentioned d. error 4) Which inbuilt function is used to takes an iterable object as input and makes them immutable. a. obj() b. frozenset() c. None of these d. input() 5) Which of the following is an escape sequence for a new line character a. a b. t c. n d. b 6) Data Items having fixed value are called ______ a. keywords b. Identifiers c. Functions d. Literals 7) What will be the output of the following Python code? >>>max("what are you") a. error b. u c. y d. t 8) Function blocks begin with the keyword _. a. method b. None of the above c. function d. def 9) In which year was the Python language developed? a. 1995 b. 1972 c. 1981 d. 1989 10) What will be the output of the following Python code? print("Hello {0!r} and {0!s}".format('foo', 'bin')) a. Hello ‘foo’ and foo b. Error c. Hello foo and foo d. Hello foo and ‘bin’ 11) Which of the following precedence order is correct in Python? a. Exponential,Parentheses,Multiplication, Division, Addition, Subtraction b. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential c. Parentheses, Exponential,Multiplication, Division, Addition, Subtraction d. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential 12) Which of the following commands will create a list? a. list1 = list([1, 2, 3]) b. list1 = list() c. all of the mentioned d. list1 = [] 13) 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. An exception is thrown b. (4,7) c. obj(i=4, j=7) d. a(i=4, j=7) 14) ____ is used to close a file object(fp). a. None of these b. fp.close c. close.fp d. file.exit() 15) What will be the output of the following Python statement?(python 3.xx) >>>print(format("Welcome", "10s"), end = '#') >>>print(format(111, "4d"), end = '#') >>>print(format(924.656, "3.2f")) a. Welcome # 111#924.66 b. Welcome#111#.66 c. Welcome#111#924.66 d. Welcome# 111#924.66 16) What will be the output of the following Python code? >>> a={3,4,5} >>> b={5,6,7} >>> a|b a. {5} b. {3, 4, 5, 6, 7} c. Invalid operation d. {3,4,6,7} 17) What will be the output of the following Python code? x = "abcdef" i = "a" while i in x: print('i', end = " ") a. a b c d e f b. a a a a a a … c. i i i i i i … d. no output 18) The ………. construct allows to choose statements to be executed, depending upon the result of a condition. a. flow b. sequence c. selection d. repetition 19) An empty/null statement in Python is a. go b. pass c. over d. ; 20) Operations to be repeated a certain number of times are done by a. Sequential b. Loop c. Selection d. Simple 21) Which type of Programming does Python support? a. Object-oriented programming b. All of the mentioned c. Functional programming d. Structured programming 22) In a flow chart, which of the following is used to test the condition ? a. Decision b. Terminal c. Input/Output d. Process 23) Which of the following is not a legal integer type value in python. a. Octal b. Decimal c. Roman d. Hexadecimal 24) What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [A[row][1] for row in (0, 1, 2)] a. [7, 8, 9] b. [1, 4, 7] c. [4, 5, 6] d. [2, 5, 8] 25) What will be the output of the following Python code? True = False while True: print(True) break a. None b. none of the mentioned c. False d. True 26) In python we can change the value of variable a. we can not change the value of variable b. One Time c. Two Time d. Any Number of Time 27) What will be the output of the following Python code? print('*', "abcdef".center(7), '*') a. * abcdef * b. *abcdef * c. * abcdef * d. * abcdef* 28) In which of the following data type, duplicate items are not allowed? a. list b. set c. dictionary d. None of the above 29) To add a new element to a list we use which command? a. list1.add(5) b. list1.addEnd(5) c. list1.addLast(5) d. list1.append(5) 30) What will be the output of the following Python code? print("abcdef".center(10, '12')) a. error b. 12abcdef12 c. abcdef1212 d. 1212abcdef 31) The contents inside the “for loop” are separated by? a. comma b. hyphen c. colon d. semicolon 32) The ____ function takes two parameters, filename and mode. a. Open() b. Range c. Input d. Pass 33) Which statement is generally used as a placeholder? a. continue b. break c. goto d. pass 34) Which of the following statement prints helloexample test.txt? a. print(“helloexample test.txt”) b. print(“hello”example”test.txt”) c. print(“helloexample est.txt”) d. print(“hello”example”est.txt”) 35) What is testing process’ first goal ? a. Bug prevention b. All of These c. Testing d. Analyses 36) Which is/are the valid statement to print Hello Word in Python ? a. Both A and B b. print(Hello Word) c. print("Hello Word") d. print('Hello Word') 37) Which of the following is correct to Identify the right way to close a file. a. Close(file) b. File.close() c. None d. File.close 38) The symbol used for conditional statement n a flow chart is a ____ a. Circle shape b. None of the above c. rectangular box d. Diamond box 39) The operator returns the quotent after division. a. & b. % c. None of these d. // 40) What will be the output of the following Python code snippet? not(10<20) and not(10>30) a. Error b. False c. True d. No output 41) Which of the following executes the programming code line by line? a. Compiler b. Executer c. Translator d. Interpreter 42) What will be the output of the following Python code snippet? print('Hello World'.istitle()) a. None b. True c. Error d. False 43) How many keywords are there in python 3.7? a. 30 b. 31 c. 33 d. 32 44) Python code can run on a variety of platforms, it means Python is a _____ language. a. All of these b. Cross-Platform c. Platform Dependent d. Graphical 45) What is the output of the following program ? print 0.1+0.2==0.3 a. Machine dependent b. False c. True d. Error 46) What will be the output of following statement ? >>>"m"+"nl" a. 'm+nl' b. 'mn1' c. 'm n1' d. 'm' 47) A sentinel-controlled loop can be implemented using _____ a. for b. if c. None d. Both of the above 48) Testing is known as : a. A stage of all projects b. Evaluating deliverable to find errors c. None of the above d. Finding broken code 49) Python operator always yields the result of a. all of these b. floating point c. complex d. integer 50) What will be the output of the following Python code? s=set() type(s) a. set b. class set c. <class ‘set’> d. <’set’> 51) What will be the output of the following Python code? print("abcdef".center(7, '1')) a. abcdef1 b. error c. abcdef d. 1abcdef 52) The expression _____ implies that the variable x is converted to integer. a. exp(x) b. None of these c. chr (x) d. int (x) 53) 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 x in v if w in v] b. [x for v in w for x in w] c. [x for w in v if x in v] d. [x for x in w if x in v] 54) What will be the output of the following Python code? r = [11, 12, 13, 14, 15, 16, 17, 18, 19] A = [[0, 10, 20], a. 0 b. [0, 30, 60, 120, 160, 200, 300, 350, 400] c. [11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 20, 30, 40, 50, 60, 70, 80, 90] d. Error 55) Which of these are keyword? a. All b. is c. in d. assert 56) What is identity array? a. This is a normal array. b. This is a square array with ones on the main diagonal. c. This is a array with ones on the main diagonal. d. None of these 57) Istrip() method is used for : a. delete all the leading characters b. delete upper case characters c. delete all the leading and trailing characters d. delete all the trailing characters 58) What will be the output of the following Python code? print("abc DEF".capitalize()) a. Abc Def b. abc def c. Abc def d. ABC DEF 59) 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 60) _______ is latest high level language. a. LISP b. Ruby c. MATLAB d. Delphi 61) What is the output of the expression : 3*1**3 ? a. 1 b. 3 c. 9 d. 27 62) What is the symbol used to represent start and stop of a flowchart ? a. Rectangle b. Arrow c. Diamond d. Oval 63) Designing the problem in known as a. logical error b. Debugging c. Algorithm d. Testing 64) What will be the output of the following Python code? for i in range(5): if i == 5: break else: print(i) else: print("Here") a. 0 1 2 3 4 b. 0 1 2 3 4 Here c. 0 1 2 3 4 5 Here d. 1 2 3 4 5 65) The ______ mode of Python gives instant result of typed statement a. Interactive Mode b. Script Mode c. Combination of Interactive and Script modes d. All of these 66) 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. none of the mentioned c. error d. 0 1 2 0 1 2 67) What will be the output of the following Python code? print('{a}{b}{a}'.format(a='hello', b='world')) a. ‘hello’ ‘world’ ‘hello’ b. ‘helloworldhello’ c. ‘hello’ ‘hello’ ‘world’ d. ‘hello world’ 68) Which function is used to get the Data Type of any value? a. datatype() b. data_type() c. type() d. datatype() 69) All parameters (arguments) in the Python language are passed by. a. Text document b. Database c. reference d. Spreadsheet 70) What will be the output of the following Python code? print("abcdef".center()) a. cd b. none of the mentioned c. abcdef d. error 71) The readlines() method reads and returns ______ . a. None of the Above b. individual lines of a file c. A list of remaining lines of the entire file d. Write individual lines 72) What will be the output of the following Python code ? a = { 1 : “A”, 2 : “B”, 3 : “C” } for i in a: print (i, end=” “) a. None of these b. 'A' 'B' 'C' c. 1 'A' 2 'B' 3 'C' d. 1 2 3 73) Which of the following operators has the highest precedence? a. == b. < c. ** d. * 74) Users write the programs in which language? a. Middle-level Language b. Low-level Language c. None of these d. High-level Language 75) It defines the accessibility and the lifetime of a variable. a. None b. scope c. keyword d. Lifetime 76) Set of statements is executed again and again based upon conditional test. a. Selective b. None c. Sequence d. Looping 77) What will be the output of the following Python code? print("Hello {0} and {1}".format('foo', 'bin')) a. Error b. Hello {0} and {1} foo bin c. Hello 0 and 1 d. Hello foo and bin 78) Which one of the following is a valid Python if statement: a. if (a => 22) b. if (a>= 2) c. if a> = 2: d. if a >= 22 79) In Python, _____ defines a block of statements. a. Block b. {} c. Indentation d. loop 80) What value does the following expression evaluate to ? print(5 + 8 * ((3*5)-9)/10) a. 9.0 b. 10 c. 9.8 d. 10.0 81) Which of the following is not an advantage of using modules? a. Provides a means of reuse of program code b. Provides a means of dividing up tasks c. Provides a means of reducing the size of the program d. Provides a means of testing individual parts of the program 82) What will be the output of the following Python code snippet? x = 'abcd' for i in range(len(x)): i.upper() print (x) a. a b c d b. error c. 0 1 2 3 d. none of the mentioned 83) Leading white space at the beginning of each element, which is used to determine the group of statement a. None of the above b. Indentation c. Testing d. Debugging 84) Which amongst this is not a jump statement ? a. break b. goto c. for d. continue 85) What is the output of print(k) in the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] print(k) a. list of Trues b. a list of Nones c. list of Falses d. all characters of my_string that aren’t vowels 86) What will be the output of the following Python code? def unpack(a,b,c,d): print(a+d) x = [1,2,3,4] unpack(*x) a. Error b. 5 c. [5] d. [1,4] 87) 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 b. 1 3 5 7 9 11 … c. 1 2 d. 1 2 3 4 5 6 … 88) What arithmetic operators cannot be used with strings? a. – b. * c. + d. All of the mentioned 89) Recursive functions usually take _____ memory space than non- recursive function. a. less b. more c. None of these d. End 90) Which of the following is not a Keyword in Python ? a. break b. operators c. break d. continue 91) ____ is a function of dictionary gets all the values from the dictionary. a. uni() b. chr() c. None of these d. values() 92) The data type of an expression int(m)/int(n) will result in: a. int or float b. Float c. Int d. None of these 93) What will be the output of the following Python code snippet? print([i+j for i in "abc" for j in "def"]) a. [‘ad’, ‘ae’, ‘af’, ‘bd’, ‘be’, ‘bf’, ‘cd’, ‘ce’, ‘cf’] b. [‘da’, ‘ea’, ‘fa’, ‘db’, ‘eb’, ‘fb’, ‘dc’, ‘ec’, ‘fc’] c. [[‘ad’, ‘bd’, ‘cd’], [‘ae’, ‘be’, ‘ce’], [‘af’, ‘bf’, ‘cf’]] d. [[‘da’, ‘db’, ‘dc’], [‘ea’, ‘eb’, ‘ec’], [‘fa’, ‘fb’, ‘fc’]] 94) Which function is used to Writes the string(s) to the file and returns the number of characters written. a. write(s) b. read(s) c. writeline (s) d. None 95) What will be the output of the following Python code? print('ab'.isalpha()) a. False b. Error c. None d. True 96) Function range(10, 5, 2) will yield an iterable sequence like a. [] b. [2, 5, 8] c. [10, 8, 6] d. [8, 5, 2] 97) range(3) in Python is equivalent to: a. range(1,3,0) b. range(1,4,1) c. range(0,3,1) d. range(1,3) 98) A Python tuple that is created without using the parentheses brackets () is called as ? a. Tuple packing b. None of the above c. Tuple sorting d. Tuple sampling 99) What will be the output of the following Python code? i = 0 while i < 3: print(i) i += 1 else: print(0) a. 0 1 2 0 b. error c. 0 1 2 d. 0 1 2 3 0 100) Given a function that does not return any value, What value is thrown by default when executed in shell. a. int b. void c. None d. bool Your score is