nerdexam
Huawei

H13-311_V3.5 · Question #338

What is wrong description of the Python module?

The correct answer is C. Python modules can define functions classes and variables but the module does not contain. Option C is the wrong description because it states that Python modules cannot contain runnable code (executable statements), which is false. Modules absolutely can contain top-level executable code - statements that run when the module is imported or executed directly, not…

AI Overview

Question

What is wrong description of the Python module?

Options

  • AThe Python module is a Python file that ends with .py and contains Python object definitions and
  • BThe Python module allows you to logically organize your Python code snippets.
  • CPython modules can define functions classes and variables but the module does not contain
  • DAssigning relevant code to a module can make your code better and easier to understand.

How the community answered

(47 responses)
  • A
    15% (7)
  • B
    2% (1)
  • C
    77% (36)
  • D
    6% (3)

Explanation

Option C is the wrong description because it states that Python modules cannot contain runnable code (executable statements), which is false. Modules absolutely can contain top-level executable code - statements that run when the module is imported or executed directly, not just definitions of functions, classes, and variables.

Options A, B, and D are all accurate: modules are indeed .py files containing object definitions (A), they serve to logically organize code (B), and grouping related code into modules improves readability and maintainability (D).

Memory tip: Think of the phrase "modules are more than definitions." If you've ever seen if __name__ == "__main__": in a Python file, that's executable code living inside a module - proof that modules aren't limited to just definitions.

Topics

#Python modules#code organization#Python fundamentals#logical structure

Community Discussion

No community discussion yet for this question.

Full H13-311_V3.5 Practice