PYTHON Packaging and Development MCQs

  1. Which tool is used to install Python packages?
    a) pip
    b) conda
    c) venv
    d) None
    View Answer

    Correct answer: A — pip

  2. What will be printed?
    1 bash
    2 pip --version
    a) pip version string
    b) Error
    c) None
    d) pip only
    View Answer

    Correct answer: A — pip version string

  3. Which command installs a package using pip?
    a) pip install package
    b) pip add package
    c) pip get package
    d) None
    View Answer

    Correct answer: A — pip install package

  4. What is the output of pip install requests?
    a) Installs requests library
    b) Error
    c) None
    d) requests only
    View Answer

    Correct answer: A — Installs requests library

  5. Which command shows installed packages?
    a) pip list
    b) pip show
    c) pip freeze
    d) None
    View Answer

    Correct answer: A — pip list

  6. What will be printed?
    1 bash
    2 pip list | grep requests
    a) requests version
    b) Error
    c) None
    d) list only
    View Answer

    Correct answer: A — requests version

  7. Which command shows package details?
    a) pip show package
    b) pip list package
    c) pip info package
    d) None
    View Answer

    Correct answer: A — pip show package

  8. What is the output of pip show numpy?
    a) Package details
    b) Error
    c) None
    d) numpy only
    View Answer

    Correct answer: A — Package details

  9. Which command exports installed packages?
    a) pip freeze > requirements.txt
    b) pip list > requirements.txt
    c) pip show > requirements.txt
    d) None
    View Answer

    Correct answer: A — pip freeze > requirements.txt

  10. What will be printed?
    1 bash
    2 pip freeze | head -1
    a) First package with version
    b) Error
    c) None
    d) freeze only
    View Answer

    Correct answer: A — First package with version

  11. Which module creates virtual environments?
    a) venv
    b) virtualenv
    c) conda
    d) None
    View Answer

    Correct answer: A — venv

  12. What is the output of python -m venv env?
    a) Creates env directory
    b) Error
    c) None
    d) venv only
    View Answer

    Correct answer: A — Creates env directory

  13. Which command activates venv in Windows?
    a) env\Scripts\activate
    b) source env/bin/activate
    c) activate env
    d) None
    View Answer

    Correct answer: A — env\Scripts\activate

  14. What will be printed?
    1 bash
    2 env\Scripts\activate
    a) Activates venv
    b) Error
    c) None
    d) activate only
    View Answer

    Correct answer: A — Activates venv

  15. Which command activates venv in Linux/Mac?
    a) source env/bin/activate
    b) env\Scripts\activate
    c) activate env
    d) None
    View Answer

    Correct answer: A — source env/bin/activate

  16. What is the output of source env/bin/activate?
    a) Activates venv
    b) Error
    c) None
    d) source only
    View Answer

    Correct answer: A — Activates venv

  17. Which command deactivates venv?
    a) deactivate
    b) exit
    c) close
    d) None
    View Answer

    Correct answer: A — deactivate

  18. What will be printed?
    1 bash
    2 deactivate
    a) Deactivates venv
    b) Error
    c) None
    d) deactivate only
    View Answer

    Correct answer: A — Deactivates venv

  19. Which tool is used for containerization?
    a) Docker
    b) Kubernetes
    c) Podman
    d) None
    View Answer

    Correct answer: A — Docker

  20. What is the output of docker --version?
    a) Docker version string
    b) Error
    c) None
    d) docker only
    View Answer

    Correct answer: A — Docker version string

  21. Which command builds Docker image?
    a) docker build
    b) docker create
    c) docker image
    d) None
    View Answer

    Correct answer: A — docker build

  22. What will be printed?
    1 bash
    2 docker build -t eduinq:latest .
    a) Builds image eduinq:latest
    b) Error
    c) None
    d) build only
    View Answer

    Correct answer: A — Builds image eduinq:latest

  23. Which command runs Docker container?
    a) docker run
    b) docker start
    c) docker exec
    d) None
    View Answer

    Correct answer: A — docker run

  24. What is the output of docker run hello-world?
    a) Runs hello-world container
    b) Error
    c) None
    d) run only
    View Answer

    Correct answer: A — Runs hello-world container

  25. Which command lists Docker containers?
    a) docker ps
    b) docker list
    c) docker show
    d) None
    View Answer

    Correct answer: A — docker ps

  26. What will be printed?
    1 bash
    2 docker ps -a
    a) All containers list
    b) Error
    c) None
    d) ps only
    View Answer

    Correct answer: A — All containers list

  27. Which command lists Docker images?
    a) docker images
    b) docker list
    c) docker show
    d) None
    View Answer

    Correct answer: A — docker images

  28. What is the output of docker images?
    a) List of images
    b) Error
    c) None
    d) images only
    View Answer

    Correct answer: A — List of images

  29. Which file defines Docker build instructions?
    a) Dockerfile
    b) docker.yaml
    c) docker.json
    d) None
    View Answer

    Correct answer: A — Dockerfile

  30. What will be printed?
    1 dockerfile
    2 FROM python:3.9
    a) Base image python:3.9
    b) Error
    c) None
    d) FROM only
    View Answer

    Correct answer: A — Base image python:3.9

  31. Which command removes Docker container?
    a) docker rm
    b) docker remove
    c) docker delete
    d) None
    View Answer

    Correct answer: A — docker rm

  32. What is the output of docker rm container_id?
    a) Removes container
    b) Error
    c) None
    d) rm only
    View Answer

    Correct answer: A — Removes container

  33. Which command removes Docker image?
    a) docker rmi
    b) docker rm
    c) docker delete
    d) None
    View Answer

    Correct answer: A — docker rmi

  34. What will be printed?
    1 bash
    2 docker rmi image_id
    a) Removes image
    b) Error
    c) None
    d) rmi only
    View Answer

    Correct answer: A — Removes image

  35. Which command pushes image to Docker Hub?
    a) docker push
    b) docker upload
    c) docker send
    d) None
    View Answer

    Correct answer: A — docker push

  36. What is the output of docker push eduinq:latest?
    a) Pushes image eduinq:latest
    b) Error
    c) None
    d) push only
    View Answer

    Correct answer: A — Pushes image eduinq:latest

  37. Which command pulls image from Docker Hub?
    a) docker pull
    b) docker get
    c) docker fetch
    d) None
    View Answer

    Correct answer: A — docker pull

  38. What will be printed?
    1 bash
    2 docker pull python:3.9
    a) Pulls python:3.9 image
    b) Error
    c) None
    d) pull only
    View Answer

    Correct answer: A — Pulls python:3.9 image

  39. Which command executes command inside container?
    a) docker exec
    b) docker run
    c) docker start
    d) None
    View Answer

    Correct answer: A — docker exec

  40. What is the output of docker exec -it container_id bash?
    a) Opens bash shell inside container
    b) Error
    c) None
    d) exec only
    View Answer

    Correct answer: A — Opens bash shell inside container

  41. Which command starts stopped container?
    a) docker start
    b) docker run
    c) docker exec
    d) None
    View Answer

    Correct answer: A — docker start

  42. What will be printed?
    1 bash
    2 docker start container_id
    a) Starts container
    b) Error
    c) None
    d) start only
    View Answer

    Correct answer: A — Starts container

  43. Which command stops running container?
    a) docker stop
    b) docker kill
    c) docker end
    d) None
    View Answer

    Correct answer: A — docker stop

  44. What is the output of docker stop container_id?
    a) Stops container
    b) Error
    c) None
    d) stop only
    View Answer

    Correct answer: A — Stops container

  45. Which command kills running container immediately?
    a) docker kill
    b) docker stop
    c) docker end
    d) None
    View Answer

    Correct answer: A — docker kill

  46. What will be printed?
    1 bash
    2 docker kill container_id
    a) Kills container immediately
    b) Stops container gracefully
    c) Error
    d) None
    View Answer

    Correct answer: A — Kills container immediately

  47. Which command shows container logs?
    a) docker logs
    b) docker show
    c) docker ps
    d) None
    View Answer

    Correct answer: A — docker logs

  48. What is the output of docker logs container_id?
    a) Shows container logs
    b) Error
    c) None
    d) logs only
    View Answer

    Correct answer: A — Shows container logs

  49. Which command inspects container details?
    a) docker inspect
    b) docker show
    c) docker details
    d) None
    View Answer

    Correct answer: A — docker inspect

  50. What will be printed?
    1 bash
    2 docker inspect container_id
    a) JSON details of container
    b) Error
    c) None
    d) inspect only
    View Answer

    Correct answer: A — JSON details of container

Quick Links to Explore