What is the output when following statement is executed ?
>>>"a"+"bc"
What is the output of the code shown below?
not(3>4)
not(1&1)
What is answer of this expression, 22 % 3 is?
What is the output when following statement is executed ?(python 3.xx)
>>>print(format("Welcome", "10s"), end = '#')
>>>print(format(111, "4d"), end = '#')
>>>print(format(924.656, "3.2f"))
What does ~~~~~~5 evaluate to?
What is the output of the following?
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1
-
-
-
-
What is the result of the expression:
int(1011)?
Consider the snippet of code shown below and predict the output.
X=”san-foundry”
print(“%56s”,X)
Consider the expression given below. The value of X is:
X = 2+9*((3*12)-8)/10
What is the output of the code shown?
def ordi():
print("Ordinary")
ordi
ordi()
What are the output of the code shown below?
def f(x):
def f1(*args, **kwargs):
print("*"* 5)
x(*args, **kwargs)
print("*"* 5)
return f1
def a(x):
def f1(*args, **kwargs):
print("%"* 5)
x(*args, **kwargs)
print("%"* 5)
return f1
@f
@a
def p(m):
print(m)
p("hello")
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
print(x, y)
Why are local variable names beginning with an underscore discouraged?
Which of the following will run without errors ?
What is the output of the following?
d = {0, 1, 2}
for x in d:
print(d.add(x))
What is the output of the following code?
hex(255), int('FF', 16), 0xFF
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
In the code shown below, which function is the decorator?
def mk(x):
def mk1():
print("Decorated")
x()
return mk1
def mk2():
print("Ordinary")
p = mk(mk2)
p()
What is the output of the following?
i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 1
What will be displayed by print(ord(‘b’) – ord(‘a’)) ?
What is the output of the code shown?
l=list('HELLO')
'first={0[0]}, third={0[2]}'.format(l)
The output of the code shown below is:
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1.
Which among the following list of operators has the highest precedence?
+, -, **, %, /, <<, >>, |
The code shown above can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print("Sanfoundry")
return x(*args, **kwargs)
return f1
What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
What is the output of the following code ?
>>>example = "snow world"
>>>example[3] = 's'
>>>print example
What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
What are the values of the following expressions:
2**(3**2)
(2**3)**2
2**3**2
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'
Which of the following is true for variable names in Python?
Select all options that print
hello-how-are-you
Fill in the blanks:
The formatting method {1:<10} represents the ___________ positional argument, _________ justified in a 10 character wide field.
Operators with the same precedence are evaluated in which manner?
What is the output of the following?
string = "my name is x"
for i in string:
print (i, end=", ")
What is the output of the code shown below?
def mk(x):
def mk1():
print("Decorated")
x()
return mk1
def mk2():
print("Ordinary")
p = mk(mk2)
p()
What is the output of this expression if X= -122?
print("-%06d"%x)
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i)
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
To return the length of string s what command do we execute ?