Python(Engineering > Computer Science And Engineering ) Questions and Answers

Question 1. Is Python case sensitive when dealing with identifiers?
  1.    machine dependent
  2.    None of the mentioned
  3.    no
  4.    yes
Explanation:-
Answer: Option D. -> yes

Question 2. Why are local variable names beginning with an underscore discouraged in Python Programming?
  1.    they are used to indicate a private variables of a class
  2.    they slow down execution
  3.    they confuse the interpreter
  4.    they are used to indicate global variables
Explanation:-
Answer: Option A. -> they are used to indicate a private variables of a class

Question 3. All keywords in Python are in _________
  1.    UPPER CASE
  2.    None of the mentioned
  3.    lower case
  4.    Capitalized
Explanation:-
Answer: Option B. -> None of the mentioned

Question 4. Which of the following is invalid variable in Python?
  1.    _a = 1
  2.    None of the mentioned
  3.    __a = 1
  4.    __str__ = 1
Explanation:-
Answer: Option B. -> None of the mentioned

Question 5. What is the maximum possible length of an identifier allowed by Python?
  1.    31 characters
  2.    79 characters
  3.    63 characters
  4.    None of the mentioned
Explanation:-
Answer: Option D. -> None of the mentioned

Question 6. Which is the correct expression for power(xy ) in Python?
  1.    x**y
  2.    x^^y
  3.    x^y
  4.    None of the mentioned
Explanation:-
Answer: Option A. -> x**y

Question 7. Which one of these is used for floor division in Python?
  1.    %
  2.    /
  3.    //
  4.    None of the mentioned
Explanation:-
Answer: Option C. -> //

Question 8. In Python, which of the following cannot be a variable?
  1.    on
  2.    in
  3.    __init__
  4.    It
Explanation:-
Answer: Option B. -> in

Question 9. What error occurs when you execute the following Python code snippet? apple = mango
  1.    SyntaxError
  2.    ValueError
  3.    NameError
  4.    TypeError
Explanation:-
Answer: Option C. -> NameError

Question 10. In Python, which of these in not a core data type?
  1.    Lists
  2.    Dictionary
  3.    Class
  4.    Tuples
Explanation:-
Answer: Option C. -> Class