os.rename(existing_name, new_name)
fq.name = ‘new_name.txt’
os.rename(fp, new_name)
os.set_name(existing_name, new_name)
File Found Error
File Not Exist Error
File Not Found Error
None of the above
Interactive Mode
Script Mode
Combination of Interactive and Script modes
All of these
a_=3
_a=3
a?=3
int
bool
void
None
2
1
0
none
end
beginning
anywhere in between the file
5
10
Interface
Modularity
Client
Docstring
open_file()
file_open()
open()
read_file()
Passing –O when running python
Assertions are disabled by default
Both A and B are wrong
Assertions cannot be disabled in python
True
False
equal
Comma Space Value
Comma Separated Value
Common spaced Value
Compact Structure View
email
ca$h
marks10
Python2Shar
It is used for object serialization
It is used for object deserialization
All of the mentioned
None of the mentioned
try
Brackets
Indentation
Catch
What is the output of the following code?
print(True and False)
Error
Write
Read
Append
Read and Write Both
Required arguments
Keyword arguments
Default arguments
Variable-length arguments
yes
no
machine dependent
none of the mentioned
100
-100
-101
101
End of File
End of Line
End of Statement
End of program
student
s12
123
_123
a=set('abc')b=set('cdef')print(a&b)
{'c'}
{'a','b','c','d','e','r'}
{c}
None of these
write
output
send
dump
End of List
End of Loop
End of Language
128
256
No Limit
Comments
Expressions
Tokens
Flow of control
raise
val
with
Graphical
Cross-Platform
Platform Dependent
Dictionary
String
Tuple
List
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
softspace
mode
closed
rename
r
w
+
b
Read two words from file
Read two line from file
Read two character / two bytes
count the number of '2' in file
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
7
What will be the output of following?
Y=[2,5J,6]Y.sort()
[2,6,5J]
[5J,2,6]
[6,5J,2]
goto
except
ab
rw
r+
w+
What will be the output of the following Python code?
x = "abcdef"while i in x: print(i, end=" ")
a b c d e f
abcdef
i i i i i i …
error
x = "abcdef"i = "a"while i in x: print(i, end = " ")
no output
a a a a a a …
It is used for object de-serialization
change the string value to number
extract the list element in simple variable
x = 'abcd'for i in range(len(x)): print(i)
a b c d
0 1 2 3
1 2 3 4
32
64
35
29
Lists
Tuples
Class
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
What is the output of the following code ?
def fun(a, b=6): a=a+b print(a)fun(5, 4)
11
9
What is the output of the following?
x=123for i in x: print(i)
1 2 3
none of these
def foo(): total += 1 return totaltotal = 0print(foo())