Operators, Expressions, and Python Statements important MCQs in English/Hindi | Nielit Notes | PDF

In this post, we cover all important Questions from the topic "Operators, Expressions, and Python Statements".

These MCQs will definitely help to pass IT and Computer students in any exam and interview that have Operators, Expressions, and Python Statements topic.

The Operators, Expressions, and Python Statements chapter covers the following topics:

1. Assignment statement, expressions, Arithmetic, Relational, Logical, Bitwise.

2. Operators and their precedence.

3. Conditional statements: if, if-else, if-elif-else.

4. Simple programs, Notion of iterative computation and control flow –range

function, While Statement, For loop, break statement, Continue Statement, Pass

statement, else, assert.

After completion of the Operators, Expressions, and Python Statements unit, Students will be able to: 

  • Use the basic operators and expressions available in Python in developing program.
  • Understand and use various Python statements like conditional constructs, looping constructs in writing Python program .


Operators, Expressions, and Python Statements MCQs

Here are the 55 most important and frequently asked MCQs from the  "Operators, Expressions, and Python Statements" topic.


1. An _______________ is a symbol which is used to perform specific mathematical or logical operation on values.

a.Operand

b.Operator

c.Keyword

d.Identifier

Ans.b.Operator



2. Which statement will check if a is equal to b?

a. if a = b: 

b. if a == b:

c. if a === c: 

d. if a == b

Ans.a. if a = b: 



3. Which operator returns remainder?

a./

b.//

c.%

d.\

Ans. c.%



4. Which statement is adding remainder of 8 divided by 3 to the product of 5 and 6?

a.8 % 3 + 5 * 6

b.8/3 + 5 * 6

c.8 // 3 + 6.5

d.None of the above

Ans.a.8 % 3 + 5 * 6



5. Checking multiple conditions in python requires……….. statement

a. if

b. if……. elif 

c. switch

d. None of these

Ans.b. if……. elif 

 


6. if the condition is …………. , the statements of if block will be executed otherwise the statements in the ……….. block will be executed

a. false, true

b. true, else 

c. both options are true

d.Can’t say 

Ans.b. true, else



7. What keyword would you use to add an alternative condition to an if statement?

a. else if

b. elseif

c. elif 

d. None of the above

Ans.c. elif 



8. To find the decimal value of 1111, that is 15, we can use the function:

a. int(1111,10)

b. int(‘1111’,10)

c. int(1111,2)

d. int(‘1111’,2)

Ans. d



9. Operators work on values called __________

a.Operating

b.Operand

c.Data value

d.Opvalue

Ans. b.Operand



10. What will be the output of the following Python expression if x=15 and y=12?

x & y

a. b1101

b. 0b1101

c. 12

d. 1101

Ans. c



11. Which of the following represents the bitwise XOR operator?

a. &

b. ^

c. |

d. !

Ans. b



12. The ……………… statement forms the selection construct in Python.

a. If else if

b..if 

c. For ; 

d.for

Ans.b..if 



13. Which of the following is an exponent operator?

a.*

b./

c.**

d.***

Ans. c.**



14. In Python, …………………. defines a block of statements.

a. Block

b.loop 

c.indentation 

d.{}

Ans.c.indentation 

 


15. An ……………… statement has less number of conditional checks than two successive ifs.

a. If else if

b. if elif 

c. if-else 

d. none

Ans.c. if-else 

 


16. State which of the following statement are true .

1.If,elif ,else are not compound statement.

2.Else if can be used in python.

3.Indentation while working with blocks is not necessary in python.

4.A pass statement is a null operation;it does nothing.

a.1

b.2 ,3

c.3

d.4 

Ans.d.4  



17. What will be the output of the following Python expression?

bin(29)

a. ‘0b10111’

b. ‘0b11101’

c. ‘0b11111’

d. ‘0b11011’

Ans. b



18. Out of addition(+) and Subtraction (-) operator, which has more precedence?

a. Addition (+)

b. Subtraction (-)

c. Both a and b have same precedence

d. None of the above

Ans.c. Both a and b have same precedence



19. What will be the value of x in the following Python expression, if the result of that expression is 2?

x>>2

a. 8

b. 4

c. 2

d. 1

Ans. a



20. What will be output after execution of the following code?

a=11

B=5 

