readall()
read()
readcharacter()
readchar()
Comments
Expressions
Tokens
Flow of control
What will be the output of the following Python code?
x = "abcdef"i = "i"while i in x: print(i, end=" ")
no output
i i i i i i …
a b c d e f
abcdef
x = 'abcd'for i in range(len(x)): print(i.upper())
a b c d
0 1 2 3
error
1 2 3 4
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
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 the following code output?
x=0if x: print("True")else: print("False")
True
False
None
Error
0
Null
Arbitary value
32
7
10
3
procedure
function
bug
None of these
val
raise
try
with
5 characters
5 words
5 lines
None of the above
33
45
35
30
C
C++
JAVA
PHP
Write
Read
Append
Read and Write Both
What will be the output of the following expression ?
x =4print(x<<2)
4
16
6
2
The variables used inside function are called local variables.
The local variables of a particular function can be used inside other functions, but these cannot be used in global space.
The variables used outside function are called global variables.
In order to change the value of global variable inside function, keyword global is used.
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
list
tuple
class
dictionary
Required arguments
Keyword arguments
Default arguments
Variable-length arguments
eval
nonlocal
assert
finally
1
1.0
a_=3
_a=3
a?=3
All of these
x = "abcdef" i = "a" while i in x: print('i', end = " ")
i i i i i i … infinite Time
a a a a a a …
It is used for object serialization
It is used for object deserialization
All of the mentioned
None of the mentioned
5
round(45.8)
round(6352.898,2,5)
round()
round(7463.123,2,1)
int
bool
void
8
write mode
read mode
append mode
Both (A) And (B)
ab
rw
a+
r+
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
Use multiple write() statements.
Use writelines() method.
Use writeLine() method.
Use append() method.
Free and Open Source
Freeware
Open source
Shareware
readline()
readlines()
load()
x = "abcdef"while i in x: print(i, end=" ")
_py_
var
_var
Number
String
List
Slice
close_file()
file_close()
close()
end_file()
Keywords
Identifires
Token
Statement
What is the output of the following code?
count=0while count<3: print(count,end=" ") count+=1
0 1 2
1 2 3
Comma Space Value
Comma Separated Value
Common spaced Value
Compact Structure View
What will be the output after following statements?
x = 2if x < 5: print(x)else: pass
2 3 4
None of These
Graphical
Cross-Platform
Platform Dependent
File Found Error
File Not Exist Error
File Not Found Error
for i in range(5): if i == 5: break else: print(i)else: print("Here")
0 1 2 3 4 Here
0 1 2 3 4 5 Here
0 1 2 3 4
1 2 3 4 5
64
29
def s(n1): print(n1) n1=n1+2n2=4s(n2)print(n2)
6 4
4 6
4 4
6 6
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
float
dict