Coding Pyhton Coding Test 0% Time Limit 10 minutes Maximum Allowed Time Is over Your Paper Successfully Sent. coding Python 1 / 50 How do you swap two variables in Python? var1, var2 = var2, var1 temp=var1; var1=var2; var2=temp var1 = var2; var2 = var1 2 / 50 Which keyword is used to check a condition in Python? func if loop 3 / 50 How do you get the remainder of a division? % divmod() // 4 / 50 What is the result of 10 > 5 and 5 < 2? None True False 5 / 50 What is the purpose of the pass statement? To raise an error To return a value To do nothing 6 / 50 How do you raise a number to a power? pow(num, power) num**power num^power 7 / 50 What does str(123) return? A string An integer A float 8 / 50 What is the result of "Python" * 2? Error PythonPython PythonPython 9 / 50 How do you check if a string starts with a specific character? string.startswith("char") "char" in string startswith("char") 10 / 50 What is the result of 5 * 2 == 10? True False Error 11 / 50 What is the result of len("Python")? 5 7 6 12 / 50 What is the output of bool([])? False None True 13 / 50 What is the result of round(2.5)? 3 2 2 14 / 50 How do you open a file in write mode? open("file") open("file", "r") open("file", "w") 15 / 50 How do you declare a variable in Python? var x = 5 declare x = 5 x = 5 16 / 50 What is the output of [1, 2, 3][1]? 1 2 3 17 / 50 What is the result of bin(10)? 1010 0b1010 Binary 18 / 50 How do you check if a string contains only numbers? str.isdigit() str.onlydigits() isdigit() 19 / 50 Which module is used for mathematical operations? numbers math calc 20 / 50 How do you round 2.675 to two decimal places? round() round(2.675, 2) 2.68 21 / 50 What does break do in a loop? Restarts the loop Exits the loop Skips an iteration 22 / 50 What is the result of [1, 2, 3] + [4, 5]? [1, 2, 3] [5, 4, 3, 2, 1] [1, 2, 3, 4, 5] 23 / 50 What is the result of "Python".find("o")? 3 4 -1 24 / 50 How do you remove duplicates from a list? remove_duplicates() unique(list) list(set(list)) 25 / 50 What will range(5) produce? A sequence of numbers A single number A list of letters 26 / 50 What is the result of "apple".find("z")? None 0 -1 27 / 50 How do you handle exceptions in Python? try-except try-catch if-else 28 / 50 What is the result of 10 // 3? 3 3.33 10 29 / 50 What does isinstance(x, int) check? If x is a string If x is an integer If x is defined 30 / 50 What is the output of len({1, 2, 2, 3})? 4 5 3 31 / 50 How do you create an empty dictionary? () [] {} 32 / 50 How do you find the index of an element in a list? index() find() locate() 33 / 50 What is the output of print(2 + 3)? 23 5 5 34 / 50 What does continue do in a loop? Repeats the loop Ends the loop Skips to the next iteration 35 / 50 What is the output of type("123")? <class 'int'> <class 'str'> <class 'float'> 36 / 50 Which function is used to get input from the user? input() read() scan() 37 / 50 What is the output of 5 % 2? 1 2 0 38 / 50 What is the keyword used to define a function in Python? define def func 39 / 50 How do you access an element by key in a dictionary? dict["key"] dict.key dict.get("key") 40 / 50 Which data type is used to store a sequence of characters in Python? int float str 41 / 50 Which method adds an element to the end of a list? push() add() append() 42 / 50 What is the result of 5 >= 5? None False True 43 / 50 How do you get the length of a list? len(list) count(list) size(list) 44 / 50 How do you add an element to a list? list.append() list.appendlist() list.add() 45 / 50 What is the result of bool("")? True None False 46 / 50 What is the result of 3 > 5 or 5 > 2? None True False 47 / 50 What is the output of bool(0)? 0 True False 48 / 50 What is the output of print(type(10))? <class 'int'> <class 'str'> <class 'float'> 49 / 50 What is the result of 10 != 5? True Error False 50 / 50 What is the correct file extension for Python files? .pt .pyth .py Your score is LinkedIn Facebook VKontakte 0% Exit