What is the output of the code shown below?
t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')
Given a function that does not return any value, What value is thrown by default when executed in shell.
To concatenate two strings to a third what statements are applicable ?
What is the value of the expression:
4+2**5//10
Which of the following is not a keyword?
What is the output of this expression, 3*1**3?
What is the output of the following?
print("abcdef".center())
What is the order of precedence in python?
i) Parentheses
ii) Exponential
iii) Division
iv) Multiplication
v) Addition
vi) Subtraction
Which one of these is floor division?
What is the result of round(0.5) – round(-0.5)?
What is the value of the expression:
~100?
What is the output of the code shown below?
l=[1, 0, 2, 0, 'hello', '', []]
list(filter(bool, l))
What is the output when following code is executed ?
>>>print("D", end = ' ')
>>>print("C", end = ' ')
>>>print("B", end = ' ')
>>>print("A", end = ' ')
What is the output of the following?
i = 0
while i < 3:
print(i)
i += 1
else:
print(0)
Suppose i is 5 and j is 4, i + j is same as
What is the output of the following?
for i in [1, 2, 3, 4][::-1]:
print (i)
The two snippets of codes shown below are equivalent. State whether true or false.
CODE 1
@f
def f1():
print(“Hello”)
CODE 2
def f1():
print(“Hello”)
f1 = f(f1)
What is the output when following statement is executed ?
>>>print(chr(ord('b')+1))
What is the output of the code shown below?
class Truth:
pass
x=Truth()
bool(x)
The code shown above can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print("Sanfoundry")
return x(*args, **kwargs)
return f1
The output of the line of code shown below is:
not(10<20) and not(10>30)
Which of the following is an invalid variable?
What is the output of the snippet of code shown below?
['hello', 'morning'][bool('')]
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i)
Following set of commands are executed in shell, what will be the output?
1.>>>str="hello"
2.>>>str[:2]
3.>>>
What is the output of the following code ?
class tester:
def __init__(self, id):
self.id = str(id)
id="224"
>>>temp = tester(12)
>>>print(temp.id)
What is the output of the following?
print('*', "abcdef".center(7), '*', sep='')
Which of the following results in a SyntaxError ?
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
What is the value of x if:
x>>2=2
What is the output of the following code ?
>>>example = "helle"
>>>example.find("e")
Which of the following is invalid?
The value of the expression:
4 + 3 % 5
What is the output of the following code ?
>>>max("what are you")
What is the output of the following?
a = [0, 1, 2, 3]
i = -2
for i not in a:
print(i)
i += 1
What is the value of x if:
x = int(43.55+2/2)
In order to store values in terms of key and value we use what core datatype.
Say s=”hello” what will be the return value of type(s) ?
Mathematical operations can be performed on a string. State whether true or false.