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