What is the output when following statement is executed ?
>>>chr(ord('A'))
What is the output of the following code ?
class Count:
def __init__(self, count = 0):
self.__count = count
c1 = Count(2)
c2 = Count(2)
print(id(c1) == id(c2), end = " ")
s1 = "Good"
s2 = "Good"
print(id(s1) == id(s2))
The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same. State whether true or false.
Which of the following is an invalid variable?
What is the output of the following?
x = 123
for i in x:
print(i)
What is the output of the code shown?
x=3.3456789
'%f | %e | %g' %(x, x, x)
What is the output of the following?
i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 1
What is the maximum possible length of an identifier?
What is the output of the code shown below?
'%.2f%s' % (1.2345, 99)
What is the output of the following?
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
What is the value of the expression:
float(4+int(2.39)%2)
What is the output when following statement is executed ?
>>>print('new' 'line')
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'
The code shown above can work with ____ parameters.
def f(x):
def f1(*args, **kwargs):
print("Sanfoundry")
return x(*args, **kwargs)
return f1
To retrieve the character at index 3 from string s=”Hello” what command do we execute (multiple answers allowed) ?
To find the decimal value of 1111, that is 15, we can use the function:
What is the value of the following expression:
24//6%3, 24//4//2
What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
What is the output of the following?
for i in '':
print (i)
What is the result of cmp(3, 1)?
What is the output of the following?
x = "abcdef"
i = "i"
while i in x:
print(i, end=" ")
What is the output of the following code ?
class father:
def __init__(self, param):
self.o1 = param
class child(father):
def __init__(self, param):
self.o2 = param
>>>obj = child(22)
>>>print "%d %d" % (obj.o1, obj.o2)
To concatenate two strings to a third what statements are applicable ?
What is the output of the following?
i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 1
What is the average value of the code that is executed below ?
>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2
What is the output of the code shown below?
def f(x):
def f1(*args, **kwargs):
print("*", 5)
x(*args, **kwargs)
print("*", 5)
return f1
@f
def p(m):
p(m)
print("hello")
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i)
Which of the following Boolean expressions is not logically equivalent to the other three?
What is the output of the following?
i = 1
while False:
if i%2 == 0:
break
print(i)
i += 2
What is the output when following statement is executed ?
>>>"a"+"bc"
What does ~4 evaluate to?
Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1.
What does ~~~~~~5 evaluate to?
What will be displayed by print(ord(‘b’) – ord(‘a’)) ?
What is the output of the following?
x = (i for i in range(3))
for i in x:
print(i)
for i in x:
print(i)
Mathematical operations can be performed on a string. State whether true or false.
In order to store values in terms of key and value we use what core datatype.
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
i.upper()
print (x)
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?
d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
print(x, y)