33
45
35
30
Interpreter
Compiler
Combination of Compiler and Interpreter
all of these
write mode
read mode
append mode
Both (A) And (C)
int
bool
void
None
What will be the output of the following Python code?
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
error
none of the mentioned
What is the output of the following code?
print(True and False)
True
False
Error
5 characters
5 words
5 lines
None of the above
|
&
~
^
Read two words from file
Read two line from file
Read two character / two bytes
count the number of '2' in file
Interactive Mode
Script Mode
Both Interactive Mode or Script Mode
None of These
_py_
var
_var
try
readlines()
readline()
readlist()
readall()
factorial()
print()
seed()
sqrt()
What is the output of the following?
x=123for i in x: print(i)
1 2 3
123
none of these
Brackets
Indentation
Catch
Flexibility
Portability
Reliability
What will be the output of the following code?
f=open("demo.txt","r")print(f.tell())
1
2
-1
0
r
rb
w
r+
val
raise
with
Python Interpreter.
Python compiler
Python Volatile machine
Portable virtual machine
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
def s(n1): print(n1) n1=n1+2n2=4s(n2)print(n2)
6 4
4 6
4 4
6 6
\a
\t
\n
\b
write()
append()
add()
insert()
raw_input
input
eval
accept
What will be the output of following?
Y=[2,5J,6]Y.sort()
[2,6,5J]
[5J,2,6]
[6,5J,2]
Python is proprietary software.
Python is open-source software.
Python is hardware dependent.
Python cannot run on Linux.
Expression
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
End of File
End of Line
End of Statement
End of program
x = 50def func (x): x = 2func (x)print ('x is now', x)
x is now 50
x is now 2
x is now 100
x = "abcdef"i = "a"while i in x: print(i, end = " ")
no output
i i i i i i …
a a a a a a …
a b c d e f
read()
load()
ab
rw
w+
What will be the output?
def fun(a,b=5,c=10): print(a+b+c)fun(2,c=20)
27
17
22
What is the output?
f = open("test.txt", "w")f.write("Python")print(f.tell())f.close()
6
10
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.
float
str
set
What happens if the file does not exist?
f = open("abc.txt", "r")
New file is created
FileNotFoundError
Returns None
Opens empty file
Built in datatype
Derived datatype
Concrete datatype
Abstract datatype
file_exists()
exists_file()
os.path.exists()
check_file()
a
ar+
.
#
/
?
nonlocal
assert
finally
Positional
Keyword
Default
Variable
Read mode
Write mode
Append mode
Binary mode
email
ca$h
marks10
Python2Shar
os.rename(existing_name, new_name)
fq.name = ‘new_name.txt’
os.rename(fp, new_name)
os.set_name(existing_name, new_name)