What will following code segment print?
a=True b=False c=False if not a or b: print(1) elif not a or not b and c: print(2) elif not a or b or not b and a: print(3) else: print(4)
How many numbers will be printed by the following code?
def fun(a,b): for x in range(a,b+1): if x%3==0: print(x,end=" ") fun(100,120)
What is the output of below program ?
def maximum(x,y): if x>y: return x elif x==y: return "The number are equal" else: return y print(maximum(2,3))
What will be the output of the following pseudo code?
integer a,b set a=9,b=5 a=a mod(a-3) b=b mod(b-3) print a+b
What will be the output of the following python code?
def printMax(a,b): if a>b: print(a, "is maximum") elif a==b: print(a, "is equal to ",b) else: print(b, "is maximum") printMax(3,4)
What will be the output of the following python program?
def addItem(listParam): listParam+=[1] mylist=[1,2,3,4] addItem(mylist) print(len(mylist))
def say(message, times =1): print(message * times) say("Hello") say("Word",5)
What is the output of the following code ?
import numpy as np y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]]) print(y.ndim)
What is the output of the following code?
dict={"Joey":1, "Rachel":2} dict.update({"Phoebe":2}) print(dict)
What will be the output after the following statements?
for i in range(1,6): print(i, end='') if i == 3: break
a = set('dcma') b = set('mlpc') print(a^b)
What will be the output of the following ?
print((range(4)))
What is the output of this code?
def calc(x): r=2*x**2 return r print(calc(5))
def add(a, b): return a+5, b+5 result = add(3,2) print(result)
What will be the output of the following pseudocode, where ^ represent XOR operation ?
Integer a, b, c set b = 4, a = 3 c =a ^ b Print c
What is the return type of following function ?
def func1(): return 'mnp',22 print(type(func1()))
What will be the output of the following pseudo code ?
Integer a Set a =4 do print a + 2 a = a-1 while (a not equals 0) end while
What will be the output of the following Python code?
from math import pow print(math.pow(2,3))
a = 0 b = 3 while a + b < 8: a += 1 print(a, end='')
What will be the output of the following expression ?
x =4 print(x<<2)
What will be the output of the following?
def iq(a,b): if(a==0): return b else: return iq(a-1,a+b) print(iq(3,6))
What does the following code print ?
x = 'mohan' for i in range (len(x)): x[i].upper() print (x)
What will be the output after following statements?
x = 2 if x < 5: print(x) else: pass
What will be the output of the following code?
f=open("demo.txt","r") print(f.tell())
import numpy as np a = np.array([[1,2,3]]) print(a.shape)
def fun(a, b=6): a=a+b print(a) fun(5, 4)
What will be output for the following code ?
import numpy as np a = np.array([[1, 2, 3],[0,1,4],[11,22,33]]) print (a.size)
ms = ('A','D', 'H','U','N','I','C') print(ms[1:4])
import numpy as np a = np.array([[ 1,2,3,4], [5,6,7,8], [9,10,11,12]]) print(a[2,2])
What is the output of the following statement ?
print ((2, 4) + (1, 5))
from math import* print(floor(3.7))
import numpy as np a = np.array([1,2,3,5,8]) b = np.array([0,1,5,4,2]) c = a + b c = c*a print (c[2])
What will be the output of the following code ?
f=open("demo.txt","w+") f.write("Welcome to python") f.seek(5) a=f.read(5) print(a)
a = {1:"A", 2: "B", 3: "C"} b = {4: "D", 5: "E"} a.update(b) print(a)
print (7//2) print (-7//2)
import numpy as np a = np.array( [2, 3, 4, 5] ) b = np.arange(4) print(a+b)
What value does the following expression evaluate to ?
x = 5 while x < 10: print(x, end='')
What is the output of the following ?
print(int())
if 2 + 5 == 8: print("TRUE") else: print("FALSE") print("TRUE")
print(5 + 8 * ((3*5)-9)/10)
import numpy as np print(np.maximum([2, 3, 4], [1, 5, 2]))
What will be the output of the following expression?
a = 2 b = 8 print(a|b ) print(a >> 1)
def disp(*arg): for i in arg: print(i) disp(name="Rajat", age="20")
x = 50 def func (x): x = 2 func (x) print ('x is now', x)
import sys sys.stdout.write('welcome\n') sys.stdout.write('all\n')
import numpy as np a = np.array([1, 5, 4, 7, 8]) a = a + 1 print(a[1])