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? >>> a={5,6,7} >>> sum(a,5) a. 23 b. 5 c. 18 d. Invalid syntax for sum method, too many arguments 2) Which is/are the valid statement to print Hello Word in Python ? a. print(Hello Word) b. print("Hello Word") c. Both A and B d. print('Hello Word') 3) What will be the output of the following Python code? >>> a={3,4,5} >>> b={5,6,7} >>> a|b a. {3,4,6,7} b. Invalid operation c. {3, 4, 5, 6, 7} d. {5} 4) Suppose i is 5 and j is 4, i + j is same as ________ a. i.__add__(j) b. i.__ADD(j) c. i.__Add(j) d. i.__add(j) 5) Which one of the following is a valid Python if statement: a. if a >= 22 b. if (a>= 2) c. if (a => 22) d. if a> = 2: 6) What is the output of the expression : 3*1**3 ? a. 9 b. 27 c. 1 d. 3 7) What will be the output of the following Python code, if s1= {1, 2, 3}? s1.issubset(s1) a. Error b. No output c. True d. False 8) What is the output when we execute list(“hello”)? a. [‘olleh’] b. [‘hello’] c. [‘llo’] d. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] 9) What is mean by dynamically typed language a. A value of a variable is change each type when it run b. A variable can store only numeric value c. A variable can store only one type of value d. A variable can store any datatype type of value 10) Which operator is also called as Conditional operator? a. Ternary b. Assignment c. Relational d. Logical 11) In Python, which of the following will create a block in a compound statement ? a. colon b. indentation in any form c. statements indented at a lower, same level d. { } 12) What will be the output of the following Python code? >>>str1="helloworld" >>>str1[::-1] a. dlrowolleh b. world c. helloworld d. hello 13) What will be the output of the following Python code? l=[1,2,3,4,5] [x&1 for x in l] a. [1, 1, 1, 1, 1] b. [1, 0, 1, 0, 1] c. [1, 0, 0, 0, 0] d. [0, 1, 0, 1, 0] 14) The scope rule in Python are summarized as____. a. None of these b. Both of the above c. ELGB ( enclosed, local,global, built-in). d. LEGB (local, enclosed,global, built-in ) 15) What will be the output of the following Python code? s={2, 5, 6, 6, 7} s a. {2, 5, 6, 6, 7} b. Error c. {2, 5, 6, 7} d. {2, 5, 7} 16) ……….design approach starts by dividing the complex algorithm into one or more modules. a. Top-Down b. None of the above c. Both of the above d. Down-Top 17) Identify the correct sequence of steps to run a program. a. Link, load, Code, Compile, & Execute b. Code, Compile, Link, Execute & load c. Compile, Code, Link, load & Execute d. Code, Compile, Link, load & Execute 18) What is identity array? a. This is a array with ones on the main diagonal. b. None of these c. This is a normal array. d. This is a square array with ones on the main diagonal. 19) 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#924.66 c. Welcome#111#.66 d. Welcome# 111#924.66 20) ____ is a set of functions you want to include in your application. a. Module b. Function c. None of these d. Folder 21) What is the output of the following? m=0 while m<5: m+=1 if m==3: break else: print(0) a. 0 1 2 b. 0 0 1 0 2 c. 0 1 2 0 d. error 22) Error does not fall into any category a. Value Error b. Syntax Error c. Runtime Error d. None of these 23) Each module should also be divided into sub modules according to software engineering and programming style. a. None of the abov b. Coding c. Bottom up method d. Top down method 24) What will be the output of the following Python code? >>> a=("Check")*3 >>> a a. (‘CheckCheckCheck’) b. Syntax error c. (‘Check’,’Check’,’Check’) d. * Operator not valid for tuples 25) Tool ________ is used for program design. a. Algorithm b. Flowchart c. All of the above d. Psuedocode 26) What will be the output of the following Python code? >>>t=(1,2,4,3) >>>t[1:-1] a. (2, 4, 3) b. (1, 2) c. (1, 2, 4) d. (2, 4) 27) A sentinel-controlled loop can be implemented using _____ a. if b. Both of the above c. for d. None 28) Which operator is also called as Comparative operator? a. Relational b. Assignment c. Arithmetic d. Logical 29) 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. Error b. [[11, 12, 13], [14, 15, 16], [17, 18, 19]] c. [11, 12, 13, 14, 15, 16, 17, 18, 19] d. [11, 12, 13], [14, 15, 16], [17, 18, 19] 30) 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. PYTHONPATH d. PYTHONCASEOK 31) Python code can run on a variety of platforms, it means Python is a _____ language. a. All of these b. Graphical c. Cross-Platform d. Platform Dependent 32) What will be the output of the following Python code? print('1Rn@'.lower()) a. n b. r c. rn d. 1rn@ 33) What is the output of >>>float('12.6') a. 12.6 b. syntax error c. 12 d. 12.6' 34) Leading white space at the beginning of each element, which is used to determine the group of statement a. Indentation b. None of the above c. Testing d. Debugging 35) In the Python statement x = a + 5 - b : a and b are a. Equation b. Expression c. Operands d. operators 36) Which of the following executes the programming code line by line? a. Executer b. Compiler c. Interpreter d. Translator 37) Which of the following is not a Keyword in Python ? a. break b. break c. operators d. continue 38) Which is/are the the valid string value in Python a. "@#$%" b. "Rajesh" c. All of These d. "12345" 39) Is the following Python code valid? >>> a,b,c=1,2,3 >>> a,b,c a. Yes, (1,2,3) is printed b. 1 is printed c. No, invalid syntax d. Yes, [1,2,3] is printed 40) To give a default separator with print() argument is used. a. sep b. tab c. end d. separator 41) What will be the output of the following Python code def func(a, b=5, c=10): printa is, a, 'and b is', b, 'and c is',) func(13, 17) func(a=2, c=4) func(5,7,9) (A) a is 13 and b is 15 and c is 10 a is 2 and b is 5 and c is 4 a is 5 and b is 7 and c is 9 (B) a is 13 and b is 17 and cis 10 a is 2 and b is 4 and c is 4 a is 5 and b is 9 and c is 7 (C) a is 13 and b is 17 and c is 10 a is 2 and b is 5 and cis 4 a is 5 and b is 7 and c is 9 (D) None of the above a. option A b. option C c. option B d. option D 42) How is a function declared in Python? a. def function function_name() b. declare function function_name(): c. def function_name(): d. declare function_name(): 43) In which year was the Python language developed? a. 1981 b. 1995 c. 1989 d. 1972 44) Which type of Error generate, when the argument have invalid values specified? a. Value Error b. None of these c. Syntax Error d. Logical Error 45) ___ in Python is a counter-controlled loop. a. while b. None of the above c. for d. Both A and B 46) What will be the output of the following Python code? print("abcdef".find("cd")) a. True b. 2 c. 3 d. None of the mentioned 47) If list1=[10,20,30], then operation list1*2 returns ____ . a. [10,20,30,20,40,60] b. None c. [10,20,30,10,20,30] d. [20,40,60] 48) Which of the following refers to mathematical function? a. sqrt b. Sub c. rhombus d. add 49) What is the return type of function id? a. float b. bool c. dict d. int 50) You don't have to pay for Python and you can view its source code too. It means Python is .......... a. freeware b. Free and open source c. shareware d. open source 51) ______ are the modes of both writing and reading in binary format in file. a. bw+ b. rb+ c. None of these d. bw+ 52) Which of the following is a Python tuple? a. {1, 2, 3} b. (1, 2, 3) c. {} d. [1, 2, 3] 53) Which one of the following is the correct extension of the Python file- a. None of these b. .python c. .p d. .py 54) Which of the following functions take iterables(can be zero or more), makes iterator that aggregates elements based on the iterables passed, and returns an iterator of tuples. a. list() b. tuple() c. Zip() d. None of the above 55) Diamond shaped symbol is used in flowcharts to show the a. Decision box b. Error box c. Statement box d. If-statement box 56) To return the length of string s what command do we execute? a. s.size() b. s.__len__() c. size(s) d. len(s) 57) The .......... construct repeats a set of statements a specified number of times or as long as a condition is true. a. selection b. repetition c. flow d. sequence 58) 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. 1 2 3 4 5 b. 0 1 2 3 4 5 Here c. 0 1 2 3 4 d. 0 1 2 3 4 Here 59) What will be the output of the following Python code? print("Hello {} and {}".format('foo', 'bin')) a. Error b. Hello {} and {} c. Hello foo and bin d. Hello and 60) If a={5,6,7}, what happens when a.add(5) is executed? a. Error as 5 already exists in the set b. a={5,5,6,7} c. Error as there is no add function for set data type d. a={5,6,7} 61) A natural number 1 is also an ____ . a. Factor b. integer number c. unique number d. None of these 62) 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. 1 2 3 4 c. a b c d d. error 63) A loop block in python starts with a.. - a. : (colan) b. ; (semicolon) c. ,(Comma) d. None of these 64) What will be the output of the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] a. prints only on executing print(k) b. prints all characters of my_string that aren’t vowels c. prints all the consonants in my_string d. prints all the vowels in my_string 65) What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i) a. 0 1 2 0 1 2 b. error c. 0 1 2 d. none of the mentioned 66) Testing is known as : a. Evaluating deliverable to find errors b. None of the above c. A stage of all projects d. Finding broken code 67) Which of the statements about modules is false? a. dir() built-in function monitors the items in the namespace of the main module. b. In the "from-import" form of import, all identifiers regardless of whether they are private or public are imported. c. In the “from-import" form of import, identifiers beginning with two underscores are private and aren't imported. d. When a module is loaded, a compiled version of the module with file extension .pyc is automatically produced. 68) What is the default value of encoding in encode()? a. ascii b. qwerty c. utf-16 d. utf-8 69) Which of the following is correct in respect of advantages of functions ? a. Reducing duplication of code b. None c. Decomposing complex problems into simpler pieces d. both 70) What will be the output of the following expression ? x =4 print(x<<2) a. 6 b. 16 c. 4 d. 2 71) Designing the problem in known as a. Algorithm b. logical error c. Testing d. Debugging 72) Following is true for understanding of a problem - a. understanding the subject on which the problem is based. b. communication with the client c. All of the mentioned d. knowing the knowledge base 73) 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. 1 b. Error c. 5 d. 2 74) Python code can run on variety of plateforms, it means Python is a _____language. a. Cross-plateform b. Plateform Dependen c. Graphical d. All of these 75) The operator returns the quotent after division. a. None of these b. % c. & d. // 76) Which of the following will run without errors? a. round() b. round(45.8) c. round(6352.898,2,5) d. round(7463.123,2,1) 77) What will be the output of the following Python code? >>>"Welcome to Python".split() 77) a. “Welcome”, “to”, “Python” b. {“Welcome”, “to”, “Python”} c. [“Welcome”, “to”, “Python”] d. (“Welcome”, “to”, “Python”) 78) In Python, a variable must be declared before it is assigned a value. a. Only in modules b. False c. True d. Only in Functions 79) In a flowchart a calculation (process) is represented by a. A rectangle b. A rhombus c. A circle d. A parallelogram 80) What will be the output of the following Python code? i = 1 while True: if i%3 == 0: break print(i) i + = 1 a. none of the mentioned b. 1 2 3 c. error d. 1 2 81) Diagram that represents steps or operations involved in any kind of process is called a. Management hierarchy b. System diagram c. Flowcharts d. Convenience diagrams 82) In Python, a complex number is represented as: a. a+√b j b. a+√j c. a+bj d. a+√b 83) 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. a b c b. 0 1 2 c. none of the mentioned d. 0 a 1 b 2 c 84) 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 7 8 9 b. 6 5 4 3 c. 6 6 6 6 d. 6 8 10 12 85) Data structure used in recursion. a. None of these b. Queue c. Stack d. Pointer 86) What will be the output of the following Python code snipped if x = 1? x<<2 a. 2 b. None of these c. 8 d. 4 87) Which of these about a set is not true? a. mmutable data type b. Data type with unordered values c. Allows duplicate values d. Mutable data type 88) What will be the result of the expression 10 or 0 ? a. 10 b. 1.0 c. 1 d. 0 89) Why are local variable names beginning with an underscore discouraged? a. they slow down execution b. they are used to indicate a private variables of a class c. they confuse the interpreter d. they are used to indicate global variables 90) 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. 5 b. 33 c. 3 d. 6 91) which one is an Assignment Operator a. / b. & c. = d. # 92) What will be the output of the following Python code? a. 0 1 2 b. a b c c. none of the mentioned d. 0 a 1 b 2 c 93) An empty / null statement in Python is _____ . a. pass b. null c. empty d. None 94) Which of the following is an invalid variable? a. 1st_string b. _myvar c. foo d. my_string_1 95) The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use whereas lists use square brackets. a. curly brackets b. Angular brackets c. None of these d. parentheses 96) What will be the output of the following Python code? >>> a=(1,2,3,4) >>> del(a[2]) a. Now a=(3,4) b. Now, a=(1,2,4) c. Now, a=(1,3,4) d. Error as tuple is immutable 97) Which one is not the attribute of a file? a. closed b. mode c. softspace d. rename 98) 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. (B) b. (A) c. (D) d. (C) 99) 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. a list of Nones b. all characters of my_string that aren’t vowels c. list of Trues d. list of Falses 100) Which of the following language is understood by computer? a. None of these b. . Machine language c. Assembly languag d. High-level language Your score is