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.

1.

What will be the output of the followingPython code?1. >>>str1="helloworld"2. >>>str1[::-1]

A. dlrowolleh
B. hello
C. world
D. helloworld
Answer» B. hello
2.

f1(). .

A. error
B. 12
C. 15
D. 1512
Answer» D. 1512
3.

What will be the output of the followingPython code?1. class father:2. def __init__(self, param):3. self.o1 = param4.5. class child(father):6. def __init__(self, param):7. self.o2 = param8.9. >>>obj = child(22)10. >>>print "%d %d" % (obj.o1, obj.o2)

A. none none
B. none 22
C. 22 none
D. error is generated
Answer» E.
4.

In python we do not specify types, it isdirectly interpreted by the compiler, soconsider the following operation to beperformed.>>>x = 13 ? 2objective is to make sure x has a integervalue, select all that apply (python 3.xx)

A. x = 13 // 2
B. x = int(13 / 2)
C. x = 13 % 2
D. all of the mentioned
Answer» E.
5.

What will be the output of the followingPython code snippet?not(10<20) and not(10>30)

A. true
B. false
C. error
D. no output
Answer» C. error
6.

What is the average value of thefollowing Python code snippet?>>>grade1 = 80>>>grade2 = 90>>>average = (grade1 + grade2) / 2

A. 85.0
B. 85.1
C. 95.0
D. 95.1
Answer» B. 85.1
7.

What data type is the object below? L = [1, 23, 'hello', 1]

A. list
B. dictionary
C. array
D. tuple
Answer» B. dictionary
8.

What will be the value of x in thefollowing Python expression?x = int(43.55+2/2)

A. 43
B. 44
C. 22
D. 23
Answer» C. 22
9.

What will be the value of the followingPython expression?float(4+int(2.39)%2)

A. 5.0
B. 5
C. 4.0
D. 4
Answer» D. 4
10.

What will be the value of the followingPython expression?4+2**5//10

A. 3
B. 7
C. 77
D. 0
Answer» C. 77
11.

What will be the value of X in thefollowing Python expression?X = 2+9*((3*12)-8)/10

A. 30.0
B. 30.8
C. 28.4
D. 27.2
Answer» E.
12.

What is the value of the following Python expression? bin(0x8)

A. 0bx1000
B. 8
C. 1000
D. 0b1000
Answer» E.
13.

What will be the output of the following Python expression? int(1011)?

A. 1011
B. 11
C. 13
D. 1101
Answer» B. 11
14.

What will be the output of the followingPython expression?24//6%3, 24//4//2

A. (1,3)
B. (0,3)
C. (1,0)
D. (3,1)
Answer» B. (0,3)
15.

What will be the output of the followingPython code?for i in range(0):print(i)

A. 0
B. no output
C. error
D. none of the mentioned
Answer» C. error
16.

What will be the output of the followingPython code?for i in range(2.0):print(i)

A. 0.0 1.0
B. 0 1
C. error
D. none of the mentioned
Answer» D. none of the mentioned
17.

What is the value of the following expression? 2+4.00, 2**4.0

A. (6.0, 16.0)
B. (6.00, 16.00)
C. (6, 16)
D. (6.00, 16.0)
Answer» B. (6.00, 16.00)
18.

What is the value of the following expression? 8/4/2, 8/(4/2)

A. (1.0, 4.0)
B. (1.0, 1.0)
C. (4.0. 1.0)
D. (4.0, 4.0)
Answer» B. (1.0, 1.0)
19.

Hence the result of this expression is 27.2.

A. 4.7 1.5
B. 7.9 * 6.3
C. 1.7 % 2
D. 3.4 + 4.6
Answer» D. 3.4 + 4.6
20.

numbers = [1, 2, 3, 4]numbers.append([5,6,7,8])print(len(numbers))

A. 4
B. 5
C. 8
D. 12
Answer» C. 8
21.

What will be the output of the followingPython statement?>>>"abcd"[2:]

A. a
B. ab
C. cd
D. dc
Answer» D. dc
22.

What will be the output of the followingPython statement?>>>"a"+"bc"

A. a
B. bc
C. bca
D. abc
Answer» E.
23.

What are the values of the followingPython expressions?2**(3**2)(2**3)**22**3**2

