Explore topic-wise MCQs in Computer Science Engineering (CSE).

This section includes 477 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science Engineering (CSE) knowledge and support exam preparation. Choose a topic below to get started.

151.

,2,3],"check")

A. syntax error
B. {1:”check”,2:”check”,3:”check”}
C. “check”
D. {1:none,2:none,3:none}
Answer» C. “check”
152.

][1])

A. [2,3,4]
B. 3
C. 2
D. an exception is thrown
Answer» C. 2
153.

Which of the statements about dictionary values if false?

A. more than one key can have the same value
B. the values of the dictionary can be accessed as dict[key]
C. values of a dictionary must be unique
D. values of a dictionary can be a mixture of letters and numbers
Answer» D. values of a dictionary can be a mixture of letters and numbers
154.

,9))

A. 9
B. 3
C. too many arguments for pop() method
D. 4
Answer» B. 3
155.

If a is a dictionary with some key-value pairs, what does a.popitem() do?

A. removes an arbitrary element
B. removes all the key-value pairs
C. removes the key-value pair for the key given as an argument
D. invalid method for dictionary
Answer» B. removes all the key-value pairs
156.

) print(a)

A. {1: 5}
B. {1: 5, 2: 3}
C. error, syntax error for pop() method
D. {1: 5, 3: 4}
Answer» C. error, syntax error for pop() method
157.

Which of the following isn’t true about dictionary keys?

A. more than one key isn’t allowed
B. keys must be immutable
C. keys must be integers
D. when duplicate keys encountered, the last assignment wins
Answer» D. when duplicate keys encountered, the last assignment wins
158.

,"D") print(a)

A. {1: ‘a’, 2: ‘b’, 3: ‘c’, 4: ‘d’}
B. none
C. error
D. [1,3,6,10]
Answer» B. none
159.

,4))

A. 1
B. a
C. 4
D. invalid syntax for get method
Answer» C. 4
160.

Which of the following is not a declaration of the dictionary?

A. {1: ‘a’, 2: ‘b’}
B. dict([[1,”a”],[2,”b”]])
C. {1,”a”,2”b”}
D. { }
Answer» D. { }
161.

Which of these about a dictionary is false?

A. the values of a dictionary can be accessed using keys
B. the keys of a dictionary can be accessed using values
C. dictionaries aren’t ordered
D. dictionaries are mutable
Answer» C. dictionaries aren’t ordered
162.

print(list(d.keys()))

A. [“john”, “peter”]
B. [“john”:40, “peter”:45]
C. (“john”, “peter”)
D. (“john”:40, “peter”:45)
Answer» B. [“john”:40, “peter”:45]
163.

Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?

A. d.size()
B. len(d)
C. size(d)
D. d.len()
Answer» C. size(d)
164.

Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use?

A. d.delete(“john”:40)
B. d.delete(“john”)
C. del d[“john”]
D. del d(“john”:40)
Answer» D. del d(“john”:40)
165.

d1 == d2

A. true
B. false
C. none
D. error
Answer» C. none
166.

"john" in d

A. true
B. false
C. none
D. error
Answer» B. false
167.

d1 > d2

A. true
B. false
C. error
D. none
Answer» D. none
168.

d = {"john":40, "peter":45}

A. “john”, 40, 45, and “peter”
B. “john” and “peter”
C. 40 and 45
D. d = (40:”john”, 45:”peter”)
Answer» C. 40 and 45
169.

Tuples can’t be made keys of a dictionary.

A. true
B. false
Answer» C.
170.

Which of the following statements create a dictionary?

A. d = {}
B. d = {“john”:40, “peter”:45}
C. d = {40:”john”, 45:”peter”}
D. all of the mentioned
Answer» E.
171.

What type of data is: a=[(1,1),(2,4),(3,9)]?

A. array of tuples
B. list of tuples
C. tuples of lists
D. invalid type
Answer» C. tuples of lists
172.

,2,3

A. yes, this is an example of tuple unpacking. a=1 and b=2
B. yes, this is an example of tuple unpacking. a=(1,2) and b=3
C. no, too many values to unpack
D. yes, this is an example of tuple unpacking. a=1 and b=(2,3)
Answer» D. yes, this is an example of tuple unpacking. a=1 and b=(2,3)
173.

What is the data type of (1)?

A. tuple
B. integer
C. list
D. both tuple and integer
Answer» C. list
174.

>>>print len(my_tuple)

A. 1
B. 2
C. 5
D. error
Answer» E.
175.

>>>t1 < t2

A. true
B. false
C. error
D. none
Answer» C. error
176.

d["john"]

A. 40
B. 45
C. “john”
D. “peter”
Answer» B. 45
177.

>>>[t[i] for i in range(0, len(t), 2)]

A. [2, 3, 9]
B. [1, 2, 4, 3, 8, 9]
C. [1, 4, 8]
D. (1, 4, 8)
Answer» D. (1, 4, 8)
178.

>>>t[1:-1]

A. (1, 2)
B. (1, 2, 4)
C. (2, 4)
D. (2, 4, 3)
Answer» D. (2, 4, 3)
179.

>>>t[1:3]

A. (1, 2)
B. (1, 2, 4)
C. (2, 4)
D. (2, 4, 3)
Answer» D. (2, 4, 3)
180.

