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
0
1
os.rename(existing_name, new_name)
fq.name = ‘new_name.txt’
os.rename(fp, new_name)
os.set_name(existing_name, new_name)
=
!=
<>
=!
\n
\t
\\
All of the above
Curly Braces
Round Brackets
Indentation
Semicolon
Required arguments
Keyword arguments
Default arguments
Variable-length arguments
not
or
and
xor
int
bool
void
None
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
Variable names in Python cannot start with number. However, it can contain number in any other position of variable name.
Variable names can start with an underscore.
Data type of variable names should not be declared.
None of the above.
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
x = "abcdef"i = "i"while i in x: print(i, end=" ")
i i i i i i …
abcdef
val
raise
try
with
softspace
mode
closed
rename
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
factorial()
print()
seed()
sqrt()
w
rb
rt
r
i = 2while True: if i%3 == 0: break print(i) i += 2
2 4 6 8 10 …
2 4
2 3
|
&
^
!
ab
rw
r+
w+
Number
String
List
Slice
2
none
What will be the output of the following Python code snippet?
print(not(3>4))print(not(1&1))
True True
True False
False True
False False
Local Variable
Static Variable
Global Variable
Instance Variable
Positional
Keyword
Default
Variable
Error
Expression
Portability
Reliability
a_=3
_a=3
a?=3
All of these
What will the following code output?
x=0if x: print("True")else: print("False")
True
False
Platform-independent
Low Level Language
Python is open-source and free to use
Object Oriented Programming
Interactive Mode
Script Mode
Combination of Interactive and Script modes
~
.py
.python
.p
None of these
raw_input
input
eval
accept
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
what is 'f' in the following statement?
f=open("Data.txt","r")
file name
file handle
Mode of file
file handling
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
x = 'abcd' for i in range(len(x)): print(x) x = 'a'
a
abcd abcd abcd abcd
a a a a
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
None of the above
5 characters
5 words
5 lines
skip
continue
break
pass
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
What will be the output?
f = open("test.txt", "w")f.write("Python")f.seek(0)print(f.read())
Python
Empty String
UnsupportedOperation 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
def fun(a,b=5,c=10): print(a+b+c)fun(2,c=20)
27
17
22
10
Class
Dictionary
Tuple
Brackets
Catch
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