What is the output of the following?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
Select all options that print
hello-how-are-you
What is the output of the following?
x = "abcdef"
i = "a"
while i in x[:-1]:
print(i, end = " ")
What is the output of the following?
for i in range(2.0):
print(i)
Which among the following list of operators has the highest precedence?
+, -, **, %, /, <<, >>, |
Carefully observe the code and give the answer.
def example(a):
a = a + '2'
a = a*2
return a
>>>example("hello")
What is the output of the code snippet shown below?
X=”hi”
print(“05d”%X)
Which of the following is the truncation division operator?
What is the output of the following?
print('*', "abcdef".center(7), '*')
The output of the snippet of code shown below?
bool(‘False’)
bool()
What is the output of the following code ?
>>>example = "snow world"
>>>print("%s" % example[4:7])
In order to store values in terms of key and value we use what core datatype.
What is the output of this expression, 3*1**3?
What is the output of the following?
x = 2
for i in range(x):
x -= 2
print (x)
What is the output of the following?
for i in range(float('inf')):
print (i)
What is the output when following statement is executed ?
>>> print(‘x\97\x98’)
Which of the following is not a complex number?
What is the output of the following?
for i in range(int(2.0)):
print(i)
What is the output of the code shown below?
'{a}{b}{a}'.format(a='hello', b='world')
What is the output of the code show below if a=10 and b =20?
a=10
b=20
a=a^b
b=a^b
a=a^b
print(a,b)
What is the output of the code shown?
'{a}, {0}, {abc}'.format(10, a=2.5, abc=[1, 2])
To concatenate two strings to a third what statements are applicable ?
The expression shown below results in an error. State whether this statement is true or false.
print("-%5d0",989)
What is the two’s complement of -44?
What is the output of the code shown below?
'%x %d' %(255, 255)
Which of the following is incorrect?
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()
Which of the following expressions is an example of type conversion?
Consider the snippet of code shown below and predict the output.
X=”san-foundry”
print(“%56s”,X)
To return the length of string s what command do we execute ?
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?
for i in [1, 2, 3, 4][::-1]:
print (i)
What does ~4 evaluate to?
What is the output of the code shown below?
class A:
@staticmethod
def a(x):
print(x)
A.a(100)
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 snippet of code shown below?
['hello', 'morning'][bool('')]
What is the output of the following code ?
>>>example="helloworld"
>>>example[::-1].startswith("d")
What is answer of this expression, 22 % 3 is?
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x in d.values():
print(d[x])
What is the output of the following?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d:
print(x, y)