Font size
WorksheetsPython Quiz-2 operators BF
Total questions: 119
Worksheet time: 3hrs 33mins
print(7//2)
2
3
4
print(9>2 and 6<=6)
TRUE
FALSE
print(8!=8)
TRUE
FALSE
print(2**3)
6
12
8
print((15%4))
4
5
3
print("3"+"3")
33
6
INVALID OUTPUT
print(not (0<1))
TRUE
FALSE
TYPE ERROR
print(2%2==0 or 3%2==0)
TRUE
FALSE
INVALID OUTPUT
print(5+8*2)
26
21
169
print(4+"2")
6
42
TYPE ERROR
What is the value of the expression 100 / 25?
4
4.0
"4.0"
'4.0'
x = 5
y = 3
print(x == y)
True
False
x = 5
y = 3
print(x != y)
True
False
x = 5
x%=3
print(x)
2
2.0
3
3.0
What does the following comparison operator “==” represent in Python programming?
Equal to
Assignment
Allocation
Not equal to.
What does the following comparison operator “!=” represent in Python programming?
Equal to
Assignment
Allocation
Not equal to.
What does the following comparison operator “>” represent in Python programming?
Equal to
Greater than
Less than
Not equal to.
What does the following comparison operator “<” represent in Python programming?
Equal to
Greater than
Less than
Not equal to.
What does the following comparison operator “>=” represent in Python programming?
Greater than
Greater than or equal to
Greater than and equal to
Less than or equal to
What does the following comparison operator “<=” represent in Python programming?
Greater than
Greater than and equal to
Less than
Less than or equal to
What is the name of the following logical operator?
Returns True if both statements are true
(a)
What is the name of the following logical operator?
Returns True if one of the statements is true
(a)
What is the name of the following logical operator?
Reverses the result, returns False if the result is True
(a)
What is the result of the following condition if x = 3?
not(x < 5 and x < 10)
True
False
What is the result of the following condition if:
A = 30
B = 21
C = 71
(A > B and A > C) or B < C
True
False
What is the result of the following condition if:
A = 30
B = 21
C = 71
not(B < A and B < C)
True
False
What is the result of the following condition if:
A = 30
B = 21
C = 71
B != A or C < A
True
False
Which of these is not a core data type?
Lists
Dictionary
Tuples
Class
What is the output of the following code :
print 9//2
4.5
4.0
4
Error
Who developed the Python language?
Zim Den
Guido van Rossum
Niene Stom
Wick van Rossum
Which one of the following is the correct extension of the Python file?
.python
.p
.py
None of these
Which of the following declarations is incorrect?
_x = 2
__x = 3
__xyz__ = 5
None of these
Which of the following declarations is incorrect in python language?
xyzp = 5,000,000
x y z p = 5000 6000 7000 8000
x,y,z,p = 5000, 6000, 7000, 8000
x_y_z_p = 5,000,000
What will be the output of this statement?
>>>"a"+"bc"
a+bc
a bc
abc
a
print("3+4")
Which of these operators means EQUAL TO?
'='
'=>'
'<='
'=='
amount = 2 + 5 * 2
What is the output of range(1,10)
0123456789
123456789
1 to 10
012345
Choose the correct declaration of a float variable with the value 3.14
pi = "3.14"
pi = int(3.14)
pi = 3.14
float pi = 3.14
What is the final result of the expression 4 + 5 * 3?
27
12
19
21
What is the final result of the expression 7 / 3 + 6?
0
8.33333333
8
.777777777778
What does the following code print?
x = 3.4
y = 1
print int(x)
print x + y
3.4
4.4
3
4.4
3
4
The code causes an error
What is the final result of the expression 2**3?
6
8
2
That is not a valid Python expression.
What is the operator below called?
%
Exponent
Modulus
Divide
Percent
print(9//3,9/3)
3 3.3
3.3 3
3.0 3.3
3.3 3.3
Valid operation?
'2'-'1'
'third'*'2'
'sum'**3
"2"+"1"
What is the output of this expression, 3*1**3?
3
21
9
33
print(1.1+2.2==3.3)
True
False
Error
3.3
Suppose the following statements are executed:
a = 100 b = 200
What is the value of the expression a and b?
200
100
0
False
What is the output of “hello”+1+2+3 ?
hello123
hello
Error
hello6
str1 = "My salary is 7000"; str2 = "7000" print(str1.isdigit()) print(str2.isdigit())
False True
False False
True False
True True
print(-18//-2)
print(18//2)
print(18/2)
print(18%2)
print(str(18/2))
find output
9.0
9
9.0
0
9.0
9
9
9.0
0
"9.0"
9
9
9.0
0
9.0
9
9
9.0
0
90
x = 10
y = 50
if x ** 2 > 100 and y < 100:
print(x, y)
find output
NONE
Error
10,50
100
4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators?a = 4
b = 11
print(a | b)
print(a >> 2)
15
0
0
15
15
1
1
15
y = 10
x = y += 2
print(x)
12
10
0
Error
print(int(12.53))
print(round(12.53))
print(round(12.36,1))
13
12
12.4
12
13
12.4
12
13
12.3
error
Single line comment Symbol?
//
/
$
#
Choose the correct function to get the character from ASCII number
ascii(number)
char(number)
chr(number)
ord(number)
str1 = 'Welcome'
print (str1[:6] + ' PYnative')
Welcome PYnative
WelcomPYnative
Welcom PYnative
WelcomePYnative
The function pow(x,y,z) is evaluated as:
(x**y)**z
(x**y) / z
(x**y) % z
(x**y)*z
Which one of these is floor division?
/
//
%
None of the mentioned
What is the answer to this expression, 22 % 3 is?
7
1
0
5
Mathematical operations can be performed on a string.
True
False
Operators with the same precedence are evaluated in which manner?
Left to Right
Right to Left
Can’t say
None of the mentioned
What is the output of this expression, 3*1**3?
27
9
3
1
Which one of the following has the same precedence level?
Addition and Subtraction
Multiplication, Division and Addition
Multiplication, Division, Addition and Subtraction
Addition and Multiplication
The expression int(x) implies that the variable x is converted to integer.
True
False
Which one of the following has the highest precedence in the expression?
Exponential
Addition
Multiplication
Parentheses
Which of these in not a core data type?
Lists
Dictionary
Tuples
Class
What is the return type of function id?
int
float
bool
dict
Find T ?
T=144 / 2 + 5 * 9 - ( 8 -3 )
106
688
112
684
Find the Output:
Item = {"ECE" , "CSE" , "EEE" , "CIVIL"}
Item.add (2,"MECH")
print(Item)
{ "ECE" , "MECH" , "CSE" , "EEE" , "CIVIL" }
{ "ECE" , "CSE" , "MECH" , "EEE" , "CIVIL" }
{ "ECE" , "CSE" , "EEE" , "CIVIL" }
{ "ECE" , "CSE" , "EEE" ,"MECH" , "CIVIL" }
Find the Output ?
A = "Anand Institute of higher technology"
print ( A[-5:7]
_Institute of higher techn
nstitute of higher technol
d Institute of higher techn
Institute of higher techno
def.number (r1 , r2)
sum = r1 / r2
return sum
a = number (r2 = 15 , r1 = 10)
2 / 3
3 / 2
error
2
what is the output of the following code ?
var1 = 1
var2 = 2
var3 = "3"
print (var + var2 var3)
Error. Mixing operators between numbers and strings are not supported
6
33
123
Which of the following function convert a string to a float in python ?
float(X)
int(x[,base])
long(X[,base])
str(X)
what is the output of the following programing ?
X = [ 'ab' , 'cd' ]
for i in X:
i.upper()
print (x)
[ 'AB' , 'CD' ]
[ 'ab' , 'cd' ]
[ AB , CD ]
ERROR
find p ?
p = ( 35 , 46 , 73 , 21 )
p.append( -2 , 24 )
print (p)
( 35 , 46 , 73 , 24 , 21 )
error
( 35 , 46 , 24 , 73 , 21 )
( 35 , 24 , 73 , 21 )
what will be the output of the following python code snippet ?
not (10 < 20) and not (10 > 30 )
TRUE
FALSE
Find the output ?
a = True
b = False
c = False
if a or b and c :
print "INFYTQ"
else:
print "infytq"
infytq
INFYTQ
ERROR
What will be the output of the following Python code?
list1 = [1, 3]
list2 = list1
list1[0] = 4
print(list2)
[1, 4]
[1, 3, 4]
[4, 3]
[1, 3]
What will be the output of the following Python code?
error
1 2 3 4
a b c d
0 1 2 3
What is the order of precedence in python?
i) Parentheses
ii) Exponential
iii) Multiplication
iv) Division
v) Addition
vi) Subtraction
i,ii,iii,iv,v,vi
ii,i,iii,iv,v,vi
ii,i,iv,iii,v,vi
i,ii,iii,iv,vi,v
What is the value of the following expression?
float(22//3+3/3)
8
8.0
8.3
8.33
What will be the output of the following Python expression if x=15 and y=12?
x & y
b1101
0b1101
12
1101
The one’s complement of 110010101 is:
001101010
110010101
001101011
110010100
What will be the output of the following Python code if a=10 and b =20?
10 20
10 10
20 10
20 20
Which is the correct operator for power(Xy)?
a) X^y
b) X**y
c) X^^y
d) None of the mentioned
Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned
Operators with the same precedence are evaluated in which manner?
a) Left to Right
b) Right to Left
c) Depends on associativity of operator
d) None of the mentioned
Pick out the correct output of the following python command:
print(0 and 100)
100
True
0
False
Which one of the following is not a valid operator in python?
==
=!
**
//
Which of the following is not a valid operator in python?
<
or
is
=>
What will be the updated value of x if x = 9:
x //= 3
6
9
3
None of the above
In python what is the default type of input data taken using input() function?
Integer
Object
Decimal
String
Is there any limit of statements that can appear under an if block?
Yes, up to 10
No
Yes, up to 5
Can’t say
What keyword would you use to add an alternative condition to an if statement?
elif
else if
elseif
None of the above
Which of the following is a valid python if statement?
if a >= 2 :
if (a => 2)
if a >= 2
if (a >= 2)
What will be the output of the following code?
x = 8
if x > 8:
print(16)
elif x == 8:
print(8)
else:
print(88)
8
16
88
None of the above
Can we write if/else into one line in python?
No
Can’t say
Yes
None of the above
1 << 2 + 3 << 4 ??
16
64
256
512
x=10
y=20
x += y += 10 ??
Error
40 30
30 40
40 40
1 << 2 + 3 << 4 ??
16
64
256
512
x=10
y=20
x += y += 10 ??
Error
40 30
30 40
40 40
a=10
b=5
a^=b
b^=b
a^=a
a,b ???
error
0 0
10 5
5, 10
Pairs which have equal precedence level??
// , /
<< , >>
< , <<
+= , **=
Pairs which do not have equal precedence level??
~ + -
& , |
^ , |
< , !=
a>=b and b**2+a==8 or a^b<<2>27
True
False
true
Error
0==False and 2<<3>>2>4
True
False
false
Error
What is right shortcut for Precedence table??
E U A S B C A I M L
E U A S A B C A I M L
M LA S B C A I E U
E U A B S C A I M L
Men of small knowledge are attached to ...
heavenly planets
resultant good birth
power,
devotional activity
As fools are attached to the flowers of ____________ trees without knowing the results of such attractions, ____________ men are similarly attracted by such heavenly opulence and the sense enjoyment thereof.
poisonous, unenlightened
nectar, enlightened
poisonous, enlightened
nectar , unenlightened
Those who are on this path are (a) in purpose, and their aim is one. O beloved child of the Kurus, the intelligence of those who are irresolute is many-branched.
Write your name ??
What are the operators that we had discussed today?
Logical
Membership
Unary
Identity
By satisfaction of the _______________________, the Supreme Personality of Godhead becomes satisfied.
Spiritual master
krsna
nation
mind
Which module is given as an asignment to read?
(a)
