20 Questions

Linux and python Quiz

1 :-

How can you execute a Python script from the Linux terminal?

2 :-

What does the following Python code do?

    ```python

    with open("file.txt", "r") as file:

        content = file.read()

    ```

3 :-

What does the `range(5)` function generate in Python?

4 :-

What is the purpose of the `json` module in Python?

5 :-

How do you open a file named "example.txt" in Python for reading?

6 :-

How do you import a module named `mymodule` in Python?

7 :-

In Linux, what does the command `sudo` do?

8 :-

What is the purpose of the `input()` function in Python?

9 :-

What is the purpose of the `df` command in Linux?

10 :-

How do you create a list in Python?

11 :-

What is the purpose of the `try`, `except`, `else`, and `finally` blocks in Python's exception handling?

12 :-

How do you create a virtual environment in Python using `venv`?

13 :-

How can you comment multiple lines in a Python script?

 

14 :-

What is the function of the `grep` command in Linux?

15 :-

How do you install a Python package using `pip` in Linux?

16 :-

How do you check the amount of free and used memory in a Linux system?

17 :-

What is the purpose of the `__init__.py` file in a Python package?

18 :-

What does the command `chmod +x script.sh` do in Linux?

19 :-

What is the purpose of the `if __name__ == "__main__":` block in a Python script?

20 :-

What is the purpose of the `pip freeze` command in Python?

Mock Test Completion Certificate
You scored 0 out of 20 questions.

🏅

For your extraordinary service and contributions to your profession.
We are delighted in providing this certificate to you.

Tips for improving your score:

  • Make sure to read the questions and answer choices carefully.
  • Don't try to answer any choices that you don't know. It's better to skip a question.