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 return type of function id ?
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
To check whether string s1 contains another string s2, use
What is the output of the code shown below?
def f(x):
def f1(a, b):
print("hello")
if b==0:
print("NO")
return
return f(a, b)
return f1
@f
def f(a, b):
return a%b
f(4,0)
What is the output of the following?
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i.upper())
What is the output of the following?
x = 2
for i in range(x):
x += 1
print (x)
What is the output of the code shown below?
def d(f):
def n(*args):
return '$' + str(f(*args))
return n
@d
def p(a, t):
return a + a*t
print(p(100,0))
What is the output of the following?
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
What is the output of the following?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
What is the output of the code shown below?
not(3>4)
not(1&1)
What is the output of the following?
x = 2
for i in range(x):
x -= 2
print (x)
Which of the following is not a keyword?
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(x)
Operators with the same precedence are evaluated in which manner?
It is not possible for the two’s complement value to be equal to the original value in any case. State whether this statement is true or false.
What is the output of the following?
print("abc. DEF".capitalize())
What is the value of x if:
x>>2=2
What function do you use to read a string?
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
A function with parameters cannot be decorated. State whether true or false.
What is the output of the following code ?
>>>example = "helle"
>>>example.find("e")
What is the output of the following?
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1
-
-
-
-
Suppose s is “\t\tWorld\n”, what is s.strip() ?
What is the output of the code shown?
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
The ______ symbol along with the name of the decorator function can be placed above the definition of the function to be decorated works as an alternate way for decorating a function.
What is the output of print 0.1 + 0.2 == 0.3?
Which of the following is invalid?
What is the output when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?
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 below if the system date is 18th August, 2016?
x=1234
res='integers:...%d...%-6d...%06d' %(x, x, x)
res
What is the output of the following?
print("abcdef".center(7, 1))
What is the output of the following?
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
What is the output of the following?
for i in range(2.0):
print(i)
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
What is the output of the following?
for i in range(int(2.0)):
print(i)
What is the output of the following?
x = "abcdef"
i = "a"
while i in x[:-1]:
print(i, end = " ")
What is the value of the expression:
float(4+int(2.39)%2)