What is the value of the following Python code?
>>>print(36 / 4)
9
4
9.0
4.0
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
None of these
Yes
No
if / else not used in python
None of the above.
Curly Braces
Round Brackets
Indentation
Semicolon
Hello
949227
True
"2'
What is the output of the following program:
i = 0while i < 3: print (i) i=i+1 print (i+1)
0 2 1 3 2 4
0 1 2 3 4 5
Infinite loop
0 1 2 3
_py_
var
_var
try
readall()
read()
readcharacter()
readchar()
.py
.python
.p
execute python
go python
python
run python
What will be the output of the following Python code?
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
read binary
write binary
append binary
read write
Brackets
Key
None of the above
False
None
Error
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
n=5 while n>0: n-=1 if n==2: continue print(n,end=' ')
5 4 3 1 0
4 3 1 0
4 3 2
none of these
What is the output of the following code?
x = 50def func (x): x = 2func (x)print ('x is now', x)
x is now 50
x is now 2
x is now 100
Graphical
Cross-Platform
Platform Dependent
All of these
def fun(a, b=6): a=a+b print(a)fun(5, 4)
11
5
i = 2while True: if i%3 == 0: break print(i) i += 2
2 4 6 8 10 …
2 4
2 3
error
Docstring
Python Package Index
both a & b
none of the mentioned
Interface
Modularity
Client
What will be the output of the following pseudocode, where ^ represent XOR operation ?
Integer a, b, cset b = 4, a = 3c =a ^ bPrint c
3
7
x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x)
[‘AB’, ‘CD’]
[‘ab’, ‘cd’, ‘AB’, ‘CD’]
[‘ab’, ‘cd’]
Infinite Loop
Platform-independent
Low Level Language
Python is open-source and free to use
Object Oriented Programming
What will be the output of the following Python code snippet?
x = 'abcd'for i in range(len(x)): i.upper()print (x)
a b c d
count=0while count<3: print(count,end=" ") count+=1
0 1 2
1 2 3
open_file()
file_open()
open()
read_file()
def foo(): return total + 1total = 0print(foo())
0
1
>=
<=
=
!=
what is 'f' in the following statement?
f=open("Data.txt","r")
file name
file handle
Mode of file
file handling
One
Two
Three
Any Number of Times
f = open('data.txt'); f.read()
f = open('data.txt','r'); f.read(n)
myfile = open('data.txt'); f.readline()
f= open('data.txt'); f.readlines()
It is used for object serialization
It is used for object de-serialization
change the string value to number
extract the list element in simple variable
def s(n1): print(n1) n1=n1+2n2=4s(n2)print(n2)
6 4
4 6
4 4
6 6
10
csv.reader(file)
csv.read(file)
csv.readcsv(file)
csv.readcsvdata(file)
Comma Space Value
Comma Separated Value
Common spaced Value
Compact Structure View
readline()
readlines()
load()
i = 1while True: if i%2 == 0: break print(i) i += 2
1 2
1 2 3 4 5 6 …
1 3 5 7 9 11 … infinite time
Lists
Dictionary
Tuples
Class
x = 'abcd'for i in range(len(x)): print(i)
1 2 3 4
Interactive Mode
Script Mode
Both Interactive Mode or Script Mode
None of These
pi
anonymous
lambda
none of the above
file_exists()
exists_file()
os.path.exists()
check_file()
raise
goto
except
list
tuple
class
dictionary
String
Tuple
List
def foo(): total += 1 return totaltotal = 0print(foo())
val
with