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 "apple".upper()? Apple apple APPLE 2 / 50 How do you get the length of a list? size(list) len(list) count(list) 3 / 50 How do you remove whitespace from the beginning and end of a string? strip(" ") strip() clean() 4 / 50 What is the output of "abc".capitalize()? Abc abc ABC 5 / 50 What is the output of not(True)? True None False 6 / 50 How do you check if a key exists in a dictionary? key in dict.keys() dict.contains(key) key in dict 7 / 50 What is the result of min([3, 1, 2])? 1 3 2 8 / 50 What is the result of "apple".find("z")? 0 None -1 9 / 50 What does isinstance("Python", str) return? None False True 10 / 50 What is the result of "apple".replace("a", "o")? appoe Error opple 11 / 50 How do you get the keys of a dictionary? dict.keys() dict.values() dict.items() 12 / 50 What will range(5) produce? A list of letters A sequence of numbers A single number 13 / 50 What is the result of round(2.5)? 2 2 3 14 / 50 What does isinstance(x, int) check? If x is a string If x is defined If x is an integer 15 / 50 How do you remove duplicates from a list? unique(list) list(set(list)) remove_duplicates() 16 / 50 How do you start a function with optional arguments? def func(a): def func(a=1): def func(a: int): 17 / 50 What is the result of bin(10)? 0b1010 1010 Binary 18 / 50 How do you get the length of a dictionary? count(dict) len(list) len(dict) 19 / 50 How do you get the absolute value of a number? abs.value(num) abs(num) absolute(num) 20 / 50 What does the pop() method do in a list? Removes the last element Sorts the list Adds an element 21 / 50 Which data structure does set() create? A list A set A dictionary 22 / 50 What is the result of list(range(3, 6))? [3, 4, 5] [1, 2, 3, 4, 5, 6] [3, 6] 23 / 50 What is the result of 3 < 2 and 2 < 4? None False True 24 / 50 How do you add an element to a list? list.append() list.appendlist() list.add() 25 / 50 How do you check the type of a variable? type(var) isinstance(var) checktype(var) 26 / 50 What is the result of not True? False None True 27 / 50 How do you check if a string contains only numbers? str.isdigit() isdigit() str.onlydigits() 28 / 50 What is the result of "Python" * 2? PythonPython Error PythonPython 29 / 50 What is the correct file extension for Python files? .py .pyth .pt 30 / 50 How do you call a function my_function in Python? my_function call my_function my_function() 31 / 50 What is the result of bool([1, 2])? True None False 32 / 50 How do you remove the last item from a list? list.delete() list.remove() list.pop() 33 / 50 What is the result of range(3)? A list A range object A tuple 34 / 50 What is the output of 10 == 10? False True Error 35 / 50 How do you define a function in Python? def func() def func(): function func() 36 / 50 What is the result of [1, 2, 3] + [4, 5]? [1, 2, 3] [5, 4, 3, 2, 1] [1, 2, 3, 4, 5] 37 / 50 What is the output of print(2 ** 3)? 9 6 8 38 / 50 What is the output of print(3 == 3.0)? False True Error 39 / 50 How do you round 2.675 to two decimal places? 2.68 round(2.675, 2) round() 40 / 50 What does str(123) return? A string A float An integer 41 / 50 How do you sort a dictionary by its keys? sorted(dict) dict.sort() dict.sortkeys() 42 / 50 How do you find the index of an element in a list? index() locate() find() 43 / 50 How do you get the remainder of a division? // divmod() % 44 / 50 How do you raise a number to a power? num**power num^power pow(num, power) 45 / 50 How do you check if a key exists in a dictionary? key in dict dict.exist(key) dict.has_key() 46 / 50 What is the result of 3 > 5 or 5 > 2? False None True 47 / 50 How do you delete a key-value pair in a dictionary? del dict[key] pop dict[key] remove dict[key] 48 / 50 What is the result of len("Pythonn")? 6 7 8 49 / 50 What is the output of len((1, 2, 3))? 4 2 3 50 / 50 What is the output of [x for x in range(3)]? [0, 1, 2, 3] [0, 1, 2] [3] Your score is LinkedIn Facebook VKontakte 0% Exit