Share 0x02. python - import & modules quiz

haithuyhelena

New member
**0x02. Python - Import & Modules Quiz**

**Hashtags:** #Python #Import #Modules #Quiz #Programming

**Instructions:**

1. This is a multiple-choice quiz on Python imports and modules.
2. Each question has four possible answers.
3. You have 10 minutes to complete the quiz.
4. Good luck!

**Question 1:**

What is the syntax for importing a module in Python?

(A) `import module`
(B) `from module import *`
(C) `from module import function`
(D) `import module as m`

**Question 2:**

What is the difference between `import` and `from`?

(A) `import` imports the entire module, while `from` imports only specific parts of the module.
(B) `import` imports the module into the current namespace, while `from` imports the module into a new namespace.
(C) `import` imports the module at runtime, while `from` imports the module at compile time.
(D) `import` imports the module from the current directory, while `from` imports the module from a specified path.

**Question 3:**

What is the `__init__.py` file for?

(A) It is a special file that is used to initialize a module.
(B) It is a file that contains the documentation for a module.
(C) It is a file that contains the code for a module.
(D) It is a file that is used to import a module.

**Question 4:**

What is the difference between a package and a module?

(A) A package is a collection of modules, while a module is a single file.
(B) A package is a directory, while a module is a file.
(C) A package is a namespace, while a module is a collection of functions.
(D) A package is a library, while a module is a program.

**Question 5:**

What is the best way to organize your Python code into modules and packages?

(A) Use a single module for all of your code.
(B) Use a separate module for each function.
(C) Use a separate module for each class.
(D) Use a separate package for each feature.

**Answers:**

1. (B)
2. (A)
3. (A)
4. (A)
5. (D)
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top