---
tags:
- devops
- l1
- flashcard-deck
- repo
---
<!-- wiki:breadcrumb:start -->
[Portal](../../../../library/portal/index.md) | **Level:** [L1: Foundations](../../../../library/portal/levels.md) | **Topics:** [Git](../../../../library/portal/topics.md) | **Domain:** DevOps & Tooling
<!-- wiki:breadcrumb:end -->

id	category	difficulty	tags	question	answer	source_path
repo/0929ef362048	repo	easy	repo, ci-integration, git	3. What is _PEP 8_ and why is it important?	**PEP 8** is Python's official style guide promoting readable, consistent code.\n\nKey rules:\n- 4-space indentation, 79-char line length\n- `CamelCase` for classes, `snake_case` for functions/variables\n- Surround operators with spaces, use blank lines to separate logical sections\n- Triple-quote docstrings for documentation\n\nIt matters because consistent style reduces cognitive load when reading or contributing to code. Tools like `flake8`, `black`, and `ruff` enforce PEP 8 automatically.	projects/knowledge/interview/repo/003-3-what-is-pep-8-and-why-is-it-important.txt
repo/15ed1e2e88b5	repo	easy	repo, git, branching	6. Explain the `LIFO` scheme.?	Solution: LIFO is a short form of Last In First Out. It refers how data is accessed, stored and retrieved. Using this scheme, data that was stored last should be the one to be extracted first. This also means that in order to gain access to the first data, all the other data that was stored before this first data must first be retrieved and extracted.	projects/knowledge/interview/repo/024-6-explain-the-lifo-scheme.txt
repo/216dfaf28ff2	repo	easy	repo, git, branching	2. How to find the `loop` or `cycle` in a linked list in one pass ?	Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. If `p` and `q` are pointing to the same node, there is a loop or cycle present.\n\nGotcha: Monorepo tooling (Bazel, Nx, Turborepo) is essential at scale — plain git and make struggle with thousands of packages.	projects/knowledge/interview/repo/020-2-how-to-find-the-loop-or-cycle-in-a-linked-list-i.txt
repo/287da27206ad	repo	easy	repo, git, branching	3. How to find the `k th` element from the end of a linked list in one pass ?	Solution: Start with two pointer `p` and `q`. When the `p` pointer reahces upto the `k th` element, increment `q`.When `p` reaches the end of the list. `q` is ponting to the element 'k th' from the end.\n\nRemember: "Trunk-based = short-lived branches, frequent merges." Branches live hours to days, not weeks.\n\nExample: Developer creates branch, makes small change, opens PR, merges same day.	projects/knowledge/interview/repo/021-3-how-to-find-the-k-th-element-from-the-end-of-a-l.txt
repo/31de9298ecfa	repo	hard	repo, ci-integration, git	4. How is memory allocation and garbage collection handled in _Python_?	Python uses **reference counting** as its primary memory management: each object tracks how many references point to it, and is freed when the count drops to zero. A **cyclic garbage collector** handles circular references that reference counting cannot resolve.\n\nMemory is allocated from a private heap managed by Python's memory manager. The `gc` module lets you inspect and control garbage collection (e.g., `gc.collect()` to force a cycle). The `del` statement removes a reference but does not guarantee immediate deallocation.	projects/knowledge/interview/repo/004-4-how-is-memory-allocation-and-garbage-collection-.txt
repo/3fc086e3aeae	repo	easy	repo, git, branching	4. List some real world applications of linked list ?	Solution:\n\n*Image viewer* – Previous and next images are linked, hence can be accessed by next and previous button.\n\n*Previous and next page in web browser* – We can access previous and next url searched in web browser by pressing back and next button since, they are linked as linked list.\n\n*Music Player* – Songs in music player are linked to previous and next song. you can play songs either from starting or ending of the list.	projects/knowledge/interview/repo/022-4-list-some-real-world-applications-of-linked-list.txt
repo/429bb5971e0d	repo	easy	repo, git, branching	13. Explain _*args_ and _**kwargs_ in _Python_.?	`*args` collects extra positional arguments into a tuple. `**kwargs` collects extra keyword arguments into a dictionary.\n\n```python\ndef example(*args, **kwargs):\n    print(args)    # (1, 2, 3)\n    print(kwargs)  # {'key': 'value'}\nexample(1, 2, 3, key='value')\n```\n\nUse them to write flexible functions that accept variable numbers of arguments. They are also essential for decorators and forwarding arguments to other functions.	projects/knowledge/interview/repo/013-13-explain-args-and-kwargs-in-python.txt
repo/488118b290d4	repo	medium	repo, git, branching	14. What are _decorators_ in _Python_?	Decorators are functions that modify the behavior of other functions or classes. They use the `@decorator` syntax and wrap the target function.\n\n```python\n@my_decorator\ndef my_func():\n    pass\n# Equivalent to: my_func = my_decorator(my_func)\n```\n\nCommon uses: logging, timing, authentication, caching (`@functools.lru_cache`), and framework features like Flask's `@app.route`. Use `@functools.wraps` inside your decorator to preserve the original function's name and docstring.	projects/knowledge/interview/repo/014-14-what-are-decorators-in-python.txt
repo/4df8f7a2d753	repo	medium	repo, git, branching	15. How can you create a _module_ in _Python_?	A Python module is any `.py` file. A package is a directory with an `__init__.py` file containing modules.\n\nCreate a module: write functions/classes in a `.py` file, then `import` it by filename. Create a package: make a directory, add `__init__.py`, and place modules inside.\n\nUse `__all__` in `__init__.py` to control what `from package import *` exports. Install third-party packages with `pip install`. The `sys.path` list determines where Python searches for imports.	projects/knowledge/interview/repo/015-15-how-can-you-create-a-module-in-python.txt
repo/542da2ada0e6	repo	medium	repo, git, branching	8. What is the difference between _list_ and _tuple_?	**List**: Mutable, ordered, uses `[]`. Elements can be changed, added, or removed after creation. Slightly slower due to mutability overhead.\n**Tuple**: Immutable, ordered, uses `()`. Cannot be modified after creation. Faster and uses less memory.\n\nUse tuples for fixed collections (coordinates, dict keys, function return values). Use lists when you need to modify the collection. Tuples are hashable (if contents are hashable), lists are not.	projects/knowledge/interview/repo/008-8-what-is-the-difference-between-list-and-tuple.txt
repo/69ed99151c08	repo	medium	repo, git, branching	9. How do you create a _dictionary_ in _Python_?	Dictionaries store key-value pairs with O(1) average lookup.\n\n```python\nd = {'name': 'Alice', 'age': 30}       # literal\nd = dict(name='Alice', age=30)          # constructor\nd = {k: v for k, v in pairs}            # comprehension\n```\n\nKeys must be hashable (strings, numbers, tuples). Access with `d['key']` (raises KeyError) or `d.get('key', default)`. Common methods: `.keys()`, `.values()`, `.items()`, `.update()`, `.pop()`. Since Python 3.7, dicts preserve insertion order.	projects/knowledge/interview/repo/009-9-how-do-you-create-a-dictionary-in-python.txt
repo/6e1806aac0ae	repo	medium	repo, git, branching	8. What are the minimum number of queues to implement a prioriy queue ?	Solution: The minimum number of queues needed in this case is two. One queue is intended for sorting priorities while the other queue is used for actual storage of data.\n\nRemember: "Semantic versioning = MAJOR.MINOR.PATCH." Breaking change = major bump. New feature = minor. Bug fix = patch.\n\nExample: Going from 2.3.1 to 3.0.0 signals breaking changes.	projects/knowledge/interview/repo/026-8-what-are-the-minimum-number-of-queues-to-impleme.txt
repo/798bd6dc8099	repo	medium	repo, git, branching	12. What is a _lambda function_, and where would you use it?	A lambda is a small anonymous function defined with `lambda args: expression`. It can take any number of arguments but only one expression.\n\n```python\nsquare = lambda x: x ** 2\nsorted(items, key=lambda x: x.name)\n```\n\nUse lambdas for short callbacks — `sorted()`, `map()`, `filter()`, `reduce()`. For anything more complex, use a named `def` function for readability.	projects/knowledge/interview/repo/012-12-what-is-a-lambda-function-and-where-would-you-u.txt
repo/7a5de42570da	repo	hard	repo, git, branching	2. How is _Python_ executed?	Python code is first compiled to **bytecode** (`.pyc` files), then executed by the **Python Virtual Machine (PVM)**. This is an interpreted execution model — there is no separate compilation step visible to the user.\n\nCPython (the default interpreter) uses a **GIL** (Global Interpreter Lock) that allows only one thread to execute bytecode at a time. Alternative implementations: **PyPy** (JIT-compiled, faster), **Jython** (JVM), **IronPython** (.NET). For CPU-bound parallelism, use `multiprocessing` or native extensions to work around the GIL.	projects/knowledge/interview/repo/002-2-how-is-python-executed.txt
repo/7fa94600a4b3	repo	medium	repo, git, branching	5. What are the _built-in data types_ in _Python_?	Python's built-in data types:\n\n- **Numeric**: `int`, `float`, `complex`\n- **Sequence**: `list` (mutable), `tuple` (immutable), `range`\n- **Text**: `str` (immutable)\n- **Mapping**: `dict`\n- **Set**: `set` (mutable), `frozenset` (immutable)\n- **Boolean**: `bool` (`True`/`False`, subclass of `int`)\n- **Binary**: `bytes`, `bytearray`, `memoryview`\n- **None**: `NoneType`\n\nCheck type with `type()`, check isinstance with `isinstance()`.\n\nRemember: "CI = build on every commit, CD = deploy on every merge." CI catches bugs early; CD shortens the feedback loop.	projects/knowledge/interview/repo/005-5-what-are-the-built-in-data-types-in-python.txt
repo/853efd13980c	repo	medium	repo, git, branching	7. What is merge sort ?	Solution: Merge sort, is a  divide-and-conquer approach for sorting the data. In a sequence of data, adjacent ones are merged and sorted to create bigger sorted lists. These sorted lists are then merged again to form an even bigger sorted list, which continues until you have one single sorted list.	projects/knowledge/interview/repo/025-7-what-is-merge-sort.txt
repo/86a16a26bd79	repo	medium	repo, git, branching	9. Which sorting algorithm is the fastest?	Solution: There are many types of sorting algorithms: quick sort, bubble sort, balloon sort, radix sort, merge sort, etc. Not one can be considered the fastest because each algorithm is designed for a particular data structure and data set. It would depend on the data set that you would want to sort.	projects/knowledge/interview/repo/027-9-which-sorting-algorithm-is-the-fastest.txt
repo/9af04c44e6d8	repo	medium	repo, git, branching	6. Explain the difference between a _mutable_ and _immutable_ object.?	**Mutable** objects can be changed after creation (lists, dicts, sets). **Immutable** objects cannot be modified (strings, tuples, ints, frozensets).\n\nKey implications:\n- Immutable objects are hashable and can be dict keys or set members\n- Mutating a shared mutable object affects all references to it\n- Default function arguments should not be mutable (common Python gotcha)\n- Immutable objects are inherently thread-safe	projects/knowledge/interview/repo/006-6-explain-the-difference-between-a-mutable-and-imm.txt
repo/9fa51ccb97f2	repo	medium	repo, git, branching	10. Save all leaf nodes of a Binary tree in a Doubly Linked List by using Right node as Next node and Left Node as Previous Node.?	Convert all leaf nodes of a binary tree into a doubly linked list using the right pointer as `next` and left pointer as `prev`.\n\nApproach: Perform an inorder traversal, collecting leaf nodes. For each leaf, set `right = next_leaf` and `left = prev_leaf`. Track the head (first leaf) and use a `prev` pointer to link nodes as you traverse.\n\nTime complexity: O(n) — visit every node once.\nSpace complexity: O(h) — recursion stack depth equals tree height.	projects/knowledge/interview/repo/028-10-save-all-leaf-nodes-of-a-binary-tree-in-a-doubl.txt
repo/add913b89e5a	repo	medium	repo, git, branching	10. What is the difference between _==_ and _is operator_ in _Python_?	`==` compares **values** (equality). `is` compares **identity** (same object in memory, i.e., same `id()`).\n\n```python\na = [1, 2]; b = [1, 2]\na == b  # True (same content)\na is b  # False (different objects)\n```\n\nUse `is` only for singletons like `None`: `if x is None`. CPython caches small integers (-5 to 256) and interned strings, so `is` may return True for those, but do not rely on it.	projects/knowledge/interview/repo/010-10-what-is-the-difference-between-and-is-operator-.txt
repo/b8ba4c5c4b7f	repo	hard	repo, ci-integration, git	7. How do you _handle exceptions_ in _Python_?	Use `try/except/else/finally` blocks:\n\n```python\ntry:\n    result = risky_operation()\nexcept ValueError as e:\n    handle_error(e)\nexcept (TypeError, KeyError):\n    handle_other()\nelse:\n    # runs if no exception\nfinally:\n    # always runs (cleanup)\n```\n\nBest practices: catch specific exceptions (never bare `except:`), use `raise` to re-raise, create custom exceptions by subclassing `Exception`, and use context managers (`with` statement) for resource cleanup.	projects/knowledge/interview/repo/007-7-how-do-you-handle-exceptions-in-python.txt
repo/bd90657d56bf	repo	hard	repo, git, branching	11. How does a _Python function_ work?	Functions are defined with `def`, can accept positional, keyword, default, `*args`, and `**kwargs` arguments, and return values with `return`.\n\nKey concepts:\n- Functions are first-class objects (assignable, passable, storable)\n- Scope follows LEGB rule: Local, Enclosing, Global, Built-in\n- `return` without a value (or no return) gives `None`\n- Type hints are optional: `def f(x: int) -> str:`\n- Closures capture variables from enclosing scope; use `nonlocal` to modify them	projects/knowledge/interview/repo/011-11-how-does-a-python-function-work.txt
repo/cf6d5d9896b5	repo	hard	repo, ci-integration, git	5. What is a data structure ?	Solution: Data structure refers to the way data is organized and manipulated. It seeks to find ways to make data access more efficient. When dealing with the data structure, we not only focus on one piece of data but the different set of data and how they can relate to one another in an organized manner.	projects/knowledge/interview/repo/023-5-what-is-a-data-structure.txt
repo/f08e208d1db0	repo	hard	repo, git, branching	1. What are the _key features_ of _Python_?	Key Python features:\n\n- **Interpreted** with dynamic typing — no compilation step needed\n- **Multi-paradigm**: supports OOP, functional, and procedural styles\n- **Rich standard library** ("batteries included") and massive ecosystem (PyPI)\n- **Readability-focused** syntax with significant whitespace\n- **Cross-platform**: runs on Linux, macOS, Windows\n- **Memory management**: automatic garbage collection with reference counting\n- **Extensible**: can integrate with C/C++ libraries	projects/knowledge/interview/repo/001-1-what-are-the-key-features-of-python.txt

<!-- wiki:related:start -->
---

## Wiki Navigation

### Related Content

- [Git Advanced](../../../../library/topics/git-advanced/index.md) (Topic Pack, L2) — Git
- [Git Drills](../../../../library/drills/git_drills.md) (Drill, L0) — Git
- Git Flashcards *(CLI)* (flashcard_deck, L1) — Git
- [Git for DevOps](../../../../library/topics/git/index.md) (Topic Pack, L0) — Git
- [Interview: Secret Leaked to Git](../../../../library/interview-scenarios/13-secret-leaked-to-git.md) (Scenario, L2) — Git
- [Mental Models (Core Concepts)](../../../../library/topics/mental-models-core/index.md) (Topic Pack, L0) — Git
- [RHCE (EX294) Exam Preparation](../../../../library/topics/rhce/index.md) (Topic Pack, L2) — Git
- [Skillcheck: Git](../../../../library/skillchecks/git.skillcheck.md) (Assessment, L0) — Git
- [Track: Foundations](../../../../library/curriculum/tracks/foundations.md) (Reference, L0) — Git

<!-- wiki:related:end -->
