What is the output when following code is executed ?
>>>print("D", end = ' ')
>>>print("C", end = ' ')
>>>print("B", end = ' ')
>>>print("A", end = ' ')
Any odd number on being AND-ed with ________ always gives 1. Hint: Any even number on being AND-ed with this value always gives 0.
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i)
What is the result of the snippet of code shown below if x=1?
x<<2
What is the output when following statement is executed ?
>>>print(chr(ord('b')+1))
What is the output of the code shown below?
t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')
What is the value of the expression:
4+2**5//10
Mathematical operations can be performed on a string. State whether true or false.
Which of the following cannot be a variable?
What is the output of the code shown?
x=3.3456789
'%s' %x, str(x)
Which of the following statement prints hello\example\test.txt ?
What is the output of the following code ?
class Name:
def __init__(self, firstName, mi, lastName):
self.firstName = firstName
self.mi = mi
self.lastName = lastName
firstName = "John"
name = Name(firstName, 'F', "Smith")
firstName = "Peter"
name.lastName = "Pan"
print(name.firstName, name.lastName)
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
x[i].upper()
print (x)
What is the output of the following?
x = 'abcd'
for i in range(x):
print(i)
The output of the two codes shown below is the same. State whether this statement is true or false.
bin((2**16)-1)
'{}'.format(bin((2**16)-1))
What is answer of this expression, 22 % 3 is?
In order to store values in terms of key and value we use what core datatype.
Which is the correct operator for power(x^y)?
What is the output of the following code if the system date is 21st June, 2017 (Wednesday)?
[ ] or {}
{} or [ ]
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)
What is the output of the following?
True = False
while True:
print(True)
break
What is the output of the following?
print('*', "abcde".center(6), '*', sep='')
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 below?
not(3>4)
not(1&1)
To return the length of string s what command do we execute ?
What is the output of the code shown below?
if (9 < 0) and (0 < -9):
print("hello")
elif (9 > 0) or False:
print("good")
else:
print("bad")
What is the output of the following?
x = "abcdef"
i = "a"
while i in x:
print('i', end = " ")
What is the value of the following expression:
8/4/2, 8/(4/2)
What is “Hello”.replace(“l”, “e”)
Operators with the same precedence are evaluated in which manner?
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 when following code is executed ?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
What is the output of this expression if x=22.19?
print("%5.2f"%x)
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 the following?
string = "my name is x"
for i in string.split():
print (i, end=", ")
What is the value of the following expression:
24//6%3, 24//4//2
What is the output of the following?
for i in 'abcd'[::-1]:
print (i)
What is the output of the following?
x = 123
for i in x:
print(i)
What is the result of the expression if x=15 and y=12:
x & y
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()