Coding Pyhton Coding Test 0% Time Limit 10 minutes Maximum Allowed Time Is over Your Paper Successfully Sent. coding Python 1 / 50 What is the result of min([3, 1, 2])? 1 3 2 2 / 50 What is the result of "apple".find("z")? 0 None -1 3 / 50 What is the output of 10 == 10? True Error False 4 / 50 What is the result of range(3)? A list A range object A tuple 5 / 50 How do you start a comment in Python? * # // 6 / 50 How do you check the type of a variable? isinstance(var) checktype(var) type(var) 7 / 50 What is the result of "Python".find("o")? -1 4 3 8 / 50 What is the output of bool(None)? False True Error 9 / 50 How do you open a file for reading in Python? open(file, "r") open(file, "a") open(file, "w") 10 / 50 What is the output of print(2 + 3)? 5 5 23 11 / 50 What is the default value of end in a print() function? "n" "," "." 12 / 50 Which method adds an element to the end of a list? append() push() add() 13 / 50 What is the keyword used to define a class in Python? object class def 14 / 50 How do you sort a list in descending order? list.desc() list.sort(reverse=True) list.reverse() 15 / 50 What is the result of 3 > 5 or 5 > 2? False None True 16 / 50 How do you sort a dictionary by its keys? dict.sort() sorted(dict) dict.sortkeys() 17 / 50 How do you exit a program with a status code? exit() quit(1) sys.exit(1) 18 / 50 Which Python keyword is used to handle exceptions? catch try handle 19 / 50 How do you handle exceptions in Python? try-except if-else try-catch 20 / 50 What does the pop() method do in a list? Adds an element Sorts the list Removes the last element 21 / 50 How do you define a constant in Python? define(var) Use uppercase names const var 22 / 50 What is the result of "Python"[::-1]? nohtyP Python Error 23 / 50 How do you declare a variable in Python? x = 5 var x = 5 declare x = 5 24 / 50 What is the output of list("hello")? ['h', 'e', 'l', 'l', 'o'] ['hello'] ('h', 'e', 'l', 'l', 'o') 25 / 50 How do you create a single-line string in Python? "Hello" """Hello""" '''Hello''' 26 / 50 How do you write a multi-line string in Python? ' ' """ """ " " 27 / 50 How do you access the value of a key in a dictionary? key.dict() dict[key] dict.value(key) 28 / 50 How do you round 2.675 to two decimal places? round() 2.68 round(2.675, 2) 29 / 50 What does continue do in a loop? Repeats the loop Ends the loop Skips to the next iteration 30 / 50 How do you add an element to a list? list.append() list.appendlist() list.add() 31 / 50 What does break do in a loop? Repeats the loop Skips one iteration Ends the loop 32 / 50 What is the correct way to create a list in Python? [1, 2, 3] {1, 2, 3} (1, 2, 3) 33 / 50 What does str(123) return? A float A string An integer 34 / 50 How do you open a file in write mode? open("file", "w") open("file", "r") open("file") 35 / 50 How do you check if a key exists in a dictionary? key in dict dict.contains(key) key in dict.keys() 36 / 50 What is the output of min(10, 20, 5)? 10 5 20 37 / 50 How do you check if a string contains only numbers? str.onlydigits() isdigit() str.isdigit() 38 / 50 What is the output of len({1, 2, 2, 3})? 3 4 5 39 / 50 What is the output of 2 * '3' in Python? Error 33 6 40 / 50 How do you convert a string to an integer? str(int) convert(string) int(string) 41 / 50 What is the result of "Python" * 2? Error PythonPython PythonPython 42 / 50 How do you create an empty dictionary? () [] {} 43 / 50 What is the result of bool([1, 2])? None True False 44 / 50 How do you convert a list to a set in Python? list(set) set(list) {list} 45 / 50 What will range(5) produce? A list of letters A single number A sequence of numbers 46 / 50 What is the result of 10 // 3? 3 3 3.33 47 / 50 How do you iterate over dictionary keys? dict.items() dict.values() dict.keys() 48 / 50 What is the output of [1, 2, 3][1]? 1 3 2 49 / 50 How do you start a function with optional arguments? def func(a: int): def func(a): def func(a=1): 50 / 50 How do you convert a string to lowercase? str.lowercase() str.lower() lower(str) Your score is LinkedIn Facebook VKontakte 0% Exit