, 9], [5, 5, 5])]

A. [1, 2, 3]
B. (1, 2, 3)
C. {1, 2, 3}
D. {}
Answer» C. {1, 2, 3}
181.

, row2)] for (row1, row2) in zip(A, B)]

A. [0, 30, 60, 120, 160, 200, 300, 350, 400]
B. [[3, 6, 9], [16, 20, 24], [35, 40, 45]]
C. no output
D. error
Answer» C. no output
182.

-i] for i in range(len(A))]

A. [1, 5, 9]
B. [4, 5, 6]
C. [3, 5, 7]
D. [2, 5, 8]
Answer» D. [2, 5, 8]
183.

) for col in range(3)]

A. [3, 6, 9, 16, 20, 24, 35, 40, 45]
B. error
C. [0, 30, 60, 120, 160, 200, 300, 350, 400]
Answer» B. error
184.

for col in row] for row in A]

A. [[11, 12, 13], [14, 15, 16], [17, 18, 19]]
B. error
C. [11, 12, 13], [14, 15, 16], [17, 18, 19]
D. [11, 12, 13, 14, 15, 16, 17, 18, 19]
Answer» B. error
185.

] for row in (0, 1, 2)]

A. [7, 8, 9]
B. [4, 5, 6]
C. [2, 5, 8]
D. [1, 4, 7]
Answer» D. [1, 4, 7]
186.

, i)]

A. a list of prime numbers up to 50
B. a list of numbers divisible by 2, up to 50
C. a list of non prime numbers, up to 50
D. error
Answer» D. error
187.

, x is even} (including zero)

A. [x for x in range(1, 20) if (x%2==0)]
B. [x for x in range(0, 20) if (x//2==0)]
C. [x for x in range(1, 20) if (x//2==0)]
D. [x for x in range(0, 20) if (x%2==0)]
Answer» E.
188.

Write a list comprehension to produce the list: [1, 2, 4, 8, 16……212].

A. [(2**x) for x in range(0, 13)]
B. [(x**2) for x in range(1, 13)]
C. [(2**x) for x in range(1, 13)]
D. [(x**2) for x in range(0, 13)]
Answer» B. [(x**2) for x in range(1, 13)]
189.

Write a list comprehension for producing a list of numbers between 1 and 1000 that are divisible by 3.

A. [x in range(1, 1000) if x%3==0]
B. [x for x in range(1000) if x%3==0]
C. [x%3 for x in range(1, 1000)]
D. [x%3=0 for x in range(1, 1000)]
Answer» C. [x%3 for x in range(1, 1000)]
190.

)*5/9) for x in t]

A. [0]
B. 0
C. [0.00]
D. error
Answer» E.
191.

Write a list comprehension for number and its cube for l=[1, 2, 3, 4, 5, 6, 7, 8, 9].

A. [x**3 for x in l]
B. [x^3 for x in l]
C. [x**3 in l]
D. [x^3 in l]
Answer» B. [x^3 for x in l]
192.

=[x+y for x, y in zip(l1, l2)] l3

A. error
B. 0
C. [-20, -60, -80]
D. [0, 0, 0]
Answer» E.
193.

for x in l]

A. [1, 1, 1, 1, 1]
B. [1, 0, 1, 0, 1]
C. [1, 0, 0, 0, 0]
D. [0, 1, 0, 1, 0]
Answer» C. [1, 0, 0, 0, 0]
194.

Write the list comprehension to pick out only negative integers from a given list ‘l’.

A. [x<0 in l]
B. [x for x<0 in l]
C. [x in l for x<0]
D. [x for x in l if x<0]
Answer» E.
195.

Which of the following is the same as list(map(lambda x: x**-1, [1, 2, 3]))?

A. [x**-1 for x in [(1, 2, 3)]]
B. [1/x for x in [(1, 2, 3)]]
C. [1/x for x in (1, 2, 3)]
D. error
Answer» D. error
196.

for y in l2]

A. [4, 8, 12, 5, 10, 15, 6, 12, 18]
B. [4, 10, 18]
C. [4, 5, 6, 8, 10, 12, 12, 15, 18]
D. [18, 12, 6, 15, 10, 5, 12, 8, 4]
Answer» D. [18, 12, 6, 15, 10, 5, 12, 8, 4]
197.

==0: i; else: i+1; for i in range(4)])

A. [0, 2, 2, 4]
B. [1, 1, 3, 3]
C. error
D. none of the mentioned
Answer» D. none of the mentioned
198.

for i in range(3)]; print(x);

A. [0, 1, 2]
B. [1, 2, 5]
C. error, **+ is not a valid operator
D. error, ‘;’ is not allowed
Answer» B. [1, 2, 5]
199.

,b)) print(a)

A. [2,4]
B. [ ]
C. [3,5]
D. invalid arguments for filter function
Answer» D. invalid arguments for filter function
200.

print(points)

A. [[1, 2], [3, 1.5], [0.5, 0.5]]
B. [[3, 1.5], [1, 2], [0.5, 0.5]]
C. [[0.5, 0.5], [1, 2], [3, 1.5]]
D. [[0.5, 0.5], [3, 1.5], [1, 2]]
Answer» D. [[0.5, 0.5], [3, 1.5], [1, 2]]