Python 3 MCQ (SET-12) – Multiple Choice Questions and Answers

What will be the output after the following statements? x = {‘year’: 2016, ‘month’: ‘March’} x.setdefault(‘day’, ‘Tuesday’) x.setdefault(‘day’, ‘Monday’) print(x) a. (‘day’, ‘Monday’) b. {‘day’: ‘Monday’, ‘month’: ‘March’} c. {‘day’: ‘Tuesday’, ‘month’: ‘March’, ‘year’: 2016} d. {‘day’: ‘Monday’, ‘month’: ‘March’, ‘year’: 2016} What will be the data type of x after the following statement? x … Read more

Python 3 MCQ (SET-11) – Multiple Choice Questions and Answers

What will be the output after the following statements? x = [‘hot’, ‘100’, True] weather, humid = x print(weather, humid) a. ValueError b. hot 100 c. hot True d. hot 100 True What will be the output after the following statements? x = [‘hot’, ‘100’, True] x.remove(‘100’) weather, humid = x print(weather, humid) a. ValueError … Read more

Python 3 MCQ (SET-10) – Multiple Choice Questions and Answers

What will be the output after the following statements? a = list(range(-10,5,2)) print(sum(a)) a. -24 b. 0 c. 24 d. 20 What will be the output after the following statements? x = [5, 4, 3, 2, 1] y = x.copy() x[0] = 6 print(y) a. [6, 4, 3, 2, 1] b. 6 c. [5, 4, … Read more