Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Python code? D=dict(p='Exam', q='Veda') '{p}{q}'.format(**D)
Q2
What will be the output of the following Python code snippet? '%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}
Q3
What is the purpose of a decorator in Python?
Q4
The two snippets of the following Python codes are equivalent. CODE 1 @f def f1(): print(“Hello”) CODE 2 def f1(): print(“Hello”) f1 = f(f1)
Q5
What will be the output of the following Python code snippet? X=”Exam-Veda” print(“%56s”,X)
Q6
What will be the output of the following Python code snippet? x=3.3456789 '%-6.2f | %05.2f | %+06.1f' %(x, x, x)
Q7
What will be the output of the following Python code? '%.2f%s' % (1.2345, 99)
Q8
What does the * symbol do when used in a function's parameter list?
Q9
What will be the output of the following Python code? def ordi(): print("Ordinary") ordi ordi()
Q10
What will be the output of the following Python code? hex(255), int('FF', 16), 0xFF
Q11
In Python, what is the role of the @functools.lru_cache decorator?
Q12
What is the role of the @abstractmethod decorator in Python?
Q13
In Python, what is the purpose of the @property decorator?
Q14
What will be the output of the following Python code? '{a}{b}{a}'.format(a='hello', b='world')
Q15
Which of the following formatting options can be used in order to add 'n' blank spaces after a given string 'S'?
Q16
What will be the output of the following Python code snippet? x=3.3456789 '%f | %e | %g' %(x, x, x)
Q17
In Python, what is the primary use of the super() function in a subclass constructor?
Q18
What does the ** symbol do when used in a function's parameter list?
Q19
In Python, which of the following is used to format a string left-justified within a field?
Q20
What is the primary use of the @final decorator in Python?
Q21
What will be the output of the following Python code? l=list('HELLO') 'first={0[0]}, third={0[2]}'.format(l)
Q22
What will be the output of the following Python function? def f(p, q): return p%q f(0, 2) f(2, 0)
Q23
What will be the output of the following Python code? s='%s, %s & %s' s%('mumbai', 'kolkata', 'delhi')
Q24
What will be the output of the following Python code? t = '%(a)s, %(b)s, %(c)s' t % dict(a='hello', b='world', c='universe')
Q25
What will be the output of the python code shown below for various styles of format specifiers? x=1234 res='integers:...%d...%-6d...%06d' %(x, x, x) res