Questions Bank November 5, 2022 Comments Off on Questions Bank Take a look at the snippet and choose the true statement: nums = [1, 2, 3] vals = nums del vals[:]OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What is the output of the following snippet? def fun(x): if x % 2 == 0: return 1 else: return 2 print(fun(fun(2)))OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What will be the output of the following snippet? a = 1 b = 0 a = a ^ b b = a ^ b a = a ^ b print(a, b)OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What is the output of the following piece of code? x = 1 y = 2 x, y, z = x, x, y z, y, z = x, y, z print(x, y, z)OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What is the output of the following snippet? my_list = [x * x for x in range(5)] def fun(lst): del lst[lst[2]] return lst print(fun(my_list))OpenProgrammingAnswers asked 2 years ago • Python Essentials 1Which of the following variable names are illegal and will cause the SyntaxError exception? (Select two answers)OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What value will be assigned to the x variable? z = 0 y = 10 x = y < z and z > y or y < z and z < yOpenProgrammingAnswers asked 2 years ago • Python Essentials 1The following snippet: def func(a, b): return b ** a print(func(b=2, 2))OpenProgrammingAnswers asked 2 years ago • Python Essentials 1The result of the following division: 1 // 2OpenProgrammingAnswers asked 2 years ago • Python Essentials 1The following snippet: def function_1(a): return None def function_2(a): return function_1(a) * function_1(a) print(function_2(2))OpenProgrammingAnswers asked 2 years ago • Python Essentials 1An operator able to check whether two values are not equal is coded as:OpenProgrammingAnswers asked 2 years ago • Python Essentials 1Which of the following sentences are true about the code? (Select two answers) nums = [1, 2, 3] vals = numsOpenProgrammingAnswers asked 2 years ago • Python Essentials 1The meaning of a positional argument is determined by:OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What is the output of the following snippet? my_list = [1, 2] for v in range(2): my_list.insert(-1, my_list[v]) print(my_list)OpenProgrammingAnswers asked 2 years ago • Python Essentials 1What is the output of the following code? try: value = input(“Enter a value: “) print(value/value) except ValueError: print(“Bad input…”) except ZeroDivisionError: print(“Very bad input…”) except TypeError: print(“Very very bad input…”) except: print(“Booo!”)OpenProgrammingAnswers asked 2 years ago • Python Essentials 1 Share Facebook Twitter Stumbleupon LinkedIn Pinterest