✅ MODULE III

0 0 0
                                        


📌 PART – A (2 MARKS EACH)

------------------------------------------

1. What is recursion in Python?

Recursion is a technique where a function calls itself repeatedly until a base condition is met. It is used for problems like factorial, Fibonacci, tree traversal, etc.

---

2. What is a module? List built-in modules in Python.

A module is a Python file containing functions, classes or variables.
Examples of built-in modules: math, random, os, sys, datetime.

---

3. What is help() function in Python?

help() displays documentation about modules, functions, classes, etc.
Example: help(print).

---

4. What is sys() function in Python?

It refers to the sys module, which provides functions related to the Python interpreter.
Example: sys.version, sys.exit().

---

5. What is a function?

A function is a block of reusable code that performs a specific job and is executed when called.

---

6. What are docstrings?

Docstrings are documentation strings written inside triple quotes that describe a function or module.

---

7. What is scope of variables? List two types of scope.

Scope refers to the area where a variable can be accessed.
Types:

Local scope

Global scope

---

8. What are the advantages of Python modules?

Code reusability

Easy maintenance

Better organization

Avoid repetition

---

9. What is module aliasing? Give an example.

Using an alternative short name for a module.

import math as m

---

10. What is import statement in Python?

It is used to include a module into the program.
Example: import math.

---

11. What are the two types of files in Python?

Text files (.txt)

Binary files (.bin, images, videos)

---

12. What is a file?

A file is a container on a storage device used to store data permanently.

---

13. What are the various file handling operations?

Open

Read

Write

Append

Close

---

14. What is an Exception?

An exception is an error that occurs during program execution, interrupting normal flow.

python Donde viven las historias. Descúbrelo ahora