Commerce

Variable Names And Operators MCQs

Practice Variable Names And Operators MCQs for competitive exams.

Variable Names And Operators MCQs

Practice questions from this topic.

What is the order of precedence in python? i) Parentheses ii) Exponential iii) Multiplication iv) Division v) Addition vi) Subtraction

  1. A. i, ii, iii, iv, v, vi
  2. B. ii, i, iii, iv, v, vi
  3. C. ii, i, iv, iii, v, vi
  4. D. i, ii, iii, iv, vi, v
Report Error

What is the result of the expression 5 // 2 ?

  1. A. 2.5
  2. B. 2
  3. C. 2.0
  4. D. 3
Report Error

What is the result of 10 // 3 ?

  1. A. 3
  2. B. 3.0
  3. C. 3.33
  4. D. 0
Report Error

Why are local variable names beginning with an underscore discouraged?

  1. A. they are used to indicate a private variables of a class
  2. B. they confuse the interpreter
  3. C. they are used to indicate global variables
  4. D. they slow down execution
Report Error

Which of the following cannot be a variable?

  1. A. __init__
  2. B. in
  3. C. it
  4. D. on
Report Error

What is the result of "hello" * 3 ?

  1. A. "hellohellohello"
  2. B. "hello3"
  3. C. "3hello"
  4. D. "hhheeellllllooo"
Report Error

Which one of the following has the same precedence level?

  1. A. Addition and Subtraction
  2. B. Multiplication, Division and Addition
  3. C. Multiplication, Division, Addition and Subtraction
  4. D. Addition and Multiplication
Report Error

Which of the following is a valid way to comment a single line in Python?

  1. A. comment
  2. B. / comment
  3. C.
  4. D. # comment
Report Error

What is the result of not (5 > 3) ?

  1. A. True
  2. B. False
  3. C. None
  4. D. Error
Report Error

Which of the following is invalid?

  1. A. _a = 1
  2. B. __a = 1
  3. C. __str__ = 1
  4. D. none of the mentioned
Report Error

What is the purpose of the == operator in Python?

  1. A. Assignment
  2. B. Comparison for equality
  3. C. Exponentiation
  4. D. Concatenation
Report Error

What is the output of this expression, 3*1**3?

  1. A. 27
  2. B. 9
  3. C. 3
  4. D. 1
Report Error