Interactive Mode
Script Mode
Combination of Interactive and Script modes
All of these
write mode
read mode
append mode
Both (A) And (C)
What will be the output after the following statements?
a = 0b = 3while a + b < 8: a += 1 print(a, end='')
0 1 2 3 4
1 2 3 4 5 6
1 2 3 4 5
None of these
read binary
write binary
append binary
read write
read()
readline()
readlines()
load()
raise
try
val
with
High Level
Object Oriented
Low Level
Both A and B
eval
nonlocal
assert
finally
r
w
+
b
What will be the output of the following Python code?
i = 1while False: if i%2 == 0: break print(i) i += 2
1
1 3 5 7 …
1 2 3 4 …
Nothing will be printed
f.seek(-10, 0)
f.seek(10,0)
f.seek(-10, 1)
None of the above
int
bool
void
None
Curly Braces
Round Brackets
Indentation
Semicolon
What is the output of the following code?
print(True and False)
True
False
Error
It is used for object serialization
It is used for object deserialization
All of the mentioned
None of the mentioned
x = "abcdef" i = "a" while i in x: print('i', end = " ")
no output
i i i i i i … infinite Time
a a a a a a …
a b c d e f
write
output
send
dump
What value does the following expression evaluate to ?
x = 5while x < 10: print(x, end='')
Closed loop
one time loop
Infinite loop
Evergreen loop
End of List
End of Line
End of Loop
End of Language
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 expression ?
x =4print(x<<2)
4
16
6
2
Write
Read
Append
Read and Write Both
What does the following code print ?
if 2 + 5 == 8: print("TRUE")else: print("FALSE")print("TRUE")
TRUE
TRUE FALSE
TRUE TRUE
FALSE TRUE
What will be the output of the following Python code snippet?
print(not(3>4))print(not(1&1))
True True
True False
False True
False False
What will be the output of following?
Y=[2,5J,6]Y.sort()
[2,6,5J]
[5J,2,6]
[6,5J,2]
What is the output of the following code ?
def fun(a, b=6): a=a+b print(a)fun(5, 4)
11
9
5
Interpreter
Compiler
Combination of Compiler and Interpreter
all of these
File Found Error
File Not Exist Error
File Not Found Error
Docstring
Python Package Index
both a & b
none of the mentioned
What will the following code output?
a=‘INFOMAX’ a=10 print(type(a))
<class 'int'>
<class ‘str'>
<class ‘bool'>
End of File
End of Statement
End of program
f.readlines()
f.readline()
f.read()
f.line()
def foo(x): x = ['def', 'abc'] return id(x)q = ['abc', 'def']print(id(q) == foo(q))
ab
rw
r+
w+
x = 'abcd'for i in range(len(x)): i.upper()print (x)
a b c d
0 1 2 3
error
Read mode
Write mode
Append mode
Binary mode
Class
List
Dictionary
Tuple
Expression
Portability
Reliability
x = 'abcd' for i in range(len(x)): x = 'a' print(x)
a
abcd abcd abcd
a a a a
It is used for object de-serialization
change the string value to number
extract the list element in simple variable
Brackets
Key
i = 2while True: if i%3 == 0: break print(i) i += 2
2 4 6 8 10 …
2 4
2 3
String
Both of the above
end
beginning
anywhere in between the file
\a
\t
\n
\b
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
Free and Open Source
Freeware
Open source
Shareware
x = 50def func (x): x = 2func (x)print ('x is now', x)
x is now 50
x is now 2
x is now 100