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 purpose of the pass statement? To return a value To do nothing To raise an error 2 / 50 What is the result of "apple".find("z")? -1 None 0 3 / 50 What is the result of 10 // 3? 3 10 3.33 4 / 50 How do you check if a string contains only numbers? str.isdigit() isdigit() str.onlydigits() 5 / 50 What is the result of float(10)? 10 10 Error 6 / 50 How do you get the ASCII value of a character? ord.value('A') ascii('A') ord('A') 7 / 50 How do you start a comment in Python? * // # 8 / 50 What is the result of 3 ** 2 in Python? 12 9 6 9 / 50 What is the result of 3 > 5 or 5 > 2? None True False 10 / 50 How do you reverse a list in Python? list[::-1] list.reverse() reverse(list) 11 / 50 What does the pop() method do in a list? Adds an element Sorts the list Removes the last element 12 / 50 What is the output of 5 % 2? 2 0 1 13 / 50 How do you sort a list in descending order? list.desc() list.reverse() list.sort(reverse=True) 14 / 50 Which keyword is used to check for membership in a list? in_list contains in 15 / 50 How do you remove duplicates from a list? unique(list) remove_duplicates() list(set(list)) 16 / 50 How do you convert a list to a set in Python? set(list) list(set) {list} 17 / 50 Which keyword is used to import all contents of a module? * import_all all 18 / 50 How do you convert a string to an integer? int(string) str(int) convert(string) 19 / 50 What is the purpose of the return keyword? To exit a function To repeat a value To print a value 20 / 50 What does type([]) return? <class 'dict'> <class 'tuple'> <class 'list'> 21 / 50 How do you create a set in Python? [1, 2, 3] {1, 2, 3} (1, 2, 3) 22 / 50 What is the correct file extension for Python files? .py .pyth .pt 23 / 50 What is the result of 10 != 5? True Error False 24 / 50 How do you concatenate two strings? "&" "+" "concat()" 25 / 50 What is the result of bool([1, 2])? False None True 26 / 50 What is the result of "apple".replace("a", "o")? Error opple appoe 27 / 50 What is the correct way to create a list in Python? {1, 2, 3} [1, 2, 3] (1, 2, 3) 28 / 50 What is the output of print(2 + 3)? 5 23 5 29 / 50 How do you get the first character of a string? string.first() string[0] string[0:1] 30 / 50 What is the result of 3 < 2 and 2 < 4? False None True 31 / 50 What does isinstance("Python", str) return? True None False 32 / 50 Which operator is used for equality comparison? == === = 33 / 50 What is the result of "Python".find("o")? 3 -1 4 34 / 50 Which keyword is used to check a condition in Python? func loop if 35 / 50 How do you remove the last item from a list? list.pop() list.remove() list.delete() 36 / 50 What is the output of min(10, 20, 5)? 20 10 5 37 / 50 How do you iterate over dictionary keys? dict.items() dict.values() dict.keys() 38 / 50 How do you sort a dictionary by its keys? sorted(dict) dict.sortkeys() dict.sort() 39 / 50 What is the output of 10 == 10? False True Error 40 / 50 How do you check if a list is empty? list.empty() list.isempty() len(list) == 0 41 / 50 What is the output of len((1, 2, 3))? 4 2 3 42 / 50 How do you handle exceptions in Python? try-except if-else handle 43 / 50 What is the result of not True? True None False 44 / 50 What is the result of 5 * 2 == 10? True False Error 45 / 50 How do you convert a string to lowercase? str.lowercase() str.lower() lower(str) 46 / 50 How do you swap two variables in Python? var1, var2 = var2, var1 temp=var1; var1=var2; var2=temp var1 = var2; var2 = var1 47 / 50 How do you write a multi-line string in Python? " " """ """ ' ' 48 / 50 What does is compare in Python? Object identities Values only Memory usage 49 / 50 What is the output of "Hello" + "World"? Hello World Error HelloWorld 50 / 50 How do you create an infinite loop in Python? for True: repeat forever while True: Your score is LinkedIn Facebook Twitter VKontakte 0% Exit