What is the output of the following code?
def s(n1): print(n1) n1=n1+2n2=4s(n2)print(n2)
6 4
4 6
4 4
6 6
.
#
/
?
Quick response code
Same format in which the data is held in memory
ASCII format
Unicode format
Hello
949227
True
"2'
raise
try
val
with
Brackets
Indentation
Key
None of the above
.py
.python
.p
None of these
What will be the output of the following expression ?
x =4print(x<<2)
4
16
6
2
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
5
7
close_file()
file_close()
close()
end_file()
write
output
send
dump
What will be the output of the following Python code?
x = 'abcd'for i in range(len(x)): print(i)
a b c d
0 1 2 3
error
1 2 3 4
1
10
0
32
yes
no
machine dependent
none of the mentioned
File size
File name
Number of lines
Current file pointer position
x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x)
[‘AB’, ‘CD’]
[‘ab’, ‘cd’, ‘AB’, ‘CD’]
[‘ab’, ‘cd’]
Infinite Loop
a
ar+
r+
w
What is the output?
f = open("test.txt", "w")f.write("Python")print(f.tell())f.close()
in
is
assert
All
Docstring
Python Package Index
both a & b
f.reads()
f.read()
f.read(all)
f.read( *)
read()
readline()
readlines()
load()
>=
<=
=
!=
list
tuple
class
dictionary
r
+
b
Keywords
Identifires
Token
Statement
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()
File Found Error
File Not Exist Error
File Not Found Error
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
End of List
End of Line
End of Loop
End of Language
f
t
What is the output of the following code ?
def fun(a, b=6): a=a+b print(a)fun(5, 4)
11
9
write mode
read mode
append mode
Both (A) And (C)
At function definition
At runtime always
At function call
Never
skip
continue
break
pass
int
null
None
An exception is thrown without the return statement
Read mode
Write mode
Append mode
Binary mode
float
bool
dict
print(True and False)
False
Error
Reads one line
Reads all lines into a list
Reads entire file as a string
Reads one character
Error is raised
File is appended
File is read-only
File is overwritten
file_object=open(file_name,mode)
open(file_object,file_name,mode)
file_open(file_object,file_name,mode)
file_object=file_open(file_name,mode)
What is the output of below program ?
def say(message, times =1): print(message * times)say("Hello")say("Word",5)
Hello WordWordWordWordWord
Hello Word 5
Hello Word,Word,Word,Word,Word
Hello HelloHelloHelloHelloHello
_x=2
x=3
_xyz_=5
What will the following code output?
a=‘INFOMAX’ a=10 print(type(a))
<class 'int'>
<class ‘str'>
<class ‘bool'>
Built in datatype
Derived datatype
Concrete datatype
Abstract datatype
def foo(): return total + 1total = 0print(foo())
High Level
Object Oriented
Low Level
Both A and B
what is 'f' in the following statement?
f=open("Data.txt","r")
file name
file handle
Mode of file
file handling