Paper Name : M3R5
Name :
Login ID : PK6133
Language : Hindi/English
(A) Wick van Rossum
(B) Rasmus Lerdorf
(C) Guido van Rossum
(D) Niene Stom
import numpy as np y = np.array([[11, 12, 13, 14], [32, 33, 34, 35]]) print(y.ndim)
(A) 1
(B) 2
(C) 25
(D) 3
print((range(4)))
(A) 0,1,2,3
(B) [0,1,2,3]
(C) range(0,4)
(D) (0,1,2,3)
if 2 + 5== 8: print("TRUE") else: print("FALSE") print("TRUE")
(A) FALSE
(B) FALSE TRUE
(C) TRUE FALSE
(D) TRUE
def disp(*arg): for i in arg: print(i) disp("Rajat", "20")
(A) Name age
(B) None of these
(C) TypeError
(D) Rajat 20
(A) list=()
(B) list.null
(C) null.list
(D) list=[]
b = 4 a = 3 c=a^b print(c)
(A) 3
(B) 7
(C) 4
(D) 5
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)
(B) 4
(C) 4 is maximum
(D) None
x = 50 def func(): global x x = 2 func() print('x is now', x)
(A) Error
(B) x is now 50
(C) x is now 2
(D) x is now 100
def fun(a, b=6): a = a + b print(a) fun(5, 4)
(A) 11
(B) 9
(C) 5
(D) 4
def calc(x): r = 2 * x**2 return r print(calc(5))
(A) 50
(B) 100
(C) 20
(D) Error
for i in range(1, 6): print(i, end=" ") if i == 3: break
(A) 12
(B) 123
(C) 1234
(D) 12345
def maximum(x, y): if x > y: return x elif x == y: return 'The numbers are equal' else: return y print(maximum(2, 3))
(A) 2
(B) 3
(C) The numbers are equal
(D) None of the options
friends = {"Joey": 1, "Rachel": 2} friends.update({"Phoebe": 2}) print(friends)
(A) {"Joey":1,"Rachel":2,"Phoebe 2}
(B) {Joey":1,"Rachel":2}
(C) {"Joey":1,"Phoebe":2}
X = 'mohan' new_X = '' for i in range(len(X)): new_X += X[i].upper() print(new_X)
(A) mohan
(B) MOHAN
(C) Error
(D) None of these
from math import floor print(floor(3.7))
(C) 3.0
import numpy as np a = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) print(a[2, 2])
(A) 7
(B) 11
(C) 10
(D) 8
with open("demo.txt", "w+") as f: f.write("Welcome to Python") f.seek(5) a = f.read(5) print(a)
(A) Welco
(B) me to
(C) Welcome to Python
(D) e to
a = 0 b = 3 while a + b < 8: a += 1 print(a, end=")")
(A) 0 1 2 3 4
(B) 1 2 3 4 5 6
(C) 1 2 3 4 5
from math import pow print(pow(2, 3))
(A) Nothing is printed
(B) 8.0
(C) Error, method pow doesn't exist in math module
(D) Error, the statement should be: print(pow(2, 3))
def say(message, times = 1): print(message* times) say('Hello') say('World', 5)
(A) Hello WorldWorldWorldWorldWorld
(B) Hello World 5
(C) Hello World, World,World, World, World
(D) Hello HelloHelloHello HelloHello
print(5+8* ((3* 5)-9)/10)
(A) 9.0
(B) 9.8
(D) 10.0
import sys sys.stdout.write('Welcome\n') sys.stdout.write('All\n')
(A) Welcome All
(B) Welcome Off
(C) Compilation Error
(D) Runtime Error
print ((2, 4)+(1, 5))
(A) (2, 4), (4, 5)
(B) (3,9)
(C) (2, 4, 1, 5)
(D) Invalid Syntax
a = set('dcma') b = set('mlpc') print(a^b)
(A) {'d', 'c', 'm', 'a', 'm', 'I', 'p', 'c'}
(B) {'m', 'I', 'p', 'c'}
(C) {'d', 'c', 'm', 'a'}
print(int())
(A) Any random number
(B) 1
(C) 0
def addItem(listParam): listParam += [1] mylist = [1, 2, 3, 4] addItem(mylist) print(len(mylist))
(A) 5
(B) 8
(C) 2
(D) 1
ms = ('A', 'D', 'H', 'U', 'N', 'T', 'C') print(ms[1:4])
(A) ('D', 'H', 'U')
(B) ('A', 'D', 'H', 'U', 'N', 'I', 'C')
(C) ('D', 'H', 'U', 'N', 'I', 'C')'
import numpy as np a = np.array([[1,2,3]]) print(a.shape)
(A) (2.3)
(B) (3.1)
(C) (1,3)
def add(a, b): return a+5, b+5 result = add(3,2) print(result)
(A) 15
(C) (8,7)
a = 2 b = 8 print(a | b) print(a >> 1)
(A) 100
(B) 10 2
(C) 2 2
(D) 10 1
f=open("demo.txt","r") print(f.tell())
(C) -1
(D) 0
(C) 9
(D) (0,1,2,3
(A) TRUE
(B) TRUE FALSE
(C) TRUE TRUE
(D) FALSE TRUE
def func1 (): return 'mnp',22 print(type(func1()))
(A) List
(B) dictionary
(C) string
(D) tuple
def iq(a,b): if(a==0): return b else: return iq(a-1,a+b) print(iq(3,6))
(B) 10
(C) 11
(D) 9
X = 4 print(X<<2)
(A) 4
(B) 16
(C) 6
(D) 2
a = 9 b = 5 a = a % (a - 3) b = b % (b - 3) print(a + b)
print (7//2) print (-7//2)
(A) 3-3
(B) 4-4
(C) 3-4
(D) 3 3
x = 2 if x < 5: print(x) else: pass
(A) 234
(B) 1234
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)
a = {1: "A", 2: "B", 3: "C"} b = {4: "D", 5: "E"} a.update(b) print(a)
(A) {1: 'A', 2: 'B', 3: 'C'}
(B) {1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E'}
(C) error
(D) (4: 'D', 5: 'E'}
a=4 while a != 0: print(a + 2,end="") a = a - 1
(A) 6666
(B) 6543
(C) 6789
(D) 6 8 10 12
(A) Sub Function
(B) Recursion
(C) Reverse Polish Notation
(D) Traversal Algorithm
(A) random
(B) randrange
(C) randomrange
(D) rand
(A) user defined function
(B) library function
(C) built in functions
(D) All of the above.
(A) eval
(B) nonlocal
(C) assert
(D) finally
(A) from package import all
(B) from package import *
(C) from package include all
(D) from package include *
(A) Better programming
(B) Efficient Coding
(C) All
(D) easy testing and debugging
(A) student
(B) s12
(C) 123
(D) _123
(A) #
(B) @
(C) *
(D) /
(A) .pym
(B) .pymodule
(C) .module
(D) .py
(A) Rectangle
(B) Parallelogram
(C) Circle
(D) Diamond
(A) set
(B) tuple
(C) String
(A) Operating system
(B) Interpreter
(C) Modem
(D) Compiler
(A) a
(B) ar+
(C) r+
(D) w
(A) Compiler
(C) Executer
(D) Translator
(A) Design
(B) Planning
(C) Algorithm
(D) Execution
(A) heap
(B) stack
(C) Uninitialized data segment
(D) None of the above
(A) Selection
(B) Sequential
(C) Simple
(D) Loop
(A) oval
(B) rectangle
(C) arrow
(D) diamond
(A) write
(B) output
(C) send
(D) dump
(A) The syntax is: from modulename import identifier
(B) This form of import does not import anything
(C) The namespace of imported module becomes part of importing module
(D) The identifiers in module are accessed directly as: identifier
(A) 12.6
(B) '12.6'
(C) 12
(D) syntax error
(A) readall()
(B) read()
(C) readcharacters()
(D) readchar()
(B) A circle
(C) Parallelogram
(D) A diamond
(A) A stage of all projects
(B) Finding broken code
(C) Evaluating deliverable to find errors
(A) nfile.read(2)
(B) infile.read()
(C) infile.readlines()
(D) infile.readline()
(A) File Found Error
(B) File Not Exist Error
(C) File Not Found Error
(A) os.rename(existing_name, new_name)
(B) fp.name = 'new_name.txt'
(C) os.rename(fp, new_name)
(D) os.set_name(existing_name, new_name)
(A) ab
(B) rw
(C) a+
(D) r+
(A) def function function_name():
(B) declare function function_name():
(C) def function_name():
(D) declare function_name():
(A) Any
(B) One
(C) Two
(D) Three
(A) pseudo codes
(B) syntax
(C) flowcharts
(D) programs
(A) Micro
(B) Union
(C) Macro
(D) Stack
(A) Compiling
(B) Running
(C) Testing
(D) Debugging
(A) list
(C) set
(A) [3, 4, 5, 20, 5, 25, 1, 3]
(B) [1, 3, 3, 4, 5, 5, 20, 25]
(C) [3, 5, 20, 5, 25, 1, 3]
(D) [1, 3, 4, 5, 20, 5, 25]
(A) reference_point indicates the starting position of the file object
(B) reference_point indicates the current position of the file object
(C) reference_point indicates the ending position of the file object
(A) Input/ Output, Decision, Repeat
(B) Input, Output, Process
(C) Loop, Input / Output, Process
(D) Sequence, Selection, Repeat
(A) 16
(B) 32
(C) 64
(D) None of these above
(A) High-level language
(B) None of the above
(C) Assembly language
(D) Machine language
(A) arr[-2]
(B) arr[2]
(C) arr[-1]
(D) arr[1]
(A) dump()
(B) laod()
(C) Both of the above
(A) Performance
(B) Algorithmic Representation
(C) Evaluation
(D) Flowcharting
(A) rename
(B) softspace
(C) mode
(D) closed
(A) read ()
(B) readline()
(A) All of the mentioned
(B) Standard Input
(C) Standard Output
(D) Standard Errors
(A) Terminal
(B) Process
(C) Input/Output
(D) Decision
(A) a_=3
(B) _a=3
(C) a?=3
(D) All of these
(A) delete all the trailing characters
(B) delete all the leading characters
(C) delete all the leading and trailing characters
(D) delete upper case characters
(A) Numbering Python
(B) Number in Python
(C) Numerical Python
(D) Number for Python
(A) To make a Matrix with all diagonal element 0
(B) To make a Matrix with first row 0
(C) To make a Matrix with all element 0
(A) variable
(B) litoral
(C) identifier
(D) comment