If(a//b==2):

Print (“Yes”)

else :

Print(“No”)

a. 2.5

b.Yes 

c.No

d.21

Ans.b.Yes 



21. Write the output of the following code :

>>> a=9

>>> x=str(a)

>>> b=5

>>> y=str(b)

>>> x+y

a.14

b.9,5

c.95

d.None of the above

Ans.c.95



22. What will be output after execution of the following code?

a=11

b=5

if (a%b==0):

print ( “Greater”)

if (a//b==0):

print ( “Example”)

else

print (“Sooo Sorry”)

a. Sooo Sorry

b.Great 

c.Example 

d.Great Example 

Ans.b.Great 



23. Which of the following is a valid for loop in Python?

a. for(i=0; i < n; i++)

b. for i in range(0,5):

c. for i in range(0,5)

d. for i in range(5)

Ans. b



24. Which of the following statement display “RAM” two times?

a.>>> “RAM” + 2

b.>>> “RAM” * 2

c.>>> “RAM” ** 2

d.None of the above

Ans.b.>>> “RAM” * 2



25. Which of the following sequences would be generated bt the given line of code?

range (5, 0, -2)

a. 5 4 3 2 1 0 -1

b. 5 4 3 2 1 0

c. 5 3 1

d. None of the above

Ans. c



26. A while loop in Python is used for what type of iteration?

a. indefinite

b. discriminant

c. definite

d. indeterminate

Ans. a



27. What will be the output of the following code?

x = 12

for i in x:

    print(i)

a. 12

b. 1 2

c. Error

d. None of the above

Ans. c



28. The break and continue statements, together are called …………….statement.

a. Jump 

b. goto 

c. compound

d. none

Ans. b. goto 



29. The two membership operators are ……….and …………

a. in, not in 

b. true , false

c.=,==

d. none

Ans.a. in, not in 



30. What is the logical expression for the following

Either A is greater than B or A is less than C

a. A>B or A<C 

b. A>B and A<C

c . A>Band C

d. A>B or C 

Ans. a. A>B or A<C 



31. Which one of these is floor division?

a. /

b. //

c. %

d. None of the mentioned

Ans. b



32. What is the order of precedence in python?

i) Parentheses

ii) Exponential

iii) Multiplication

iv) Division

v) Addition

vi) Subtraction

a. i,ii,iii,iv,v,vi

b. ii,i,iii,iv,v,vi

c. ii,i,iv,iii,v,vi

d. i,ii,iii,iv,vi,v

Ans. a



33. Which one of the following has the highest precedence in the expression?

a. Exponential

b. Addition

c. Multiplication

d. Parentheses

Ans. d



34. The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same.

a. True

b. False

Ans. a



35. What will be the value of the following Python expression?

4 + 3 % 5

a. 4

b. 7

c. 2

d. 0

Ans. b



36. Evaluate the expression given below if A = 16 and B = 15.

A % B // A

a. 0.0

b. 0

c. 1.0

d. 1

Ans. b



37. Which of the following operators has its associativity from right to left?

a. +

b. //

c. %

d. **

Ans. d



38. How many keywords are there in python 3.7?

a. 32

b. 33

c. 31

d. 30

Ans.b



39. An escape sequence is represented by __________ slash followed by one or two characters.

a.back

b.forward

c.double

d.None of the above

Ans.a.back



40. What will be the value of x in the following Python expression?

x = int(43.55+2/2)

a. 43

b. 44

c. 22

d. 23

Ans. b



41. What is the value of the following expression?

2+4.00, 2**4.0

a. (6.0, 16.0)

b. (6.00, 16.00)

c. (6, 16)

d. (6.00, 16.0)

Ans. a



42. Which of the following is the truncation division operator?

a. /

b. %

c. //

d. |

Ans. c



43. What are the values of the following Python expressions?

 2**(3**2)

 (2**3)**2

 2**3**2

a. 64, 512, 64

b. 64, 64, 64

c. 512, 512, 512

d. 512, 64, 512

Ans. d



44. The……….. clause can occur with an if as well as with loops.

a. else 

b. breake

c. continnue

d. none

Ans.a. else 

 


45. When does the else statement written after loop executes?

a. When break statement is executed in the loop

b. When loop condition becomes false

c. Else statement is always executed

d. None of the above

Ans. b



46. Which of the following operator is used for integer division?

a.["/"

b.//

c.\

d."\'']

Ans.b.//



47. What will be the output of the following code?

x = "abcdef"

i = "i"

while i in x:

    print(i, end=" ")

a. a b c d e f

b. abcdef

c. i i i i i.....

d. No Output

Ans. d



48. The ………….statement terminates the execution of the whole loop.

a. continue

b. exit

c. breake

d. break 

Ans.d. break 



49. The ……….. operator tests if a given value is contained in a sequence or not.

a. In:

b. in 

c. not in

d. none

Ans. b. in 



50. An empty /null statement in Python is …………….

a. pass 

b. none 

c. null

d. none

Ans. a. pass 



51. What is the value of the following expression?

8/4/2, 8/(4/2)

a. (1.0, 4.0)

b. (1.0, 1.0)

c. (4.0. 1.0)

d. (4.0, 4.0)

Ans. a



52. Write the output of the following code :

>>> 7+2//1**2 > 5+2**2//3

a.True

b.False

c.Error

d.None of the above

Ans.d.None of the above



53. Does python have switch case statement?

a. True

b. False 

c. Python has switch statement but we can not use it.

d. None of the above

Ans.b. False 

 


54. What will be output of this expression:

‘p’ + ‘q’ if ’12’.isdigit() else ‘r’ + ‘s’

a. pq

b. rs 

c. pqrs

d. pq12 

Ans.b. rs 



55. What is the value of the following expression?

float(22//3+3/3)

a. 8

b. 8.0

c. 8.3

d. 8.33

Ans. b


 

No comments:

Powered by Blogger.