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 output of bool(0)? 0 True False 2 / 50 What is the output of list("hello")? ['h', 'e', 'l', 'l', 'o'] ('h', 'e', 'l', 'l', 'o') ['hello'] 3 / 50 How do you start a comment in Python? # * // 4 / 50 How do you delete a key-value pair in a dictionary? pop dict[key] del dict[key] remove dict[key] 5 / 50 How do you create a lambda function in Python? lambda x: x + 1 function(x): x + 1 lambda x -> x + 1 6 / 50 How do you declare a variable in Python? x = 5 var x = 5 declare x = 5 7 / 50 Which method is used to remove an item from a list? erase() delete() remove() 8 / 50 What is the result of [1, 2, 3] + [4, 5]? [5, 4, 3, 2, 1] [1, 2, 3, 4, 5] [1, 2, 3] 9 / 50 What does continue do in a loop? Skips the iteration Exits the loop Restarts the loop 10 / 50 What is the output of [1, 2, 3][1]? 1 3 2 11 / 50 What is the output of [x for x in range(3)]? [0, 1, 2, 3] [3] [0, 1, 2] 12 / 50 What is the result of range(3)? A list A tuple A range object 13 / 50 What is the result of not True? None True False 14 / 50 How do you create a multi-line comment in Python? ''' ''' # " " 15 / 50 What is the default value of end in a print() function? "," "n" "." 16 / 50 How do you split a string into a list? string.partition() string.split() split(string) 17 / 50 How do you iterate over a range in steps of 2? range(0, 10) range(0, 10, 2) range(2, step=2) 18 / 50 How do you exit a program with a status code? sys.exit(1) exit() quit(1) 19 / 50 What does int("10") return? A string An integer A float 20 / 50 What is the output of type("123")? <class 'float'> <class 'str'> <class 'int'> 21 / 50 What will len("Hello") return? 4 6 5 22 / 50 How do you create a shallow copy of a list? copy(list) list.copy() list[:] 23 / 50 What is the output of 2 * '3' in Python? 33 Error 6 24 / 50 How do you check the type of a variable? type(var) checktype(var) isinstance(var) 25 / 50 Which Python keyword is used to handle exceptions? handle catch try 26 / 50 What is the correct way to create a list in Python? [1, 2, 3] (1, 2, 3) {1, 2, 3} 27 / 50 How do you handle exceptions in Python? handle if-else try-except 28 / 50 How do you get the remainder of a division? divmod() // % 29 / 50 What is the result of "abc".upper()? abc Abc ABC 30 / 50 Which data type is used to store a sequence of characters in Python? int str float 31 / 50 How do you get the absolute value of a number? abs.value(num) abs(num) absolute(num) 32 / 50 What does break do in a loop? Restarts the loop Skips an iteration Exits the loop 33 / 50 What is the result of bool([1, 2])? True None False 34 / 50 What is the result of round(2.5)? 3 2 2 35 / 50 How do you check the type of a variable in Python? isinstance(var) typeof(var) type(var) 36 / 50 How do you join elements of a list into a string? "".join(list) concat(list) combine(list) 37 / 50 How do you handle exceptions in Python? try-catch if-else try-except 38 / 50 What does break do in a loop? Repeats the loop Skips one iteration Ends the loop 39 / 50 What is the output of print(2 + 3)? 5 23 5 40 / 50 What is the result of 3 ** 2 in Python? 9 12 6 41 / 50 What is the output of "Python".split("t")? ['Py', 'hon'] ['P', 'y', 't', 'h', 'o', 'n'] ['Python'] 42 / 50 What is the result of bin(10)? 1010 0b1010 Binary 43 / 50 How do you convert a list to a set in Python? set(list) list(set) {list} 44 / 50 How do you remove the last item from a list? list.remove() list.delete() list.pop() 45 / 50 What is the result of 5 >= 5? True False None 46 / 50 What is the result of "Python" * 2? Error PythonPython PythonPython 47 / 50 How do you check if a string starts with a specific character? startswith("char") string.startswith("char") "char" in string 48 / 50 What is the output of bool([])? False None True 49 / 50 What is the result of max([1, 5, 3])? 5 1 3 50 / 50 Which method adds an element to the end of a list? append() push() add() Your score is LinkedIn Facebook VKontakte 0% Exit