Quizzes Start Python Intermediate Quiz Python Intermediate Quizzes 1 / 24 How do you define a global variable? variable(global) global_var global 2 / 24 Will the following work?a, b, c = 3, 7, 10 Yes No 3 / 24 What will the following output?x = float(14)print(x) 14 float(14) 14.0 4 / 24 What's the outcome?a = 7b = "Hello"print(a + b) 7 Hello TypeError 7 + Hello 5 / 24 What is the output of the example below?a = "This is a string"print(a[5:16]) is a string NameError a string 6 / 24 What is the outcome of the following?a = "This Is A String"print(a.lower()) THIS IS A STRING This Is A String this is a string 7 / 24 What is the result of the scenario below?a = [23, 12, 6, 87, 4, 54, 2, 35]print(min(a)) 87 2 1 8 / 24 How do you create a list? {} [] () 9 / 24 How do you remove the last item from a list? pop() remove() del() 10 / 24 What is the result of the following?list_var = ["UK", "Canada", "Germany", "Japan"]list_var.sort()print(list_var) UK Canada Germany Japan Canada Germany Japan UK Canada Japan Germany UK 11 / 24 What will be the output of the example below?a = 9b = 4print(a % b) 0 1 1.5 12 / 24 What is the result of the following?a = 7if a > 0: print("The number is positive") if a > 10: print("The number is also higher than 10") The number is also higher than 10 The number is positive The number is also higher than 10 The number is positive 13 / 24 What will the following produce?a = 11if a < 10: print (a, "is less than 10") 3 is less than 10 TypeError 14 / 24 Select the correct output:num = [1, 2, 3]for a in num: if a == 2: continue print(a) 1, 3 1, 2, 3 1, 2 15 / 24 What is the output of the following:a = 0while a < 4: print(a) a += 1 if a == 2: break 0, 1, 2, 3 0, 1 0, 1, 2, 3, 4 16 / 24 What will the following output?num = list(range(0, 15, 2))print(num) [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14] [4, 5, 6, 7, 8, 9, 10] [0, 2, 4, 6, 8, 10, 12, 14] 17 / 24 Functions: does the number of parameters must match the number of arguments? Yes No 18 / 24 Select the correct outcome?def person(): pass IndentationError TypeError 19 / 24 What will the following output?def num(a, b): return 6 * a + (b / 2)num(2, 6) (2, 6) 15.0 15 20 / 24 Classes: can del be used to delete both object properties and entire objects? No Yes 21 / 24 What is the function of pass in a class? Pass arguments to an object Avoid errors Pass cannot be used in a class 22 / 24 If the file "file.txt" already exists, what will happen if we run the following?x = open("file.txt", "x")x.close() File will be replaced Error Nothing will change 23 / 24 What does \n produce? Tab Escape symbol New line 24 / 24 Select the correct answer:b = 1try: print(b)except: print("Error! Something went wrong")else: print("Nothing is wrong") 1 Error! Something went wrong 1 Nothing is wrong Your score isThe average score is 60% 0% Restart quiz by AICorr Team We are proud to offer our extensive knowledge to you, for free. The AICorr Team puts a lot of effort in researching, testing, and writing the content within the platform (aicorr.com). We hope that you learn and progress forward. <span class="nav-subtitle screen-reader-text">Page</span> Previous PostIntroduction to Data Science: 20 Concepts for BeginnersNext PostGANs in ML: Generative Adversarial Networks in Machine Learning Related Posts Python File Handling Quiz Python Sets Quiz Python Tuples Quiz