Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Python code? print('*', "abcde".center(6), '*', sep='')
Q2
What will be the output of the following Python code snippet? print('The sum of {0} and {1} is {2}'.format(2, 10, 12))
Q3
What will be the output of the following Python code? print(0xA + 0xB + 0xC)
Q4
What will be the output of the following Python code? class Name: def __init__(self, firstName, mi, lastName): self.firstName = firstName self.mi = mi self.lastName = lastName firstName = "John" name = Name(firstName, 'F', "Smith") firstName = "Peter" name.lastName = "Pan" print(name.firstName, name.lastName)
Q5
What will be the output of the following Python code? print("xyyzxyzxzxyy".endswith("xyy"))
Q6
What will be the output of the following Python code snippet? print('ab'.zfill(5))
Q7
What will be the output of the following Python code snippet? print('{:,}'.format('1112223334'))
Q8
What will be the output of the following Python code? print("abcdef".center(7, 1))
Q9
What will be the output of the following Python code snippet? print('__foo__'.isidentifier())
Q10
What will be the output of the "hello" +1+2+3?
Q11
What will be the output of the following Python statement? >>>print('new' 'line')
Q12
Say s="hello" what will be the return value of type(s)?
Q13
What will be the output of the following Python code? >>>example = "snow world" >>>print("%s" % example[4:7])
Q14
What function do you use to read a string?
Q15
What will be the output of the following Python code snippet? print('Ab!2'.swapcase())
Q16
What will be the output of the following Python code? >>>example="helloworld" >>>example[::-1].startswith("d")
Q17
What will be the output of the following Python code? print('a B'.isalpha())
Q18
What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd', 2))
Q19
To return the length of string s what command do we execute?
Q20
What will be the output of the following Python code? print("xyyzxyzxzxyy".count('yy'))
Q21
What will be the output of the following Python code snippet? print('abcdef12'.replace('cd', '12'))
Q22
What will be displayed by print(ord('b') - ord('a'))?
Q23
What will be the output of the following Python code? >>>max("what are you")
Q24
What will be the output of the following Python code? print('abcdef'.partition('cd'))
Q25
What will be the output of the following Python code? print("Hello {1} and {0}".format('bin', 'foo'))