MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Python
Advanced Python Interview
Quiz 1
1
2
3
4
5
6
7
8
9
10
Q.1
What will be the output of the following Python code? class father: def __init__(self, param): self.o1 = param class child(father): def __init__(self, param): self.o2 = param >>>obj = child(22)>>>print "%d %d" % (obj.oobj.o2)
a) None None
b) None 22
c) 22 None
d) Error is generated
Q.2
What will be the output of the following Python code? class tester: def __init__(self, id): self.id = str(id) id=">>>temp = tester(12)>>>print(temp.id)
a) 224
b) Error
c) 12
d) None
Q.3
What will be the output of the following Python code? >>>example = "snow world">>>print("%s" % example[4:7])
a) wo
b) world
c) sn
d) rl
Q.4
What will be the output of the following Python code? >>>example = "snow world">>>example[= 's'>>>print example
a) snow
b) snow world
c) Error
d) snos world
Q.5
What will be the output of the following Python code? >>>max("what are you")
a) error
b) u
c) t
d) y
Q.6
Given a string example=”hello” what is the output of example.count(‘l’)?
a) 2
b) 1
c) None
d) 0
Q.7
What will be the output of the following Python code? >>>example = "helle">>>example.find("e")
a) Error
b) -1
c) 1
d) 0
Q.8
What will be the output of the following Python code? >>>example = "helle">>>example.rfind("e")
a) -1
b) 4
c) 3
d) 1
Q.9
What will be the output of the following Python code? >>>example="helloworld">>>example[::-1].startswith("d")
a) dlrowolleh
b) True
c) -1
d) None
Q.10
To concatenate two strings to a third what statements are applicable?
a) s3 = s1 . s2
b) s3 = s1.add(s2)
c) s3 = s1.__add__(s2)
d) s3 = s1 * s2
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page