Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Python code? >>>str1="helloworld" >>>str1[::-1]
Q2
What will be the output of the following Python code snippet? print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12))
Q3
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.o1, obj.o2)
Q4
What is "Hello".replace("l", "e")?
Q5
What will be the output of the following Python code? print("Hello {0!r} and {0!s}".format('foo', 'bin'))
Q6
What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd', -1))
-
A
-
B
-
C
-
D
Q7
What will be the output of the following Python code? print("ab\tcd\tef".expandtabs(4))
Q8
What will be the output of the following Python code snippet? print(''''''.isspace())
Q9
What will be the output of the following Python statement? >>>"a"+"bc"
Q10
What will be the output of the following Python code? class Count: def __init__(self, count = 0): self.__count = count c1 = Count(2) c2 = Count(2) print(id(c1) == id(c2), end = " ") s1 = "Good" s2 = "Good" print(id(s1) == id(s2))
Q11
What will be the output of the following Python code? >>>print (r"\nhello")
Q12
What will be the output of the following Python code? print('abcd'.partition('cd'))
Q13
What will be the output of the following Python code snippet? print('Hello World'.istitle())
Q14
What will be the output of the following Python code snippet? print('abcd'.translate({97: 98, 98: 99, 99: 100}))
Q15
What will be the output of the following Python code snippet? print('ab cd ef'.title())
Q16
What will be the output of the following Python statement? >>> print('x\97\x98')
Q17
What will be the output of the following Python code? print("xyyzxyzxzxyy".count('yy', 1))
Q18
What will be the output of the following Python code? print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))
Q19
Given a string example="hello" what is the output of example.count('l')?
Q20
What will be the output of the following Python code? print("abcdef".find("cd"))
Q21
What will be the output of the following Python code snippet? print('ab cd-ef'.title())
Q22
What will be the output of the following Python code? >>>example = "helle" >>>example.rfind("e")
Q23
What will be the output of the following Python code snippet? print('abcefd'.replace('cd', '12'))
Q24
Suppose s is “\t\tWorld\n”, what is s.strip()?
Q25
To retrieve the character at index 3 from string s="Hello" what command do we execute (multiple answers allowed)?