a_=3
_a=3
a?=3
All of These
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)
1
3
2
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)
7
8
6
9
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))
The number are equal
None of These
infile.read(2)
infile.read()
infile.readlines()
infile.readline()
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
5
Rectangle
Parallelogram
Circle
Diamond
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)
4 is maximum
None of these
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))
dump()
load()
Both A and B
None of the above
def say(message, times =1): print(message * times) say("Hello") say("Word",5)
Hello WordWordWordWordWord
Hello Word 5
Hello Word,Word,Word,Word,Word
Hello HelloHelloHelloHelloHello
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)
0
What is the output of the following code?
dict={"Joey":1, "Rachel":2} dict.update({"Phoebe":2}) print(dict)
{'Joey': 1, 'Rachel': 2, 'Phoebe': 2}
{“Joey”:1,”Rachel”:}
{“Joey”:1,”Phoebe”:2}
Error
Interpreter
Modem
Compiler
Operating system
delete all the trailing whitespace characters
delete all the leading whitespace characters
delete all the leading and trailing whitespace characters
delete upper case characters
What will be the output after the following statements?
for i in range(1,6): print(i, end='') if i == 3: break
1 2
1 2 3
1 2 3 4
1 2 3 4 5
a = set('dcma') b = set('mlpc') print(a^b)
{‘d’, ‘c’, ‘m’, ‘l’, ‘p’, ‘c’}
{‘m’, ‘l’, ‘p’, ‘c’}
{‘d’, ‘c’, ‘m’, ‘a’}
Variable
Literals
Identifiers
Comment
List
Dictionary
Set
None of the Above
student
s12
123
_123
File Found Error
File Not Exist Error
File Not Found Error
From package import all
From package import *
From package include all
From package include *
arr[-2]
arr[2]
arr[-1]
arr[1]
Compiling
Running
Testing
Debugging
What will be the output of the following ?
print((range(4)))
0,1,2,3
[0,1,2,3]
range(0, 4)
(0,1,2,3)
Machine language
Assembly language
High-level language
What is the output of this code?
def calc(x): r=2*x**2 return r print(calc(5))
50
100
20
def add(a, b): return a+5, b+5 result = add(3,2) print(result)
15
(8,7)
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
One
Two
Three
Any Number of Times
Oval
Arrow
Sub Function
Recursion
Reverse Polish Notation
Traversal Algorithm
What is the return type of following function ?
def func1(): return 'mnp',22 print(type(func1()))
String
Tuple
Selection
Sequential
Simple
Loop
A Circle
A Diamond
a
ar+
r+
w
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
6 6 6 6
6 5 4 3
6 7 8 9
6 8 10 12
What will be the output of the following Python code?
from math import pow print(math.pow(2,3))
Nothing is printed
Error, method pow doesn’t exist in math module
Error, the statement should be: print(pow(2,3))
A stage of all projects
Finding broken code
Evaluating deliverable to find errors
a = 0 b = 3 while a + b < 8: a += 1 print(a, end='')
0 1 2 3 4
1 2 3 4 5 6
Heap
Stack
Uninitialized data segment
What will be the output of the following expression ?
x =4 print(x<<2)
16
list=()
list.null
null.list
list=[]
ab
rw
a+
To make a Matrix with all diagonal element 0
To make a Matrix with first row 0
To make a Matrix with all elements 0
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))
10
11
12
readlines()
read()
Both of the above
What does the following code print ?
x = 'mohan' for i in range (len(x)): x[i].upper() print (x)
mohan
MOHAN
What will be the output after following statements?
x = 2 if x < 5: print(x) else: pass
2 3 4
.pym
.pymodule
module
.py
12.6
'12.6'
Syntax Error
What will be the output of the following code?
f=open("demo.txt","r") print(f.tell())
-1
random
randrange
randomrange
rand
import numpy as np a = np.array([[1,2,3]]) print(a.shape)
(2,3)
(3,1)
(1,3)
def fun(a, b=6): a=a+b print(a) fun(5, 4)
Input/Output, Decision, Repeat
Input, Output, Process
Loop, Input/Output, Process
Sequence, Selection, Repeat
set
tuple
string
os.rename(existing_name, new_name)
fq.name = ‘new_name.txt’
os.rename(fp, new_name)
os.set_name(existing_name, new_name)
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])
(‘D’, ‘H’, ‘U’)
(‘A’, ‘D’, ‘H’,’U’,’N’,’I’,’C’)
(‘D’,’H’,’U’,’N’,’I’,’C’)
write
output
send
dump
Standard Input
Standard Output
Standard Errors
All of the mentioned
Better programming
easy testing and debugging
Efficient Coding
All
User Defined Function
Library Functions
Builtin Functions
All of the above
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))
(2 , 4), (4 , 5)
(3 , 9)
(2, 4, 1, 5)
Invalid Syntax
pseudo codes
syntax
flowcharts
programs
Numbering Python
Number in Python
Numerical Python
Number for Python
from math import* print(floor(3.7))
3.0
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])
24
reference_point indicates the current position of the file object
reference_point indicates the starting position of the file object
reference_point indicates the ending position of the file object
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)
Welco
me to
Welcome to Python
e to
Performance
Algorithmic Representation
Evaluation
Flowcharting
a = {1:"A", 2: "B", 3: "C"} b = {4: "D", 5: "E"} a.update(b) print(a)
{1:’A’, 2: ‘B’,3: ‘C’}
{1: ‘A’, 2: ‘b’, 3: ‘c’, 4: ‘D’, 5: ‘E’}
{4: ‘D’, 5: ‘E’}
print (7//2) print (-7//2)
3 -3
4 -4
3 -4
3 3
break
pass
continue
Design
Palnning
Algorithm
Execution
The syntax is: from module name import identifier
This form of import does not import anything
The namespace of imported module becomes part of importing module
The identifiers in module are accessed directly as: identifier
readall()
readcharacter()
readchar()
softspace
mode
closed
rename
import numpy as np a = np.array( [2, 3, 4, 5] ) b = np.arange(4) print(a+b)
[2 3 4 5]
[3 4 5 6]
[1 2 3 4]
[2 4 6 8]
32
64
eval
nonlocal
assert
finally
.
#
/
?
What value does the following expression evaluate to ?
x = 5 while x < 10: print(x, end='')
Closed loop
one time loop
Infinite loop
Evergreen loop
def function function_name():
declare function function_name():
def function_name():
declare function_name():
23
'2+3'
'23'
What is the output of the following ?
print(int())
Any Random Number
if 2 + 5 == 8: print("TRUE") else: print("FALSE") print("TRUE")
TRUE
TRUE FALSE
TRUE TRUE
FALSE TRUE
[3, 4, 5, 20, 5, 25, 1, 3]
[1, 3, 3, 4, 5, 5, 20, 25]
[3, 5, 20, 5, 25, 1, 3]
[1, 3, 4, 5, 20, 5, 25]
print(5 + 8 * ((3*5)-9)/10)
9.0
9.8
10.0
import numpy as np print(np.maximum([2, 3, 4], [1, 5, 2]))
[1 5 2]
[1 5 4]
[2 3 4]
[2 5 4]
What will be the output of the following expression?
a = 2 b = 8 print(a|b ) print(a >> 1)
10 0
10 2
2 2
10 1
Terminal
Process
Input/Output
Decision
def disp(*arg): for i in arg: print(i) disp(name="Rajat", age="20")
TypeError
Rajat 20
Name age
x = 50 def func (x): x = 2 func (x) print ('x is now', x)
x is now 50
x is now 2
x is now 100
Executer
Translator
Micro
Union
Macro
import numpy as np a = np.array([1, 5, 4, 7, 8]) a = a + 1 print(a[1])