PyGuru Academy Learn Python to Build AI /15 Python Quiz 1 (Q1 ~ Q15) 1 / 15 Q. 1 Are the following statements valid in Python 3? a, b = 0 ** 3, 0 / 3 print(a, b) Yes No 2 / 15 Q. 2 In Python, which letter is used to represent imaginary numbers? i j k 3 / 15 Q. 3 In Python, 6 % 10 is 6. What's the output of this code snippet? print (6 % -10) -6 -4 4 / 15 Q. 4 In Python, a set can contain duplicate items. Yes No 5 / 15 Q. 5 What does PyPI stand for in the Python programming world? Python Package Index Python Package Installer 6 / 15 Q. 6 What would be the result of evaluating the following Python code? my_dict = {"a": 1,"b": 2} x = my_dict.keys() my_dict["c"] = 3 print(x) dict_keys(['a', 'b']) ['a', 'b'] dict_keys(['a', 'b', 'c']) ['a', 'b', 'c'] 7 / 15 Q. 7 Which command correctly lists all installed Python packages? pip list pip --list 8 / 15 Q. 8 What is the output of following Python code? print([1, 2, 3] + [4, 5, 6]) [5, 7, 9] [1, 2, 3, 4, 5, 6] 9 / 15 Q. 9 What's the output of this Python code? a = True <= False print(a) 0 1 False True 10 / 15 Q. 10 Which Python code correctly calculates and prints the sum of two numbers? a = True <= False print(a) print(sum([5, 5])) print(sum(5, 5)) 11 / 15 Q. 11 What is the output of following Python code? print(bool("False")) True False 1 0 12 / 15 Q. 12 What is the output of following Python code? print(1 + True) 1 2 TypeError True 13 / 15 Q. 13 Using the datetime module, which statement correctly prints the current date and time? import datetime print(datetime.date.now()) print(datetime.datetime.now()) 14 / 15 Q. 14 What is the output of following Python code? mylist = [1, 2, 3, 4] print(mylist[-1:-1]) [] [4] 15 / 15 Q. 15 What is the output of following Python code? mydict = {"dob": 1998, "dob": 2002, "dob": 2005} print(mydict["dob"]) 1998 2005 KeyError 2002 Your score is 0% Close /15 Python Quiz 2 (Q16 ~ Q30) 1 / 15 Q. 16 What is the output of following Python code? print(1 ** 2 ** 2 ** 2) 1 16 2 / 15 Q. 17 The .pyc extension in Python stands for ....? Python config Python compressed Python compiled 3 / 15 Q. 18 Is the following code valid in Python? my_first_$ = 50 Yes No 4 / 15 Q. 19 In the Python World, PEP stands for ....? Python Enhancement Proposal Python Enhancement Programming 5 / 15 Q. 20 What is the output of following Python code? Note: In Python 3, output of print(8 // 4) is 2. print(4 // 8) 0 0.5 4 6 / 15 Q. 21 What is the output of following Python code? print('Python'.find('P')) 0 1 True False 7 / 15 Q. 22 What is the output of following Python code? print(3 / 3 ** 2) 1 1.0 0.3333333333333333 8 / 15 Q. 23 What is the output of following Python code? print("Python " + "3", "12", "0", sep=".") SyntaxError Python 3.12.0 Python .3.12.0 9 / 15 Q. 24 What is the output of following Python code? print([1, 3, 4, 2].sort()) None SyntaxError [1, 2, 3, 4] 10 / 15 Q. 25 How do you remove the element 'Java' from the following Python list? my_list = ['Python', 'Ruby', 'Java', 'C++'] my_list.pop('Java') my_list.remove('Java') [1, 2, 3, 4] 11 / 15 Q. 26 How can I add 'Player Y' to the team_2 (a python list)? team_1 = ['Player A', 'Player B'] team_2 = ['Player X'] team_2.append('Player Y') team_2.add('Player Y') [1, 2, 3, 4] 12 / 15 Q. 27 What is the output of following Python code? print(print) NameError <built-in function print> It prints a blank line 13 / 15 Q. 28 What is the output of following Python code? x = 2 x += 2 print(x) 2 3 4 14 / 15 Q. 29 What is the output of following Python code? players, points = ['A', 'B', 'C'], [10, 20, 30] print(type(zip(players, points))) <class 'dict'> <class 'zip'> <class 'list'> 15 / 15 Q. 30 In Python, we use an escape character to insert illegal characters in a string. An escape character is a ....? backslash \ forwardslash / Your score is 0% Close /15 Python Quiz 3 (Q31 ~ Q45) 1 / 15 Q. 31 What is the output of following Python code? print(list(range(6, 12, 2))) [6, 8, 10] [6, 8, 10, 12] 2 / 15 Q. 32 What is the output of following Python code? set1, set2 = {"John", 21, True}, {True, "John", 21} print(set1 == set2) True False SyntaxError 3 / 15 Q. 33 What is the output of following Python code? print(1--1) 0 1 2 SyntaxError 4 / 15 Q. 34 What is the output of following Python code? a = 50 def my_func(): a = 10 my_func() print(a) 10 50 NameError: 5 / 15 Q. 35 What is the output of following Python code? print("hello".count("a")) 0 -1 TypeError: 6 / 15 Q. 36 What is the output of following Python code? b = True c = False print(c / b) False 0 0.0 ZeroDivisionError: 7 / 15 Q. 37 What is the output of following Python code? my_list = [1, 2] print(my_list * 3) [1, 2, 1, 2, 1, 2] [[1, 2], [1, 2], [1, 2]] TypeError: 8 / 15 Q. 38 What is the output of following Python code? print('ai' in ['AI', 'ML', 'DS']) True False 9 / 15 Q. 39 Please select the correct Python code. for i in (0, 5), print(i) for print(i) i in range(0, 5) for i in range(0, 5): print(i) 10 / 15 Q. 40 What is the correct syntax to import an entire module named "math" in Python 3? import math import "math" import <math> 11 / 15 Q. 41 What is the output of following Python code? count += 1 print(count) 1 2 NameError: 12 / 15 Q. 42 What is the output of following Python code? list_a = [1, 2, 3] list_b = [4, 5, 6] print(list_b + list_a) [1, 2, 3, 4, 5, 6] [4, 5, 6, 1, 2, 3] 13 / 15 Q. 43 What is the output of following Python code? print(len(56)) 2 TypeError: 14 / 15 Q. 44 What is the output of following Python code? z, y, x = 25, 16, 9 x, y, z = x - 3 ** 2, y - 4 ** 2, z - 5 ** 2 print(x, y, z) 0 0 0 1 1 1 3 4 5 TypeError: 15 / 15 Q. 45 What is the output of following Python code? my_list = [1, 2, 3, ] print(len(my_list)) 2 3 4 Your score is 0% Close