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 b. hot 100 c. hot True d. hot 100 True
What will be the output after the following statements? x = [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] x.sort() print(x) a. SortError b. [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] c. [‘a’, ‘A’, ‘b’, ‘B’, ‘c’, ‘C’] d. [‘A’, ‘B’, ‘C’, ‘a’, ‘b’, ‘c’]
What will be the output after the following statements? x = [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] x.sort(key=str.lower) print(x) a. SortError b. [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] c. [‘a’, ‘A’, ‘b’, ‘B’, ‘c’, ‘C’] d. [‘A’, ‘B’, ‘C’, ‘a’, ‘b’, ‘c’]
What will be the output after the following statements? x = [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] x.sort(key=str.swapcase) print(x) a. TypeError b. [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] c. [‘a’, ‘A’, ‘b’, ‘B’, ‘c’, ‘C’] d. [‘A’, ‘B’, ‘C’, ‘a’, ‘b’, ‘c’]
What will be the output after the following statements? x = [‘a’, ‘b’, 1, 2, ‘A’, ‘B’] x.sort() print(x) a. TypeError b. [‘a’, ‘b’, ‘c’, ‘A’, ‘B’, ‘C’] c. [‘a’, ‘A’, ‘b’, ‘B’, ‘c’, ‘C’] d. [‘A’, ‘B’, ‘C’, ‘a’, ‘b’, ‘c’]
What will be the output after the following statements? import random x = [‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’, ‘Sunday’] print(x[random.randint(0, len(x) – 1)]) a. IndexError b. A random day from all the seven days c. A random day from all the days except Sunday d. A random day from all the days except Monday
What will be the output after the following statements? x = ‘Today is a nice day’ + \ ‘ I will go for a walk today’ print(x) a. SyntaxError b. Today is a nice day c. I will go for a walk today d. Today is a nice day I will go for a walk today
What will be the output after the following statements? x = ‘Today is a nice day’ x[9] = ‘not ‘ print(x) a. TypeError b. Today is a nice day c. SyntaxError d. Today is not a nice day
What will be the output after the following statements? x = ‘Today is a nice day’ y = x[:9] + ‘not ‘ + x[9:] print(y) a. TypeError b. Today is a nice day c. SyntaxError d. Today is not a nice day
What will be the output after the following statements? x = ‘Today is a nice day’ y = x[:9] + ‘not ‘ + x[9:] print(x) a. TypeError b. Today is a nice day c. SyntaxError d. Today is not a nice day
What will be the output after the following statements? x = ‘Today is not a nice day’ x = ‘Today is a nice day’ print(x) a. TypeError b. Today is a nice day c. SyntaxError d. Today is not a nice day
What will be the output after the following statements? x = (‘Today’, ‘nice’, ‘day’) x[1] = ‘not’ print(x) a. TypeError b. (‘Today’, ‘nice’, ‘day’) c. SyntaxError d. (‘Today’, ‘not’, ‘nice’, ‘day’)
What will be the data type of the output after the following statements? x = (‘Today’) print(x) a. TypeError b. String c. Tuple d. List
What will be the data type of the output after the following statements? x = (‘Today’,) print(x) a. TypeError b. String c. Tuple d. List
What will be the data type of y after the following statements? x = [1, 2, 3, 4] y = tuple(x) a. TypeError b. String c. Tuple d. List
What will be the data type of z after the following statements? x = [1, 2, 3, 4] y = tuple(x) z = list(y) a. TypeError b. String c. Tuple d. List
What will be the data type of the output after the following statements? x = ‘Python’ y = list(x) print(y) a. TypeError b. String c. Tuple d. List
What will be the data type of the output after the following statements? x = ‘Python’ y = tuple(x) print(y) a. TypeError b. String c. Tuple d. List
What will be the output after the following statements? x = (‘Python’) print(x) a. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’) b. Python c. P y t h o n d. (‘Python’)
What will be the output after the following statements? x = (‘Python’,) print(x) a. (‘Python’,) b. Python c. P y t h o n d. (‘Python’)
What will be the output after the following statements? x = [0, 2, 4, 6] print(tuple(x)) a. [0, 2, 4, 6] b. (0, 2, 4, 6) c. 0, 2, 4, 6 d. 0 2 4 6
What will be the output after the following statements? x = (0, 2, 4, 6) print(list(x)) a. [0, 2, 4, 6] b. (0, 2, 4, 6) c. 0, 2, 4, 6 d. 0 2 4 6
What will be the output after the following statements? x = ‘Python’ print(list(x)) a. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’) b. (Python) c. [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] d. [‘Python’]
What will be the output after the following statements? x = ‘Python’ print(tuple(x)) a. (‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’) b. (Python) c. [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’] d. [‘Python’]
What will be the output after the following statements? x = [4, 5, 7, 8, 9] y = x y[1] = 6 print(y) a. [4, 5, 7, 8, 9] b. [4, 5, 6, 7, 8, 9] c. [4, 6, 7, 8, 9] d. [4, 7, 8, 9]
What will be the output after the following statements? x = [4, 5, 7, 8, 9] y = x y[1] = 6 print(x) a. [4, 5, 7, 8, 9] b. [4, 5, 6, 7, 8, 9] c. [4, 6, 7, 8, 9] d. [4, 7, 8, 9]
What will be the output after the following statements? def abc(z): z.append(44) x = [7, 8, 9] abc(x) print(x) a. [7, 8, 9] b. [7, 8, 9, 44] c. [7, 44, 8, 9] d. [44, 7, 8, 9]
What will be the output after the following statements? import copy x = [5, 4, 3, 2, 1] y = copy.copy(x) x.append(6) print(y[-1]) a. 5 b. 6 c. [5, 4, 3, 2, 1, 6] d. 1
What will be the output after the following statements? import copy x = [5, 4, 3, 2, 1] y = copy.copy(x) x[2] = 6 print(y[2]) a. 3 b. 6 c. [5, 4, 6, 3, 2, 1] d. 4
What will be the output after the following statements? import copy x = [5, 4, 3, 2, 1] y = [7, 8, 9] z = [x, y] a = copy.copy(z) x[2] = 6 print(a) a. [[5, 4, 3, 2, 1], [7, 8, 9]] b. [[5, 4, 6, 2, 1], [7, 8, 9]] c. [5, 4, 6, 3, 2, 1] d. [5, 4, 6, 2, 1, 7, 8, 9]
What will be the output after the following statements? import copy x = [5, 4, 3, 2, 1] y = [7, 8, 9] z = [x, y] a = copy.deepcopy(z) x[2] = 6 print(a) a. [[5, 4, 3, 2, 1], [7, 8, 9]] b. [[5, 4, 6, 2, 1], [7, 8, 9]] c. [5, 4, 6, 3, 2, 1] d. [5, 4, 6, 2, 1, 7, 8, 9]
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(x[‘year’]) a. day b. KeyError c. Sunday d. 10
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} for i in x.values(): print(i, end=’ ‘) a. Sunday 10 b. KeyError c. Sunday d. 10
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} for i in x: print(i, end=’ ‘) a. Sunday 10 b. day week c. Sunday d. 10
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} for i in x.keys(): print(i, end=’ ‘) a. Sunday 10 b. day week c. Sunday d. 10
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} for i in x.items(): print(i, end=’ ‘) a. (‘day’, ‘Sunday’) (‘week’, 10) b. day week c. (‘week’, 10) d. (‘day’, ‘Sunday’)
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(list(x.keys())) a. Sunday 10 b. day week c. [‘day’, ‘week’] d. (day, week)
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(tuple(x.items())) a. ((‘week’, 10), (‘day’, ‘Sunday’)) b. (‘day’, ‘Sunday’) (‘week’, 10) c. [‘day’, ‘week’] d. (day, week)
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(tuple(x.values())) a. Sunday 10 b. (‘Sunday’, 10) c. [‘Sunday’, 10] d. 10
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} for i, j in x.items(): print(i, j, end=’ ‘) a. (‘day’, ‘Sunday’) (‘week’, 10) b. {‘day’:’Sunday’, ‘week’:10} c. ‘day’:’Sunday’, ‘week’:10 d. day Sunday week 10
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(‘day’ in x.values()) a. Sunday b. True c. False d. day
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(‘day’ in x.keys()) a. Sunday b. True c. False d. day
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(x.get(‘day’, ‘Friday’)) a. Friday b. True c. Sunday d. day
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(x.get(‘days’, ‘Friday’)) a. Friday b. True c. Sunday d. day
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(x.get(‘weak’, 5)) a. 10 b. 5 c. Sunday d. day
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(x.get(‘week’, 5)) a. 10 b. 5 c. Sunday d. day
What will be the output after the following statements? x = {‘day’:’Sunday’, ‘week’:10} print(x.get(‘year’, 2016)) a. year b. 2016 c. Sunday d. 10
What will be the output after the following statements? x = {‘year’: 2016, ‘month’: ‘March’} if ‘day’ not in x: x[‘day’] = ‘Tuesday’ print(x) a. (‘day’, ‘Tuesday’) b. {‘day’: ‘Tuesday’, ‘month’: ‘March’} c. ‘day’: ‘Tuesday’, ‘month’: ‘March’, ‘year’: 2016 d. {‘day’: ‘Tuesday’, ‘month’: ‘March’, ‘year’: 2016}
What will be the output after the following statements? x = {‘year’: 2016, ‘month’: ‘March’} x.setdefault(‘day’, ‘Tuesday’) print(x) a. (‘day’, ‘Tuesday’) b. {‘day’: ‘Tuesday’, ‘month’: ‘March’} c. ‘day’: ‘Tuesday’, ‘month’: ‘March’, ‘year’: 2016 d. {‘day’: ‘Tuesday’, ‘month’: ‘March’, ‘year’: 2016}