PYTHON MOCK TEST-2 1 / 27 Which of the following functions can be used to compare two strings in Python? join() compare() cmpo O 2 / 27 Which ofthe following statements is true regarding the find() method in Python? It returns the index of the first occurrence of the substring in the string. It replaces all occurrences of the substring in the string with a new string. It returns True if the substring exists in the string and False otherwise. It splits the string into a list of substrings based on the occurrence of the substring. 3 / 27 What will be the output of this code?What win be the of thisif 10>5: no yes yes no yes no 4 / 27 What is the default separator used by the split() method in Python? comma c,) Space Period (.) Tab() 5 / 27 What is the Python function to toggle the case of a string (i.e., convert uppercase to lowercase and vice versa)? upper() lower() swapcase() capitalize() 6 / 27 Which ofthe following data types are considered mutable in Python? egers Strings Floats Lists 7 / 27 How do you remove all spaces from a string in Python? By using the strip() method By using the replace() method By using the split() method By using the join() method 8 / 27 All Keywords in Python are in lower case Capitalized UPPER CASE None of the mentioned 9 / 27 What will be the output of the below line of code? 10 / 27 Which of the following are Identity Operators? 'in' and 'not in' 'and' and 'or' 'is' and 'is not' 'xor' and 'xnor' 11 / 27 What is the output of the code? HelloWorId Hello World HellotWorld Hello World 12 / 27 While loop can be compared with a repetitive for statement. break raise 13 / 27 What are the 3 loop control statements in Python? break, continue and pass continue, for and while for, while and AND/OR break, pass and nested loops 14 / 27 'Simple if' has to check how many conditions? Minimum 3 Only 1 Maximum 2 Total 5 15 / 27 Which ofthe following is the correct syntax for Python string slicing? string[start:end] string[start:] string[:end] string[end:start] 16 / 27 Dictionaries are used to store data values in? key:value pair pair key-value pair lues only keys are by default present there 17 / 27 statement skips the rest of the loop and jumps over to the statement following the loop. pass break if else continue 18 / 27 Modulus and Assign Operator are written as? % = %= # 19 / 27 According to the flowchart of if-elif-else, what happens when the control goes to the else block? Control goes to the body of if. It executes the body of else, and then control goes to the body of if. It will terminate the loop and exit the program Control never goes to the else. 20 / 27 Operators with the same precedence are evaluated in which manner? Left to Right Can't say Right to Left None of the mentioned 21 / 27 Why do we use Indentation? To divide multiple conditions To differentiate the code To differentiate the level of nesting To validate the output. 22 / 27 Which ofthe following is not a data type? Numeric Data Alphabetic Data Symbolic Data Alphanumeric Data 23 / 27 What can we have with an elif ladder? Multiple elif statements Multiple loops along with if statements Single if statement Single or multiple elif statements with if block. 24 / 27 Does floor division round the resultant value down to the nearest integer? YES NO 25 / 27 One loop inside another loop is called Nesting of loops Loop inside loop Loop within loop Multiple loops 26 / 27 Which are the numeric types in Python? int, str and boolean math, pandas and int int, float and complex char, str and text 27 / 27 What is the order of precedence in Python? Il, l, IV, Ill, V, VI I,II,III,IV,V,VI l, 1, Ill, IV, V, VI l, Il, Ill, IV, VI, V Your score isThe average score is 11% 0% Restart quiz