Home / Programming Questions / Page 3

# Prgramming MCQs Feed | Page - 3

## ```Q. What is the output of the following program? data = [x for x in range(5)] temp = [x for x in range(7) if x in data and x%2==0] print(temp)```

(A) [0, 2, 4, 6]
(B) [0, 2, 4]
(C) [0, 1, 2, 3, 4, 5]
(D) Runtime error

## ```Q. What is the output of the following program? L1 = [1, 2, 3, 4] L2 = L1 L3 = L1.copy() L4 = list(L1) L1 =  print(L1, L2, L3, L4)```

(A) [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]
(B) [, 2, 3, 4] [, 2, 3, 4] [, 2, 3, 4] [1, 2, 3, 4]
(C) [5, 2, 3, 4] [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4]
(D) [, 2, 3, 4] [, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]

## ```Q. What is the output of the following program? import sys L1 = tuple() print(sys.getsizeof(L1), end = " ") L1 = (1, 2) print(sys.getsizeof(L1), end = " ") L1 = (1, 3, (4, 5)) print(sys.getsizeof(L1), end = " ") L1 = (1, 2, 3, 4, 5, [3, 4], 'p', '8', 9.777, (1, 3)) print(sys.getsizeof(L1))```

(A) 0 2 3 10
(B) 32 34 35 42
(C) 48 64 72 128
(D) 48 144 192 480

(A) 4 0
(B) 5 8
(C) 5 IndexError
(D) 4 1

## ```Q. What is the output of the following program? L = [1, 3, 5, 7, 9] print(L.pop(-3), end = ' ') print(L.remove(L), end = ' ') print(L)```

(A) 5 None [3, 7, 9]
(B) 5 1 [3, 7, 9]
(C) 5 1 [3, 7, 9]
(D) 5 None [1, 3, 7, 9]

## ```Q. What is the output of the following program? def REVERSE(L): L.reverse() return(L) def YKNJS(L): List = list() List.extend(REVERSE(L)) print(List) L = [1, 3.1, 5.31, 7.531] YKNJS(L)```

(A) [1, 3.1, 5.31, 7.531]
(B) [7.531, 5.31, 3.1, 1]
(C) IndexError
(D) AttributeError: „NoneType‟ object has no attribute „REVERSE‟

(A) 10.0 4.0
(B) 4.3588 4
(C) 10 .0 4
(D) 10.0 0

## ```Q. What is the output of the following program? D = dict() for x in enumerate(range(2)): D[x] = x D[x+7] = x print(D)```

(A) KeyError
(B) {0: 1, 7: 0, 1: 1, 8: 0}
(C) {0: 0, 7: 0, 1: 1, 8: 1}
(D) {1: 1, 7: 2, 0: 1, 8: 1}

Download our easy to use, user friendly Android App from Play Store. And learn MCQs with one click. 