MCQOPTIONS
Saved Bookmarks
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.
| 201. |
print(ttt(data[0])) |
| A. | 1 |
| B. | 2 |
| C. | 4 |
| D. | 5 |
| Answer» D. 5 | |
| 202. |
print(data[1][0][0]) |
| A. | 1 |
| B. | 2 |
| C. | 4 |
| D. | 5 |
| Answer» E. | |
| 203. |
print(matrix[i][1], end = " ") |
| A. | 1 2 3 4 |
| B. | 4 5 6 7 |
| C. | 1 3 8 12 |
| D. | 2 5 9 13 |
| Answer» E. | |
| 204. |
print(m(row), end = " ") |
| A. | 3 33 |
| B. | 1 1 |
| C. | 5 6 |
| D. | 5 33 |
| Answer» E. | |
| 205. |
m = [[x, y] for x in range(0, 4) fo r y in range(0, 4)] |
| A. | 8 |
| B. | 12 |
| C. | 16 |
| D. | 32 |
| Answer» D. 32 | |
| 206. |
>>>m = [[x, x + 1, x + 2] for x in range(0, 3)] |
| A. | [[1, 2, 3], [4, 5, 6], [7, 8, 9]] |
| B. | [[0, 1, 2], [1, 2, 3], [2, 3, 4]] |
| C. | [1, 2, 3, 4, 5, 6, 7, 8, 9] |
| D. | [0, 1, 2, 1, 2, 3, 2, 3, 4] |
| Answer» C. [1, 2, 3, 4, 5, 6, 7, 8, 9] | |
| 207. |
return result |
| A. | return a list containing every third item from l starting at index 0 |
| B. | return an empty list |
| C. | return a list containing every third index from l starting at index 0 |
| D. | return a list containing the items from l starting from index 0, omitting every third item |
| Answer» B. return an empty list | |
| 208. |
print(len(list1 + list2)) |
| A. | 2 |
| B. | 4 |
| C. | 5 |
| D. | 8 |
| Answer» E. | |
| 209. |
print(veggies) |
| A. | [‘carrot’, ‘celery’, ‘broccoli’, ‘potato’, ‘asparagus’] correct 1.00 |
| B. | [‘carrot’, ‘celery’, ‘potato’, ‘asparagus’] |
| C. | [‘carrot’, ‘broccoli’, ‘celery’, ‘potato’, ‘asparagus’] |
| D. | [‘celery’, ‘carrot’, ‘broccoli’, ‘potato’, ‘asparagus’] |
| Answer» B. [‘carrot’, ‘celery’, ‘potato’, ‘asparagus’] | |
| 210. |
print(len(mylist)) |
| A. | 1 |
| B. | 4 |
| C. | 5 |
| D. | 8 |
| Answer» D. 8 | |
| 211. |
To which of the following the “in†operator can be used to check if an item is in it? |
| A. | lists |
| B. | dictionary |
| C. | set |
| D. | all of the mentioned |
| Answer» E. | |
| 212. |
print(len(numbers)) |
| A. | 4 |
| B. | 5 |
| C. | 8 |
| D. | 12 |
| Answer» C. 8 | |
| 213. |
print(names2[2][0]) |
| A. | none |
| B. | a |
| C. | b |
| D. | c |
| Answer» E. | |
| 214. |
print(2) |
| A. | none |
| B. | 1 |
| C. | 2 |
| D. | error |
| Answer» D. error | |
| 215. |
print(v) |
| A. | [1] [2] [3] |
| B. | [1] [1, 2] [1, 2, 3] |
| C. | [1, 2, 3] |
| D. | 1 2 3 |
| Answer» D. 1 2 3 | |
| 216. |
>>>print(list2) |
| A. | [1, 3] |
| B. | [4, 3] |
| C. | [1, 4] |
| D. | [1, 3, 4] |
| Answer» C. [1, 4] | |
| 217. |
print(myList[i], end = " ") |
| A. | 2 3 4 5 6 1 |
| B. | 6 1 2 3 4 5 |
| C. | 2 3 4 5 6 6 |
| D. | 1 1 2 3 4 5 |
| Answer» D. 1 1 2 3 4 5 | |
| 218. |
>>>print(indexOfMax) |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 4 |
| Answer» B. 2 | |
| 219. |
>>>"Welcome to Python".split() |
| A. | [“welcomeâ€, “toâ€, “pythonâ€] |
| B. | (“welcomeâ€, “toâ€, “pythonâ€) |
| C. | {“welcomeâ€, “toâ€, “pythonâ€} |
| D. | “welcomeâ€, “toâ€, “python†|
| Answer» B. (“welcomeâ€, “toâ€, “pythonâ€) | |
| 220. |
, 5])? |
| A. | [3, 4, 5, 20, 5, 25, 1, 3, 34, 5] |
| B. | [1, 3, 3, 4, 5, 5, 20, 25, 34, 5] |
| C. | [25, 20, 5, 5, 4, 3, 3, 1, 34, 5] |
| D. | [1, 3, 4, 5, 20, 5, 25, 3, 34, 5] |
| Answer» B. [1, 3, 3, 4, 5, 5, 20, 25, 34, 5] | |
| 221. |
>>>list("a#b#c#d".split('#')) |
| A. | [‘a’, ‘b’, ‘c’, ‘d’] |
| B. | [‘a b c d’] |
| C. | [‘a#b#c#d’] |
| D. | [‘abcd’] |
| Answer» B. [‘a b c d’] | |
| 222. |
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()? |
| A. | [3, 4, 5, 20, 5, 25, 1, 3] |
| B. | [1, 3, 3, 4, 5, 5, 20, 25] |
| C. | [25, 20, 5, 5, 4, 3, 3, 1] |
| D. | [3, 1, 25, 5, 20, 5, 4, 3] |
| Answer» E. | |
| 223. |
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)? |
| A. | 0 |
| B. | 4 |
| C. | 1 |
| D. | 2 |
| Answer» E. | |
| 224. |
Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)? |
| A. | 0 |
| B. | 1 |
| C. | 4 |
| D. | 2 |
| Answer» E. | |
| 225. |
To remove string “hello†from list1, we use which command? |
| A. | list1.remove(“helloâ€) |
| B. | list1.remove(hello) |
| C. | list1.removeall(“helloâ€) |
| D. | list1.removeone(“helloâ€) |
| Answer» B. list1.remove(hello) | |
| 226. |
To add a new element to a list we use which command? |
| A. | list1.add(5) |
| B. | list1.append(5) |
| C. | list1.addlast(5) |
| D. | list1.addend(5) |
| Answer» C. list1.addlast(5) | |
| 227. |
To insert 5 to the third position in list1, we use which command? |
| A. | list1.insert(3, 5) |
| B. | list1.insert(2, 5) |
| C. | list1.add(3, 5) |
| D. | list1.append(3, 5) |
| Answer» C. list1.add(3, 5) | |
| 228. |
>>>list1 < list2 is |
| A. | true |
| B. | false |
| C. | error |
| D. | none |
| Answer» C. error | |
| 229. |
Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is: |
| A. | [0, 1, 2, 3] |
| B. | [0, 1, 2, 3, 4] |
| C. | [0.0, 0.5, 1.0, 1.5] |
| D. | [0.0, 0.5, 1.0, 1.5, 2.0] |
| Answer» D. [0.0, 0.5, 1.0, 1.5, 2.0] | |
| 230. |
>>>print(names[-1][-1]) |
| A. | a |
| B. | daman |
| C. | error |
| D. | n |
| Answer» E. | |
| 231. |
print sum |
| A. | 11 |
| B. | 12 |
| C. | 21 |
| D. | 22 |
| Answer» C. 21 | |
| 232. |
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]? |
| A. | [2, 33, 222, 14] |
| B. | error |
| C. | 25 |
| D. | [25, 14, 222, 33, 2] |
| Answer» B. error | |
| 233. |
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? |
| A. | print(list1[0]) |
| B. | print(list1[:2]) |
| C. | print(list1[:-2]) |
| D. | all of the mentioned |
| Answer» E. | |
| 234. |
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? |
| A. | error |
| B. | none |
| C. | 25 |
| D. | 2 |
| Answer» D. 2 | |
| 235. |
To shuffle the list(say list1) what function do we use? |
| A. | list1.shuffle() |
| B. | shuffle(list1) |
| C. | random.shuffle(list1) |
| D. | random.shufflelist(list1) |
| Answer» D. random.shufflelist(list1) | |
| 236. |
Suppose list1 is [1, 5, 9], what is sum(list1)? |
| A. | 1 |
| B. | 9 |
| C. | 15 |
| D. | error |
| Answer» D. error | |
| 237. |
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)? |
| A. | 3 |
| B. | 5 |
| C. | 25 |
| D. | 1 |
| Answer» E. | |
| 238. |
Suppose list1 is [2445,133,12454,123], what is max(list1)? |
| A. | 2445 |
| B. | 133 |
| C. | 12454 |
| D. | 123 |
| Answer» D. 123 | |
| 239. |
What is the output when we execute list(“helloâ€)? |
| A. | [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] |
| B. | [‘hello’] |
| C. | [‘llo’] |
| D. | [‘olleh’] |
| Answer» B. [‘hello’] | |
| 240. |
Which of the following commands will create a list? |
| A. | list1 = list() |
| B. | list1 = [] |
| C. | list1 = list([1, 2, 3]) |
| D. | all of the mentioned |
| Answer» E. | |
| 241. |
What happens if the base condition isn’t defined in recursive programs? |
| A. | program gets into an infinite loop |
| B. | program runs once |
| C. | program runs n number of times where n is the argument given to the function |
| D. | an exception is thrown |
| Answer» B. program runs once | |
| 242. |
Recursion and iteration are the same programming approach. |
| A. | true |
| B. | false |
| Answer» C. | |
| 243. |
What is tail recursion? |
| A. | a recursive function that has two base cases |
| B. | a function where the recursive functions leads to an infinite loop |
| C. | a recursive function where the function doesn’t return anything and just prints the values |
| D. | a function where the recursive call is the last thing executed by the function |
| Answer» E. | |
| 244. |
5 RECURSION |
| A. | 011 |
| B. | 110 |
| C. | 3 |
| D. | infinite loop |
| Answer» C. 3 | |
| 245. |
,i+j) print(test(4,7)) |
| A. | 13 |
| B. | 7 |
| C. | infinite loop |
| D. | 17 |
| Answer» E. | |
| 246. |
, tot-2) |
| A. | both a() and b() aren’t tail recursive |
| B. | both a() and b() are tail recursive |
| C. | b() is tail recursive but a() isn’t |
| D. | a() is tail recursive but b() isn’t |
| Answer» D. a() is tail recursive but b() isn’t | |
| 247. |
Which of these is false about recursion? |
| A. | recursive function can be replaced by a non-recursive function |
| B. | recursive functions usually take more memory space than non-recursive function |
| C. | recursive functions run faster than non- recursive function |
| D. | recursion makes programs easier to understand |
| Answer» D. recursion makes programs easier to understand | |
| 248. |
Only problems that are recursively defined can be solved using recursion. |
| A. | true |
| B. | false |
| Answer» C. | |
| 249. |
Which is the most appropriate definition for recursion? |
| A. | a function that calls itself |
| B. | a function execution instance that calls another execution instance of the same function |
| C. | a class method that calls another class method |
| D. | an in-built method that is automatically called |
| Answer» C. a class method that calls another class method | |
| 250. |
f() x |
| A. | error |
| B. | 4 |
| C. | junk value |
| D. | 1 |
| Answer» E. | |