Python MCQ Question
Python MCQ Question
a) Lists
b) Dictionary
c) Tuples
d) Class
2. Given a function that does not return any value, What value is thrown by default when executed in
shell.
a) int
b) bool
c) void
d) None
3. Following set of commands are executed in shell, what will be the output?
>>>str="hello"
>>>str[:2]
>>>
a) he
b) lo
c) olleh
d) hello
apple = mango
a) SyntaxError
b) NameError
c) ValueError
d) TypeError
a) list
b) dictionary
c) array
d) tuple
6. In order to store values in terms of key and value we use what core data type.
a) list
b) tuple
c) class
d) dictionary
c) ‘3\’
d) ”’That’s okay”’
>>>grade1 = 80
>>>grade2 = 90
a) 85
b) 85.1
c) 95
d) 95.1
hello-how-are-you
c) print(‘hello-‘ + ‘how-are-you’)
a) k = 2 + 3j
b) k = complex(2, 3)
c) k = 2 + 3l
d) k = 2 + 3J
a) x = 0b101
b) x = 0x4f5
c) x = 19023
d) x = 03964
12. What is the output when following statement is executed ?
>>>"a"+"bc"
a) a
b) bc
c) bca
d) abc
>>>"abcd"[2:]
a) a
b) ab
c) cd
d) dc
>>> str1[-1:]
a) olleh
b) hello
c) h
d) o
a) +
b) *
c) –
a) 0xA0xB0xC
b) Error
c) 0x22
d) 33