Quizzes Start Python Advanced Quiz Python Advanced Quiz 1 / 19 What will the following output?name = "Peter"age = 20print("Hello, my name is " + name + "." + " And I am " + age + " years old.") Hello, my name is Peter. And I am 20 years old. TypeError Hello, my name is " + name + "." + " And I am " + age + " years old. 2 / 19 How do you define a f-string? f'()' f”[]” f”{}” 3 / 19 How to import a specific function from a module? from module import function import function from module import function as f 4 / 19 What is the outcome of the following?a = [1, 2, 3, 4, 5, 6, 7, 8, 9]print(a[-7:-1:1]) [3, 4, 5, 6, 7, 8] 9 [3, 4, 5, 8, 7, 8] 5 / 19 Which function operates directly onto the original data? sort() sorted() Both 6 / 19 What's the outcome?a = 3if not(a > 2): print("Just a message.") Just a message Error Blank output 7 / 19 What will the following output?a = 14b = 14if a is not b: print("a does not equal b") a does not equal b a equals b Blank output 8 / 19 Will a loop output an else statement if there is a break statement before that? Yes No 9 / 19 What is the result of the following nested while loop?num1 = 1while num1 <= 1: print(num1) num2 = 0 while num2 <= 2: print(num1 * num2) num2 += 1 num1 += 1 1 1 1 2 0 1 1 2 1 0 1 2 10 / 19 What does seed do in the random module? It produces a random integer. Initialises a random generator. It returns a random item from a data type. 11 / 19 What does the following do?import randomprint(random.randint(1, 20)) It returns the number 16. It returns a random number. It returns an error. 12 / 19 Are *args & **kwargs mandatory when using functions? No Yes 13 / 19 What is the result of the recursion function below?def rec_func(n): print(n) if n < 50: rec_func(n + 10)rec_func(2) 2 12 22 32 42 52 2 22 32 42 52 62 2 22 22 32 42 52 14 / 19 What's the outcome of the following factorial function?def factorial(n): if n == 1: return 1 else: return (n * factorial(n - 1))factorial(4) 4 24 3 15 / 19 Can a child class have properties and methods on its own? No Yes 16 / 19 Is the following statement true?Class inheritance allows classes to convert to functions? Yes No 17 / 19 What does the os module allow? It allows developers to create files. It allows developers to interact with the operating system It allows developers to interact with the Integrated development environment. 18 / 19 Is the statement below true?You do not need to close a file when using the with statement? Yes No 19 / 19 How do you raise an exception in Python? create exception raise exception Your score isThe average score is 51% 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 PostCPU, GPU, and NPU: What is the Difference Between the ThreeNext PostBatch vs Online Inference in Machine Learning Related Posts Python File Handling Quiz Python Sets Quiz Python Tuples Quiz