What are the values of the following expressions:
2**(3**2)
(2**3)**2
2**3**2
What is the order of precedence in python?
i) Parentheses
ii) Exponential
iii) Division
iv) Multiplication
v) Addition
vi) Subtraction
Which of the following is invalid?
What is the value of this expression?
bin(0x8)
Which of the following is an invalid variable?
What is the output of the following expression if the value of x is 34?
print(“%f”%x)
The output of the expression is:
bin(29)
To concatenate two strings to a third what statements are applicable ?
Which of the following operators has its associativity from right to left?
The expression shown below results in an error. State whether this statement is true or false.
print("-%5d0",989)
What is the output of the following?
string = "my name is x"
for i in ' '.join(string.split()):
print (i, end=", ")
The output of executing string.ascii_letters can also be achieved by:
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?
print('*', "abcdef".center(7), '*')
Which of the following will run without errors ?
To return the length of string s what command do we execute ?
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?
x = "abcdef"
i = "a"
while i in x[1:]:
print(i, end = " ")
Bitwise _________ gives 1 if either of the bits is 1 and 0 when both of the bits are 1.
What is the output of the following?
for i in range(float('inf')):
print (i)
What is the output of the following?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
What function do you use to read a string?
What is the value of x if:
x>>2=2
Which of the following represents the bitwise XOR operator?
In python we do not specify types,it is directly interpreted by the compiler, so consider the following operation to be performed.
>>>x = 13 ? 2
objective is to make sure x has a integer value, select all that apply (python 3.xx)
Which of the following is not a keyword?
What is the output of the code shown?
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
What is the output of the following?
print("abcdef".center(0))
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)
What is the output of the following?
x = 'abcd'
for i in range(len(x)):
print(i)
What is the output of the following code?
hex(255), int('FF', 16), 0xFF
What is the output of the following?
string = "my name is x"
for i in string:
print (i, end=", ")
What is the output of the following expression if X=345?
print(“%06d”%X)
Which of the following cannot be a variable?
To check whether string s1 contains another string s2, use
What dataype is the object below ?
L = [1, 23, ‘hello’, 1].
What is the output of the following?
i = 1
while True:
if i%2 == 0:
break
print(i)
i += 2
What are the output of the code shown below?
def f(x):
def f1(*args, **kwargs):
print("*"* 5)
x(*args, **kwargs)
print("*"* 5)
return f1
def a(x):
def f1(*args, **kwargs):
print("%"* 5)
x(*args, **kwargs)
print("%"* 5)
return f1
@f
@a
def p(m):
print(m)
p("hello")
What is the output of the following?
for i in range(0):
print(i)