(2, -2) (4, -4) (6, -6) is the correct answer to “What will be the output of the following Python code? l1=[2,4,6] l2=[-2,-4,-6] for i in zip(l1, l2): print(i)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? def increment_items(L, increment): i = 0 while i < len(L): L[i] = L[i] + increment i = i + 1 values = [1, 2, 3] print(increment_items(values, 2)) print(values)
Correct Answer: Option A — None [3, 4, 5]
Detailed Academic Explanation:
None [3, 4, 5] is the correct answer to “What will be the output of the following Python code? def increment_items(L, increment): i = 0 while i < len(L): L[i] = L[i] + increment i = i + 1 values = [1, 2, 3] print(increment_items(values, 2)) print(values)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], [4, 4, 4], [5, 5, 5]] zip(A, B)
Correct Answer: Option A — Address of the zip object
Detailed Academic Explanation:
Address of the zip object is the correct answer to “What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], [4, 4, 4], [5, 5, 5]] zip(A, B)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? a=["Apple","Ball","Cobra"] a.sort(key=len) print(a)
Correct Answer: Option B — ['Ball', 'Apple', 'Cobra']
Detailed Academic Explanation:
['Ball', 'Apple', 'Cobra'] is the correct answer to “What will be the output of the following Python code? a=["Apple","Ball","Cobra"] a.sort(key=len) print(a)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? veggies = ['carrot', 'broccoli', 'potato', 'asparagus'] veggies.insert(veggies.index('broccoli'), 'celery') print(veggies)
['carrot', 'celery', 'broccoli', 'potato', 'asparagus'] Correct 1.00 is the correct answer to “What will be the output of the following Python code? veggies = ['carrot', 'broccoli', 'potato', 'asparagus'] veggies.insert(veggies.index('broccoli'), 'celery') print(veggies)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2] >>>list1 < list2
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “What will be the output of the following Python code? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2] >>>list1 < list2”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? l=[[1 ,2, 3], [4, 5, 6], [7, 8, 9]] [[row[i] for row in l] for i in range(3)]
[[1, 4, 7], [2, 5, 8], [3, 6, 9]] is the correct answer to “What will be the output of the following Python code? l=[[1 ,2, 3], [4, 5, 6], [7, 8, 9]] [[row[i] for row in l] for i in range(3)]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [A[row][1] for row in (0, 1, 2)]
Correct Answer: Option C — [2, 5, 8]
Detailed Academic Explanation:
[2, 5, 8] is the correct answer to “What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] [A[row][1] for row in (0, 1, 2)]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following piece of code? a=list((45,)*4) print((45)*4) print(a)
Correct Answer: Option C — 180 [45,45,45,45]
Detailed Academic Explanation:
180 [45,45,45,45] is the correct answer to “What is the output of the following piece of code? a=list((45,)*4) print((45)*4) print(a)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? l=[[1, 2, 3], [4, 5, 6]] for i in range(len(l)): for j in range(len(l[i])): l[i][j]+=10 l
[[11, 12, 13], [14, 15, 16]] is the correct answer to “What will be the output of the following Python code? l=[[1, 2, 3], [4, 5, 6]] for i in range(len(l)): for j in range(len(l[i])): l[i][j]+=10 l”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
To shuffle the list(say list1) what function do we use?
Correct Answer: Option C — random.shuffle(list1)
Detailed Academic Explanation:
random.shuffle(list1) is the correct answer to “To shuffle the list(say list1) what function do we use”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? t=32.00 [round((x-32)*5/9) for x in t]
Correct Answer: Option D — Error
Detailed Academic Explanation:
Error is the correct answer to “What will be the output of the following Python code? t=32.00 [round((x-32)*5/9) for x in t]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
To which of the following the "in" operator can be used to check if an item is in it?
Correct Answer: Option D — All of the mentioned
Detailed Academic Explanation:
All of the mentioned is the correct answer to “To which of the following the "in" operator can be used to check if an item is in it”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Read the information given below carefully and write a list comprehension such that the output is: ['e', 'o'] w="hello" v=('a', 'e', 'i', 'o', 'u')
Correct Answer: Option B — [x for x in w if x in v]
Detailed Academic Explanation:
[x for x in w if x in v] is the correct answer to “Read the information given below carefully and write a list comprehension such that the output is: ['e', 'o'] w="hello" v=('a', 'e', 'i', 'o', 'u')”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? import math [str(round(math.pi)) for i in range (1, 6)]
Correct Answer: Option C — ['3', '3', '3', '3', '3']
Detailed Academic Explanation:
['3', '3', '3', '3', '3'] is the correct answer to “What will be the output of the following Python code? import math [str(round(math.pi)) for i in range (1, 6)]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? l=[1,2,3,4,5] [x&1 for x in l]
Correct Answer: Option B — [1, 0, 1, 0, 1]
Detailed Academic Explanation:
[1, 0, 1, 0, 1] is the correct answer to “What will be the output of the following Python code? l=[1,2,3,4,5] [x&1 for x in l]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? a = [1, 5, 7, 9, 9, 1] b=a[0] x= 0 for x in range(1, len(a)): if a[x] > b: b = a[x] b= x print(b)
Correct Answer: Option C — 4
Detailed Academic Explanation:
4 is the correct answer to “What will be the output of the following Python code? a = [1, 5, 7, 9, 9, 1] b=a[0] x= 0 for x in range(1, len(a)): if a[x] > b: b = a[x] b= x print(b)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? a="hello" b=list((x.upper(),len(x)) for x in a) print(b)
[('H', 1), ('E', 1), ('L', 1), ('L', 1), ('O', 1)] is the correct answer to “What will be the output of the following Python code? a="hello" b=list((x.upper(),len(x)) for x in a) print(b)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for row in range(0, len(values)): for column in range(0, len(values[row])): if v < values[row][column]: v = values[row][column] print(v)
Correct Answer: Option D — 33
Detailed Academic Explanation:
33 is the correct answer to “What will be the output of the following Python code? values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for row in range(0, len(values)): for column in range(0, len(values[row])): if v < values[row][column]: v = values[row][column] print(v)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? >>> a=[14,52,7] >>>> b=a.copy() >>> b is a
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “What will be the output of the following Python code? >>> a=[14,52,7] >>>> b=a.copy() >>> b is a”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
[3, 1, 25, 5, 20, 5, 4, 3] is the correct answer to “Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = names1 names3 = names1[:] names2[0] = 'Alice' names3[1] = 'Bob' sum = 0 for ls in (names1, names2, names3): if ls[0] == 'Alice': sum += 1 if ls[1] == 'Bob': sum += 10 print sum
Correct Answer: Option B — 12
Detailed Academic Explanation:
12 is the correct answer to “What will be the output of the following Python code? names1 = ['Amir', 'Bear', 'Charlton', 'Daman'] names2 = names1 names3 = names1[:] names2[0] = 'Alice' names3[1] = 'Bob' sum = 0 for ls in (names1, names2, names3): if ls[0] == 'Alice': sum += 1 if ls[1] == 'Bob': sum += 10 print sum”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))?
Correct Answer: Option C — [x**-1 for x in [1, 2, 3]]
Detailed Academic Explanation:
[x**-1 for x in [1, 2, 3]] is the correct answer to “What is the list comprehension equivalent for: list(map(lambda x:x**-1, [1, 2, 3]))”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? [ord(ch) for ch in 'abc']
Correct Answer: Option A — [97, 98, 99]
Detailed Academic Explanation:
[97, 98, 99] is the correct answer to “What will be the output of the following Python code? [ord(ch) for ch in 'abc']”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], [4, 4, 4], [5, 5, 5]] [B[row][col]*A[row][col] for row in range(3) for col in range(3)]
[3, 6, 9, 16, 20, 24, 35, 40, 45] is the correct answer to “What will be the output of the following Python code? A = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] B = [[3, 3, 3], [4, 4, 4], [5, 5, 5]] [B[row][col]*A[row][col] for row in range(3) for col in range(3)]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
[3, 5, 20, 5, 25, 1, 3] is the correct answer to “Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output when we execute list("hello")?
Correct Answer: Option A — ['h', 'e', 'l', 'l', 'o']
Detailed Academic Explanation:
['h', 'e', 'l', 'l', 'o'] is the correct answer to “What is the output when we execute list("hello")”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of print(k) in the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] print(k)
Correct Answer: Option B — a list of Nones
Detailed Academic Explanation:
a list of Nones is the correct answer to “What is the output of print(k) in the following Python code snippet? k = [print(i) for i in my_string if i not in "aeiou"] print(k)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Write a list comprehension equivalent for the Python code shown below. for i in range(1, 101): if int(i*0.5)==i*0.5: print(i)
Correct Answer: Option B — [i for i in range(1, 101) if int(i*0.5)==(i*0.5)]
Detailed Academic Explanation:
[i for i in range(1, 101) if int(i*0.5)==(i*0.5)] is the correct answer to “Write a list comprehension equivalent for the Python code shown below. for i in range(1, 101): if int(i*0.5)==i*0.5: print(i)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
Correct Answer: Option C — [0.0, 0.5, 1.0, 1.5]
Detailed Academic Explanation:
[0.0, 0.5, 1.0, 1.5] is the correct answer to “Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] def ttt(m): v = m[0][0] for row in m: for element in row: if v < element: v = element return v print(ttt(data[0]))
Correct Answer: Option C — 4
Detailed Academic Explanation:
4 is the correct answer to “What will be the output of the following Python code? data = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] def ttt(m): v = m[0][0] for row in m: for element in row: if v < element: v = element return v print(ttt(data[0]))”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? word1="Apple" word2="Apple" list1=[1,2,3] list2=[1,2,3] print(word1 is word2) print(list1 is list2)
Correct Answer: Option D — True False
Detailed Academic Explanation:
True False is the correct answer to “What will be the output of the following Python code? word1="Apple" word2="Apple" list1=[1,2,3] list2=[1,2,3] print(word1 is word2) print(list1 is list2)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
Correct Answer: Option D — all of the mentioned
Detailed Academic Explanation:
all of the mentioned is the correct answer to “Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? names1 = ['Amir', 'Bala', 'Chales'] if 'amir' in names1: print(1) else: print(2)
Correct Answer: Option C — 2
Detailed Academic Explanation:
2 is the correct answer to “What will be the output of the following Python code? names1 = ['Amir', 'Bala', 'Chales'] if 'amir' in names1: print(1) else: print(2)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? a=165 b=sum(list(map(int,str(a)))) print(b)
Correct Answer: Option C — 12
Detailed Academic Explanation:
12 is the correct answer to “What will be the output of the following Python code? a=165 b=sum(list(map(int,str(a)))) print(b)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? a=[[]]*3 a[1].append(7) print(a)
Correct Answer: Option B — [[7], [7], [7]]
Detailed Academic Explanation:
[[7], [7], [7]] is the correct answer to “What will be the output of the following Python code? a=[[]]*3 a[1].append(7) print(a)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code? def unpack(a,b,c,d): print(a+d) x = [1,2,3,4] unpack(*x)
Correct Answer: Option D — 5
Detailed Academic Explanation:
5 is the correct answer to “What will be the output of the following Python code? def unpack(a,b,c,d): print(a+d) x = [1,2,3,4] unpack(*x)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python code snippet? print([if i%2==0: i; else: i+1; for i in range(4)])
Correct Answer: Option C — error
Detailed Academic Explanation:
error is the correct answer to “What will be the output of the following Python code snippet? print([if i%2==0: i; else: i+1; for i in range(4)])”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?
Correct Answer: Option D — 2
Detailed Academic Explanation:
2 is the correct answer to “Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python list comprehension? [j for i in range(2,8) for j in range(i*2, 50, i)]
Correct Answer: Option C — A list of non prime numbers, up to 50
Detailed Academic Explanation:
A list of non prime numbers, up to 50 is the correct answer to “What will be the output of the following Python list comprehension? [j for i in range(2,8) for j in range(i*2, 50, i)]”. This question is standard in competitive examination syllabi for Lists In Python.
💡Key Conceptual Anchor:Lists In Python
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.