Dictionary
String
Tuple
List
What is the return type of following function ?
def func1(): return 'mnp',22print(type(func1()))
or
equal
and
not
What is the output of the following?
x=123for i in x: print(i)
1 2 3
123
Error
none of these
f.read(5)
f.read()=5
f.readline(5)
f.readlines(5)
Interpreter
Compiler
Combination of Compiler and Interpreter
all of these
Class
What will be the output of the following Python code ?
def display(b,n): while n>0: print(b,end='') n=n-1display('z',3)
zzz
zz
Infinite loop
An exception is thrown
Write
Read
Append
Read and Write Both
What will be the output of the following pseudocode, where ^ represent XOR operation ?
Integer a, b, cset b = 4, a = 3c =a ^ bPrint c
4
3
5
7
What will be the output of the following Python code snippet?
x = 'abcd' for i in range(len(x)): print(x) x = 'a'
a
abcd abcd abcd abcd
a a a a
none of the mentioned
Brackets
Indentation
Key
None of the above
f = open("data.txt", "a")
f = Open("data.txt", "ab")
f= new("data.txt", "a")
open("data.txt", "a")
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
Interactive Mode
Script Mode
Combination of Interactive and Script modes
All of these
Lists
Tuples
Read two words from file
Read two line from file
Read two character / two bytes
count the number of '2' in file
0
1
raise
try
val
with
What will be the output of the following Python code?
def foo(): total += 1 return totaltotal = 0print(foo())
error
Yes
No
if / else not used in python
None of the above.
goto
except
File Found Error
File Not Exist Error
File Not Found Error
read binary
write binary
append binary
read write
f.seek(-10, 0)
f.seek(10,0)
f.seek(-10, 1)
print(not(3>4))print(not(1&1))
True True
True False
False True
False False
yes
no
machine dependent
def foo(x): x = ['def', 'abc'] return id(x)q = ['abc', 'def']print(id(q) == foo(q))
True
False
None
def foo(): return total + 1total = 0print(foo())
i = 1while True: if i%7 == 0: break print(i) i += 1
1 2 3 4 5 6
1 2 3 4 5 6 7
Number
Slice
i = 0while i < 3: print(i) i += 1else: print(0)
0 1 2 3 0
0 1 2 0
0 1 2
read()
readline()
readlines()
load()
write()
append()
add()
insert()
x = "abcdef"while i in x: print(i, end=" ")
a b c d e f
abcdef
i i i i i i …
colon
comma
semicolon
hyphen
What will the following code output?
x=0if x: print("True")else: print("False")
i = 1while False: if i%2 == 0: break print(i) i += 2
1 3 5 7 …
1 2 3 4 …
Nothing will be printed
32
33
31
30
Curly Braces
Round Brackets
Semicolon
64
35
29
Read mode
Write mode
Append mode
Binary mode
pi
anonymous
lambda
none of the above
High Level
Object Oriented
Low Level
Both A and B
8
\a
\t
\n
\b
_x=2
x=3
_xyz_=5
None of these
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 is the output of the following code ?
def disp(*arg): for i in arg: print(i)disp(name="Rajat", age="20")
TypeError
Rajat 20
Name age
ab
rw
r+
w+