CommerceVariable 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
- 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
Correct Answer: A
What is the result of the expression 5 // 2 ?
- A. 2.5
- B. 2
- C. 2.0
- D. 3
Correct Answer: B
What is the result of 10 // 3 ?
- A. 3
- B. 3.0
- C. 3.33
- D. 0
Correct Answer: A
Why are local variable names beginning with an underscore discouraged?
- A. they are used to indicate a private variables of a class
- B. they confuse the interpreter
- C. they are used to indicate global variables
- D. they slow down execution
Correct Answer: A
Which of the following cannot be a variable?
- A. __init__
- B. in
- C. it
- D. on
Correct Answer: B
What is the result of "hello" * 3 ?
- A. "hellohellohello"
- B. "hello3"
- C. "3hello"
- D. "hhheeellllllooo"
Correct Answer: A
Which one of the following has the same precedence level?
- A. Addition and Subtraction
- B. Multiplication, Division and Addition
- C. Multiplication, Division, Addition and Subtraction
- D. Addition and Multiplication
Correct Answer: A
Which of the following is a valid way to comment a single line in Python?
- A. comment
- B. / comment
- C.
- D. # comment
Correct Answer: D
What is the result of not (5 > 3) ?
- A. True
- B. False
- C. None
- D. Error
Correct Answer: B
Which of the following is invalid?
- A. _a = 1
- B. __a = 1
- C. __str__ = 1
- D. none of the mentioned
Correct Answer: D
What is the purpose of the == operator in Python?
- A. Assignment
- B. Comparison for equality
- C. Exponentiation
- D. Concatenation
Correct Answer: B
What is the output of this expression, 3*1**3?
- A. 27
- B. 9
- C. 3
- D. 1
Correct Answer: C