You Scored:
Ranking:
Past Papers Python Quiz MCQs Questions Answers
1. What is the output when following statement is executed ?
>>>print 'new' 'line'
Newline (Answer)
Error
Output equivalent to print ‘new\nline’
New line
2. What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'
None of the mentioned (Answer)
a a a a
abcd abcd abcd abcd
a
3. What is the output when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
olleh
hello
O (Answer)
H
4. What is the output when following statement is executed ?
>>>print '\x97\x98'
\x97\x98
-~ (Answer)
97
Error
5. What error occurs when you execute?
apple = mango
SyntaxError
ValueError
NameError (Answer)
TypeError
6. What is the return type of function id ?
bool
int (Answer)
dict
float
7. Given a function that does not return any value, What value is thrown by itby default when executed in shell?
None (Answer)
void
int
bool
8. What is the output of the following?
x = 'abcd'
for i in x:
print(i)
x.upper()
error
A B C D
a B C D
a b c d (Answer)
9. Which of these in not a core datatype?
Lists
Class (Answer)
Dictionary
Tuples
10. What is the output when following statement is executed ?
>>>"abcd"[2:]
dc
cd (Answer)
a
ab