Q. Is Python code compiled or interpreted?

  • (A) Python code is both compiled and interpreted
  • (B) Python code is neither compiled nor interpreted
  • (C) Python code is only compiled
  • (D) Python code is only interpreted
πŸ’¬ Discuss
βœ… Correct Answer: (B) Python code is neither compiled nor interpreted

Q. All keywords in Python are in

  • (A) Capitalized
  • (B) lower case
  • (C) UPPER CASE
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (D) None

Q. What will be the value of the following Python expression?
4 + 3 % 5

  • (A) 7
  • (B) 2
  • (C) 4
  • (D) 1
πŸ’¬ Discuss
βœ… Correct Answer: (A) 7

Q. Which of the following is used to define a block of code in Python language?

  • (A) Indentation
  • (B) Key
  • (C) Brackets
  • (D) All of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) Indentation

Q. Which keyword is used for function in Python language?

  • (A) Function
  • (B) Def
  • (C) Fun
  • (D) Define
πŸ’¬ Discuss
βœ… Correct Answer: (B) Def

Q. Which of the following character is used to give single-line comments in Python?

  • (A) //
  • (B) #
  • (C) !
  • (D) /*
πŸ’¬ Discuss
βœ… Correct Answer: (B) #

Q. What will be the output of the following Python code?

Code:
i = 1
while True:
    if i%3 == 0:
        break
    print(i)
 
    i + = 1
  • (A) 1 2 3
  • (B) error
  • (C) 1 2
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (B) error

Q. Which of the following functions can help us to find the version of python that we are currently working on?

  • (A) sys.version(1)
  • (B) sys.version(0)
  • (C) sys.version()
  • (D) sys.version
πŸ’¬ Discuss
βœ… Correct Answer: (A) sys.version(1)

Q. Python supports the creation of anonymous functions at runtime, using a construct called

  • (A) pi
  • (B) anonymous
  • (C) lambda
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (C) lambda

Q. What is the order of precedence in python?

  • (A) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
  • (B) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
  • (C) Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
  • (D) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
πŸ’¬ Discuss
βœ… Correct Answer: (D) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction