Coding Pyhton Coding Test 0% Time Limit 10 minutes Maximum Allowed Time Is over Your Paper Successfully Sent. coding Python 1 / 50 What does enumerate([10, 20, 30]) return? A list An iterator A dictionary 2 / 50 What is the result of 3 ** 2 in Python? 6 12 9 3 / 50 What is the result of "Python".startswith("Py")? False True None 4 / 50 How do you sort a list in descending order? list.reverse() list.sort(reverse=True) list.desc() 5 / 50 What is the purpose of the return keyword? To repeat a value To print a value To exit a function 6 / 50 What is the result of range(3)? A tuple A range object A list 7 / 50 Which method is used to get a value from a dictionary by key? get(key) find(key) search(key) 8 / 50 How do you declare a variable in Python? x = 5 declare x = 5 var x = 5 9 / 50 What is the output of type("123")? <class 'int'> <class 'float'> <class 'str'> 10 / 50 How do you start a comment in Python? * // # 11 / 50 How do you delete a key-value pair in a dictionary? pop dict[key] remove dict[key] del dict[key] 12 / 50 How do you create a lambda function in Python? lambda x -> x + 1 function(x): x + 1 lambda x: x + 1 13 / 50 How do you get the first character of a string? string[0:1] string.first() string[0] 14 / 50 What is the result of 3 < 2 and 2 < 4? True False None 15 / 50 What is the result of "Python" * 2? Error PythonPython PythonPython 16 / 50 How do you check if a string contains only numbers? str.isdigit() isdigit() str.onlydigits() 17 / 50 How do you open a file in write mode? open("file") open("file", "r") open("file", "w") 18 / 50 What is the output of list("hello")? ('h', 'e', 'l', 'l', 'o') ['hello'] ['h', 'e', 'l', 'l', 'o'] 19 / 50 What does continue do in a loop? Skips the iteration Restarts the loop Exits the loop 20 / 50 What is the result of bool([1, 2])? False None True 21 / 50 How do you swap two variables in Python? var1 = var2; var2 = var1 temp=var1; var1=var2; var2=temp var1, var2 = var2, var1 22 / 50 How do you access an element by key in a dictionary? dict.get("key") dict["key"] dict.key 23 / 50 What is a dictionary in Python? A list of values A set of numbers A key-value pair 24 / 50 How do you exit a program with a status code? sys.exit(1) quit(1) exit() 25 / 50 How do you get the keys of a dictionary? dict.keys() dict.values() dict.items() 26 / 50 What is the result of bin(10)? 0b1010 Binary 1010 27 / 50 What is the result of "apple".upper()? Apple APPLE apple 28 / 50 How do you convert a string to an integer? int(string) convert(string) str(int) 29 / 50 What is the output of len([1, 2, 3, 4])? 3 4 5 30 / 50 How do you create a single-line string in Python? """Hello""" '''Hello''' "Hello" 31 / 50 How do you add an element to a list? list.add() list.appendlist() list.append() 32 / 50 Which method adds an element to the end of a list? append() add() push() 33 / 50 What is the result of abs(-10)? 0 -10 10 34 / 50 What is the result of "hello".title()? HELLO Hello Hello 35 / 50 What is the correct way to create a list in Python? [1, 2, 3] {1, 2, 3} (1, 2, 3) 36 / 50 How do you convert a list into a set? set(list) list.set() list.unique() 37 / 50 Which keyword is used to check for membership in a list? in_list contains in 38 / 50 What is the result of [1, 2, 3] + [4, 5]? [5, 4, 3, 2, 1] [1, 2, 3, 4, 5] [1, 2, 3] 39 / 50 What does is compare in Python? Values only Memory usage Object identities 40 / 50 What is the output of "Hello" + "World"? Hello World HelloWorld Error 41 / 50 How do you round a number to two decimal places? approx(num, 2) round(num, 2) num.round(2) 42 / 50 What is the default value of end in a print() function? "n" "," "." 43 / 50 How do you create a shallow copy of a list? list.copy() list[:] copy(list) 44 / 50 What is the output of bool(None)? True False Error 45 / 50 How do you define a function in Python? function func() def func() def func(): 46 / 50 What is the result of len("Python")? 7 6 5 47 / 50 What is the result of list(range(3, 6))? [3, 4, 5] [3, 6] [1, 2, 3, 4, 5, 6] 48 / 50 How do you iterate over dictionary keys? dict.values() dict.keys() dict.items() 49 / 50 What is the result of 10 // 3? 10 3.33 3 50 / 50 What is the output of print(3 == 3.0)? Error False True Your score is LinkedIn Facebook VKontakte 0% Exit