A. 64, 512, 64
B. 64, 64, 64
C. 512, 512, 512
D. 512, 64, 512
Answer» E.
24.

3. What will be the output of the followingPython code?1. >>>example = "snow world"2. >>>print("%s" % example[4:7])

A. wo
B. world
C. sn
D. rl
Answer» B. world
25.

What will be the output of the followingPython code?print(0xA + 0xB + 0xC)

A. 0xa0xb0xc
B. error
C. 0x22
D. 33
Answer» E.
26.

What will be the output of the following Python code? >>>print('new' 'line')

A. error
B. output equivalent to print new nline
C. newline
D. new line
Answer» D. new line
27.

What will be the output of the followingPython code?1. class tester:2. def __init__(self, id):3. self.id = str(id)4. id="224"5.6. >>>temp = tester(12)7. >>>print(temp.id)

A. 224
B. error
C. 12
D. none
Answer» D. none
28.

What will be the output of the followingPython code?1. >>>example = "snow world"2. >>>example[3] = 's'3. >>>print example

A. snow
B. snow world
C. error
D. snos world
Answer» D. snos world
29.

What will be the output of the followingPython code snippet?a = [0, 1, 2, 3]for a[0] in a:print(a[0])

A. 0 1 2 3
B. 0 1 2 2
C. 3 3 3 3
D. error
Answer» B. 0 1 2 2
30.

What will be the output of the followingPython code?for i in range(int(2.0)):print(i)

A. 0.0 1.0
B. 0 1
C. error
D. none of the mentioned
Answer» C. error
31.

What will be the output of the followingPython code?>>> str1 = 'hello'>>> str2 = ','>>> str3 = 'world'>>> str1[-1:]

A. olleh
B. hello
C. h
D. o
Answer» E.
32.

What will be the output of the following Python code? >>>print (r" nhello")

A. a new line and hello
B. nhello
C. the letter r and then hello
D. error
Answer» C. the letter r and then hello
33.

Is the following Python code valid? >>> a,b=1,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)
34.

What will be the output of the following Python expression? 0x35 | 0x75

A. 115
B. 116
C. 117
D. 118
Answer» D. 118
35.

What will be the output of the followingPython expression?4^12

A. 2
B. 4
C. 8
D. 12
Answer» D. 12
36.

What will be the value of the following Python expression? 4 + 3 % 5

A. 4
B. 7
C. 2
D. 0
Answer» C. 2
37.

what will be the output of the followingPython code snippet?def example(a):a = a + '2'a = a*2return a>>>example("hello")

A. indentation error
B. cannot perform mathematical operation on strings
C. hello2
D. hello2hello2
Answer» B. cannot perform mathematical operation on strings
38.

) oct(‘7’)

A. error 07
B. 0o7 error c) 0o7 error d)
C. 07
D. 0o7
Answer» D. 0o7
39.

What is the order of namespaces in which Python looks for an identifier?

A. python first searches the global namespace, then the local namespace and finally the built- in namespace
B. python first searches the local namespace, then the global namespace and finally the built-in namespace
C. python first searches the built-in namespace, then the global namespace and finally the local namespace
D. python first searches the built-in namespace, then the local namespace and finally the global namespace
Answer» C. python first searches the built-in namespace, then the global namespace and finally the local namespace
40.

is a string literal denoted by triple quotes for providing the specifications of certain program elements.

A. interface
B. modularity
C. client
D. docstring
Answer» E.
41.

Program code making use of a given module is called a              of the module.

A. client
B. docstring
C. interface
D. modularity
Answer» B. docstring
42.

exceptions are raised as a result of an error in opening a particular file.

A. valueerror
B. typeerror
C. importerror
D. ioerror
Answer» E.
43.

Which operator is overloaded by     lg    ()?

A. <
B. >
C. !=
D. none of the mentioned
Answer» E.
44.

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)
45.

Tuples can’t be made keys of a dictionary.

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

Is the following Python code valid?>>> a,b=1,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)
47.

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)]
48.

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.
49.

numbers = [1, 2, 3, 4]numbers.append([5,6,7,8])print(len(numbers))

A. 4
B. 5
C. 8
D. 12
Answer» C. 8
50.

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)