Skip to content

Shuffled Trivia Compendium

2491 questions from Ansible, Linux, and Python — shuffled together for cross-topic study. Each question is tagged with its source topic.

Last updated: 2026-03-27


Batch 1

Q1. [Ansible] What is the difference between an inventory script and an inventory plugin?

A: Inventory scripts are standalone executables that output JSON. Inventory plugins are Python classes integrated with Ansible's plugin system, supporting caching, configuration via ansible.cfg, and the constructed features. Plugins are recommended over scripts.

Q2. [Linux] What does GNU stand for?

A: GNU stands for "GNU's Not Unix" — a recursive acronym, a tradition in hacker culture.

Q3. [Linux] What is the difference between a physical and virtual console?

A: Physical consoles are the TTYs accessible via Ctrl-Alt-F1 through F6 on the hardware. Virtual/pseudo-terminals (/dev/pts/*) are created by terminal emulators and SSH.

Q4. [Ansible] What is ansible-lint?

A: A linting tool that checks playbooks and roles for style, best practices, and potential errors.

Q5. [Linux] What is TCP keepalive?

A: Periodic probes sent on idle TCP connections to detect dead peers. Configured via net.ipv4.tcp_keepalive_time (default 7200 seconds), tcp_keepalive_intvl, and tcp_keepalive_probes.

Q6. [Linux] What is rsyslog?

A: The default syslog daemon on most Linux distributions. An enhanced version of syslogd with reliable delivery, TCP transport, content-based filtering, database output, and high performance.

Q7. [Linux] What is the info command?

A: GNU's documentation system, often more detailed than man pages for GNU tools. Navigate with info coreutils for detailed documentation.

Q8. [Linux] What are the common TCP socket states?

A: LISTEN, SYN_SENT, SYN_RECV, ESTABLISHED, FIN_WAIT1, FIN_WAIT2, CLOSE_WAIT, TIME_WAIT, LAST_ACK, CLOSING, CLOSED.

Q9. [Linux] What is the Linux kernel mailing list (LKML)?

A: The primary communication channel for Linux kernel development, hosted at lkml.org. It receives hundreds of messages daily covering patches, reviews, and discussions.

Q10. [Python] What is __iadd__?

A: The in-place add method, called by +=. For mutable objects (like lists), it modifies in-place. For immutable objects (like tuples), it creates a new object.


Batch 2

Q11. [Python] What is the difference between exec() and eval()?

A: eval() evaluates a single expression and returns its value. exec() executes arbitrary statements but always returns None.

Q12. [Linux] What is screen used for?

A: A terminal multiplexer that allows running multiple virtual terminals within one session, detaching and reattaching sessions, and keeping processes alive after disconnection.

Q13. [Python] What happens when you add two Counter objects together?

A: Their counts are summed element-wise. Subtraction (-) subtracts counts and drops zero/negative results. The & operator gives element-wise minimums (intersection) and | gives maximums (union).

Q14. [Ansible] How many employees did Ansible, Inc. have at the time of the Red Hat acquisition?

A: Approximately 50 employees worldwide, headquartered in Durham, North Carolina.

Q15. [Ansible] Name five notable callback plugins.

A: (1) default -- the standard verbose output; (2) minimal -- super-brief output (task name + result); (3) json -- JSON-formatted output for machine parsing; (4) yaml -- YAML-formatted output; (5) timer/profile_tasks -- displays per-task and total execution timing.

Q16. [Linux] What is a systemd timer?

A: A unit type (.timer) that triggers activation of an associated .service unit on a schedule. Advantages over cron: dependency management, logging via journal, resource control, and persistent timers.

Q17. [Ansible] What is an Ansible Execution Environment (EE)?

A: An EE is an OCI-compliant container image that serves as a portable, reproducible Ansible control node. It packages ansible-core, Python dependencies, system libraries, and Ansible collections into a single container image, eliminating "works on my machine" inconsistencies.

Q18. [Python] What function in heapq merges multiple sorted inputs into a single sorted output?

A: heapq.merge(*iterables). It returns a lazy iterator, making it memory-efficient for merging sorted streams.

Q19. [Linux] What does mpstat show?

A: Per-CPU statistics including user, system, iowait, soft IRQ, steal, and idle percentages. mpstat -P ALL 1 shows all CPUs every second.

Q20. [Python] What is math.factorial() used for?

A: Computing factorials: math.factorial(5) returns 120. It raises ValueError for negative numbers.


Batch 3

Q21. [Ansible] What is the ansible_managed variable?

A: A special variable that expands to a string (configurable in ansible.cfg) containing metadata about the Ansible template. Default: "Ansible managed". Commonly placed in template file headers to warn humans not to edit managed files.

Q22. [Python] What is the wheel format?

A: A built distribution format (.whl files) introduced by PEP 427. Wheels are pre-built and install faster than source distributions because they don't require a build step.

Q23. [Python] What does re.split(pattern, string) do differently from str.split()?

A: re.split() splits on a regex pattern. If the pattern contains capturing groups, the matched separators are included in the result list.

Q24. [Ansible] What is gather_subset for?

A: Limits which categories of facts are collected: hardware, network, virtual, ohai, facter, all, min, or negated with ! (e.g., !hardware).

Q25. [Python] What does SciPy provide that NumPy does not?

A: Higher-level scientific computing algorithms: optimization, integration, interpolation, signal processing, linear algebra decompositions, sparse matrices, spatial data structures, and statistics.

Q26. [Ansible] What is inventory_hostname_short?

A: The first part of inventory_hostname before the first dot. For example, if inventory_hostname is "web01.example.com", then inventory_hostname_short is "web01".

Q27. [Linux] What is kernel preemption?

A: The ability of the kernel to interrupt a currently running kernel-mode task to schedule a higher-priority task. Controlled by CONFIG_PREEMPT (full), CONFIG_PREEMPT_VOLUNTARY, or CONFIG_PREEMPT_NONE.

Q28. [Python] What is the linecache module?

A: It reads lines from Python source files, with caching. Used internally by the traceback module to display source lines in tracebacks.

Q29. [Ansible] What is the default Ansible Galaxy server URL?

A: https://galaxy.ansible.com

Q30. [Python] What does itertools.pairwise() return for an empty or single-element iterable?

A: An empty iterator — there are no pairs to form.


Batch 4

Q31. [Ansible] Name some built-in callback plugins.

A: default (standard output), minimal, json, yaml, debug, timer, profile_tasks, profile_roles, log_plays, mail, slack, splunk, grafana_annotations, cgroup_perf_recap.

Q32. [Linux] What is the difference between multicast, broadcast, and unicast?

A: Unicast: one-to-one communication. Broadcast: one-to-all on a network segment (e.g., 255.255.255.255). Multicast: one-to-many for subscribed receivers (224.0.0.0/4).

Q33. [Python] What is the epoch in Python's time module?

A: January 1, 1970, 00:00:00 UTC on most systems. time.time() returns seconds since the epoch.

Q34. [Ansible] What is ansible_version?

A: A dictionary containing Ansible version information, including 'full' (e.g., "2.16.0"), 'major', 'minor', and 'revision' keys.

Q35. [Linux] What is process accounting in Linux?

A: The psacct/acct package records process creation, CPU time, and memory usage. lastcomm shows recently executed commands. sa summarizes accounting data. Useful for auditing and capacity planning.

Q36. [Linux] What is the difference between a pipe and a socket?

A: Pipes (|) are unidirectional (one writer, one reader) and work between related processes. Sockets are bidirectional, support networking (TCP/UDP), and can connect unrelated processes across machines.

Q37. [Ansible] What is ansible.builtin.apt_key and why is it deprecated?

A: It managed APT repository GPG keys. Deprecated because modern apt recommends storing keys in /etc/apt/keyrings/ and referencing them with signed-by in sources.

Q38. [Python] What is the global keyword used for?

A: It declares that a variable inside a function refers to the global (module-level) scope, allowing it to be read and modified.

Q39. [Ansible] How do you edit an encrypted file?

A: ansible-vault edit secrets.yml

Q40. [Ansible] What is a playbook import_playbook?

A: Imports another entire playbook into the current one, allowing playbook composition.


Batch 5

Q41. [Ansible] How do you handle external secret lookups?

A: Use lookup plugins for cloud secret managers (aws_ssm, hashi_vault), or integrate with HashiCorp Vault, AWS Secrets Manager, etc. ---

Q42. [Python] What is unittest.mock.MagicMock?

A: A mock object that implements most magic methods automatically. It records calls and allows you to set return values and assert how it was used.

Q43. [Linux] What is an epoch timestamp?

A: The number of seconds since January 1, 1970 00:00:00 UTC (Unix epoch). Used internally by Linux for timestamps. Convert with date -d @1711411200.

Q44. [Linux] What is the TERM variable?

A: Identifies the terminal type (e.g., xterm-256color, screen, linux). Applications use it to determine terminal capabilities via terminfo/termcap.

Q45. [Ansible] Can serial accept a list? What does that do?

A: Yes. serial: [1, 5, "20%"] runs the first batch with 1 host, the second with 5, then subsequent batches with 20% of remaining hosts. This is the "canary deployment" pattern -- test on one host first, then gradually expand.

Q46. [Linux] What is the difference between SATA, SAS, and NVMe?

A: SATA: consumer-grade, 6 Gbps, uses AHCI protocol, appears as /dev/sd*. SAS: enterprise, 12+ Gbps, also /dev/sd*. NVMe: PCIe-attached SSDs, up to 32 Gbps+, appears as /dev/nvme*, lowest latency.

Q47. [Linux] What is the difference between a raw socket and a regular socket?

A: Regular sockets use TCP or UDP at the transport layer. Raw sockets allow direct access to lower-layer protocols (IP, ICMP), enabling custom packet construction. Requires CAP_NET_RAW capability.

Q48. [Python] What does the re.IGNORECASE (or re.I) flag do?

A: It makes the pattern case-insensitive, matching both uppercase and lowercase letters.

Q49. [Ansible] What file extension does the AWS EC2 inventory plugin expect?

A: Files ending in aws_ec2.yml or aws_ec2.yaml.

Q50. [Ansible] What is Event-Driven Ansible (EDA)?

A: A capability that reacts to events in real-time (monitoring alerts, webhooks, message queues) and triggers automated remediation playbooks immediately.


Batch 6

Q51. [Linux] What are SIGUSR1 and SIGUSR2?

A: Signals 10 and 12 — user-defined signals with no predefined meaning. Applications use them for custom purposes (e.g., log rotation, debug toggling).

Q52. [Python] What is typing.overload used for?

A: Declaring multiple type signatures for a single function, allowing type checkers to determine the return type based on the argument types. The decorated stubs are for type checking only.

Q53. [Ansible] What is the set_stats module?

A: Sets custom statistics that are displayed at the end of a playbook run. Useful for reporting.

Q54. [Ansible] What is the difference between community.docker.docker and community.docker.docker_api connection plugins?

A: docker uses the Docker CLI to execute commands. docker_api connects directly to the Docker daemon API, bypassing the CLI.

Q55. [Python] What is the order of clauses in a try statement?

A: try -> except (zero or more) -> else (optional, runs if no exception) -> finally (optional, always runs). The else block executes only when no exception was raised in try.

Q56. [Linux] What is the difference between uptime load average and CPU utilization?

A: Load average counts all tasks in the run queue (including those waiting for I/O in D state). CPU utilization only measures actual CPU busy time. A system can have high load average but low CPU utilization if many processes are in D state (I/O-bound).

Q57. [Python] What is the secrets.token_urlsafe(nbytes) function?

A: It generates a random URL-safe text string. With nbytes=32, it generates approximately 43 characters. Used for generating secure tokens.

Q58. [Python] What is typing.Required and typing.NotRequired for TypedDict?

A: Added in Python 3.11, they mark individual fields in a TypedDict as required or optional, allowing mixed required/optional fields in a single total=True or total=False TypedDict.

Q59. [Python] What is sys.path and how does Python use it?

A: A list of directories that Python searches when importing modules. It includes the script's directory, PYTHONPATH environment variable entries, and default library paths.

Q60. [Python] What is urllib.parse.urlparse() used for?

A: Parsing a URL into its components: scheme, netloc, path, params, query, and fragment.


Batch 7

Q61. [Python] What is mypy?

A: The original static type checker for Python, created by Jukka Lehtosalo. It checks type annotations without running the code.

Q62. [Python] Who created Django?

A: Adrian Holovaty and Simon Willison at the Lawrence Journal-World, a newspaper in Lawrence, Kansas.

Q63. [Ansible] How do you force handlers to run mid-play?

A: Use the meta: flush_handlers task.

Q64. [Python] What is contextlib.closing() used for?

A: It wraps an object that has a .close() method but does not implement the context manager protocol, ensuring .close() is called when exiting the with block.

Q65. [Python] What file replaced setup.py and setup.cfg as the modern Python project configuration standard?

A: pyproject.toml, standardized by PEP 518 (build system requirements) and PEP 621 (project metadata).

Q66. [Python] What is the json module's cls parameter?

A: It specifies a custom JSONEncoder subclass for serializing objects that are not JSON-serializable by default: json.dumps(obj, cls=CustomEncoder).

Q67. [Ansible] What is playbook_dir?

A: The absolute path to the directory containing the playbook that was originally invoked by ansible-playbook.

Q68. [Linux] What is SELinux?

A: Security-Enhanced Linux — a Mandatory Access Control (MAC) system developed by the NSA and Red Hat. It enforces security policies beyond traditional DAC (discretionary access control), labeling every process, file, and resource with a security context.

Q69. [Python] What does itertools.product('AB', '12') yield?

A: The Cartesian product: ('A','1'), ('A','2'), ('B','1'), ('B','2'). It is equivalent to nested for loops.

Q70. [Python] What is statistics.NormalDist used for?

A: Added in Python 3.8, it represents a normal (Gaussian) distribution and provides methods for CDF, PDF, quantiles, overlap with other distributions, and more.


Batch 8

Q71. [Linux] What is the D (uninterruptible sleep) state, and why can't you kill processes in it?

A: A process in D state is waiting for I/O completion (e.g., disk, NFS). It cannot be interrupted by signals (not even SIGKILL) because doing so could corrupt kernel data structures. It will exit D state when the I/O completes.

Q72. [Python] Why was reduce moved from builtins to functools in Python 3?

A: Guido van Rossum argued that reduce() is confusing and rarely needed. He preferred explicit loops for clarity. It was moved to functools to discourage casual use.

Q73. [Linux] What is the difference between kernel space and user space?

A: Kernel space runs with full hardware access (ring 0 on x86), while user space runs with restricted privileges (ring 3). Transitions between them happen via system calls, which are the defined interface between user programs and the kernel.

Q74. [Ansible] What module tests if a file exists on a remote host?

A: stat module -- returns file information including whether it exists.

Q75. [Python] What is the time complexity of in for lists vs sets?

A: O(n) for lists (linear scan), O(1) average for sets (hash lookup).

Q76. [Linux] What was the first Linux distribution?

A: MCC Interim Linux (Manchester Computing Centre), released in February 1992, was arguably the first. SLS (Softlanding Linux System) in 1992 was the first widely used distribution. Slackware and Debian both appeared in 1993.

Q77. [Linux] What is the make menuconfig command?

A: An ncurses-based interface for configuring Linux kernel build options. Generates a .config file that controls which features and drivers are compiled.

Q78. [Ansible] How do you create an encrypted file?

A: ansible-vault create secrets.yml

Q79. [Python] What does sys.platform return?

A: 'linux' on Linux, 'darwin' on macOS, 'win32' on Windows.

Q80. [Ansible] What is ansible-navigator?

A: A CLI tool that provides a cleaner interface for interacting with Execution Environments, replacing ansible-playbook for containerized execution.


Batch 9

Q81. [Linux] What is the difference between dracut and mkinitcpio?

A: dracut is used by RHEL/Fedora to generate initramfs images using a modular, event-driven approach. mkinitcpio is Arch Linux's tool with a hook-based system. Both produce initramfs cpio archives.

Q82. [Linux] What is the purpose of /sys?

A: Virtual filesystem (sysfs) exporting kernel object information about devices, drivers, and buses as a structured hierarchy.

Q83. [Python] What is sys.maxsize?

A: The largest positive integer supported by the platform's Py_ssize_t type (typically 2^63 - 1 on 64-bit). It is NOT the maximum integer Python can handle, but is the maximum size for containers.

Q84. [Python] What is Python's match statement mapping pattern?

A: case {"status": 200, "body": body}: matches dictionaries with specific keys and captures values. Extra keys are allowed.

Q85. [Linux] What is the kernel ring buffer?

A: A fixed-size buffer in kernel memory that stores kernel log messages, accessible via dmesg. It contains boot messages, driver initialization output, and runtime kernel messages.

Q86. [Python] What does sorted() guarantee about equal elements?

A: The sort is stable — elements that compare equal retain their original relative order.

Q87. [Linux] What is libvirt?

A: A toolkit providing a common API for managing virtualization platforms (KVM/QEMU, Xen, etc.). The virsh CLI and virt-manager GUI use libvirt.

Q88. [Ansible] What is import_role vs include_role?

A: import_role statically includes the role at parse time (tags and conditions propagate). include_role dynamically includes it at runtime (more flexible but tags don't propagate the same way). ---

Q89. [Ansible] What are the special tags always and never?

A: Tasks tagged always run even when --tags is specified (unless explicitly skipped with --skip-tags always). Tasks tagged never only run when explicitly requested with --tags never.

Q90. [Linux] What does set -e do?

A: Causes the script to exit immediately when any command returns a non-zero exit code (with some exceptions like conditions in if statements).


Batch 10

Q91. [Linux] What files does a Bash login shell source?

A: First /etc/profile, then the first found of ~/.bash_profile, ~/.bash_login, or ~/.profile (only one). On logout: ~/.bash_logout.

Q92. [Python] What is a PEP 517 build backend?

A: A system that builds Python packages according to the standard defined in PEP 517. Examples include setuptools, flit-core, hatchling, and maturin.

Q93. [Linux] What is ext4?

A: The fourth extended filesystem — supports volumes up to 1 exabyte, files up to 16TB, extents-based allocation, delayed allocation, journal checksumming, and online defragmentation. Backward compatible with ext2/ext3.

Q94. [Python] Can a tuple be a dictionary key?

A: Only if all its elements are hashable. (1, 2, 3) can be a key, but (1, [2, 3]) cannot because lists are unhashable.

Q95. [Linux] What is SIGALRM?

A: Signal 14, sent when a timer set by alarm() expires. Used for implementing timeouts.

Q96. [Linux] What are SELinux booleans?

A: Runtime toggles that modify SELinux policy without recompiling. Example: setsebool -P httpd_can_network_connect on allows Apache to make network connections. List with getsebool -a.

Q97. [Linux] What is the setuid bit?

A: When set on an executable (octal 4000, chmod u+s), the process runs with the file owner's effective UID instead of the caller's. Example: /usr/bin/passwd runs as root to modify /etc/shadow.

Q98. [Ansible] What does the Constructable base class provide to inventory plugins?

A: The ability to create host variables and groups from Jinja2 expressions using compose, keyed_groups, and groups options -- without writing custom code.

Q99. [Python] What is dir() used for?

A: It returns a list of names in the current scope (no argument) or a list of valid attributes for an object. It calls __dir__() if defined.

Q100. [Ansible] Where do set_fact and registered vars fall in precedence?

A: Level 19 -- above include_vars, task vars, block vars, role vars, play vars_files, play vars_prompt, play vars, and all inventory variables. Below role parameters, include parameters, and extra-vars.


Batch 11

Q101. [Python] What is the late binding closures gotcha?

A: Closures capture variables by reference, not value. In a loop for i in range(3): funcs.append(lambda: i), all lambdas return 2 (the final value of i). Fix with default arguments: lambda i=i: i.

Q102. [Linux] What is a kprobe?

A: A kernel debugging mechanism that allows inserting breakpoints at virtually any kernel function. When the probed instruction executes, a registered handler runs. Used for dynamic tracing without recompilation.

Q103. [Linux] How do you set a capability on a file?

A: setcap cap_net_bind_service+ep /usr/bin/myapp — grants the binary the ability to bind to ports below 1024 without root. getcap /usr/bin/myapp verifies.

Q104. [Python] What does functools.wraps do?

A: It is a decorator for wrapper functions that copies metadata (like __name__, __doc__, __module__, __qualname__, __annotations__, and __dict__) from the wrapped function to the wrapper, preserving introspection.

Q105. [Ansible] What is AWX, and how does it relate to Ansible Tower/Automation Controller?

A: AWX is the upstream open-source project for Automation Controller (formerly Tower). It provides a web UI, REST API, RBAC, job scheduling, and credential management. Tower/Controller is the enterprise-supported derivative with additional features like SLA support, ISV compatibility guarantees, and supported upgrade paths.

Q106. [Linux] What is /proc/PID/fd/?

A: A directory containing symbolic links for each open file descriptor of the process. ls -la /proc/PID/fd/ shows what files, sockets, and pipes a process has open.

Q107. [Ansible] What does ansible-config do?

A: Shows current configuration, dumps all settings, or validates configuration files.

Q108. [Ansible] What is the "idempotence" test phase in Molecule?

A: Molecule runs the converge playbook a second time and checks that zero tasks report "changed." If any task reports changed on the second run, the idempotence test fails -- indicating the role is not properly idempotent.

Q109. [Python] Who wrote The Zen of Python?

A: Tim Peters, a major early contributor to Python and author of the Timsort algorithm.

Q110. [Ansible] How do you reference vault-encrypted variables in a playbook?

A: Include the encrypted file with vars_files: - secrets.yml and reference variables normally with {{ variable_name }}. ---


Batch 12

Q111. [Ansible] What is an Ansible inventory?

A: A file or script that defines the list of managed hosts (machines) that Ansible targets. It organizes systems into groups for task targeting.

Q112. [Ansible] What is the debug strategy?

A: A strategy plugin that enables interactive task-by-task debugging, allowing you to step through playbook execution. ---

Q113. [Linux] What is the purpose of the alternatives system?

A: Manages symbolic links for choosing between multiple versions of a command (e.g., java, python, editor). alternatives --config java on RHEL or update-alternatives --config java on Debian.

Q114. [Python] What is the peephole optimizer in CPython?

A: A bytecode optimizer that performs simple optimizations like constant folding (1 + 2 becomes 3), dead code elimination, and converting operations to more efficient forms.

Q115. [Python] What does math.prod() do, and when was it added?

A: Added in Python 3.8, it computes the product of all elements in an iterable: math.prod([1, 2, 3, 4]) returns 24. It is the multiplication equivalent of sum().

Q116. [Ansible] What does ansible-inventory do?

A: Displays or dumps the configured inventory in JSON or YAML format.

Q117. [Linux] What are file descriptors 0, 1, and 2?

A: 0 = stdin (standard input), 1 = stdout (standard output), 2 = stderr (standard error). Every process inherits these three FDs.

Q118. [Ansible] Where is the default inventory file located?

A: /etc/ansible/hosts

Q119. [Ansible] What module gathers facts by default at the start of each play?

A: ansible.builtin.setup (called automatically by gather_facts: true).

Q120. [Ansible] What is the default reboot timeout?

A: 600 seconds (10 minutes). Can be changed with reboot_timeout.


Batch 13

Q121. [Linux] How do you change the I/O scheduler for a block device?

A: echo mq-deadline > /sys/block/sda/queue/scheduler. Check current scheduler: cat /sys/block/sda/queue/scheduler (active one shown in brackets).

Q122. [Ansible] What is the default connection plugin in Ansible?

A: ssh (using OpenSSH). Prior to Ansible 2.0, paramiko was the default.

Q123. [Linux] What is the SHELL variable?

A: The path to the user's default login shell, as specified in /etc/passwd.

Q124. [Ansible] What does no_log: true do, and how does it relate to Vault?

A: no_log: true prevents a task's input/output from being logged or displayed. This is critical for tasks that handle decrypted secrets -- Vault protects data at rest, but no_log protects data during execution output.

Q125. [Ansible] What filter would you use to base64-encode a string in Ansible?

A: {{ my_string | b64encode }} to encode, {{ my_string | b64decode }} to decode.

Q126. [Linux] Who is the creator of MINIX 3?

A: Andrew S. Tanenbaum. MINIX 3 is a microkernel-based OS designed for reliability. Intel's Management Engine runs a modified MINIX 3, meaning MINIX may be the most widely deployed OS by unit count.

Q127. [Python] What is the antigravity module's geohash feature?

A: antigravity.geohash(lat, lon, date) generates a random location using the XKCD geohashing algorithm (comic #426). It was added as a secondary Easter egg.

Q128. [Linux] What is the logger command?

A: Sends messages to the system log from the command line or scripts: logger -p local0.warning "Disk usage high". Useful for integrating custom scripts with the centralized logging infrastructure.

Q129. [Python] What is __all__ used for in a module?

A: It defines the public API — the list of names exported when someone does from module import *. If not defined, all names not starting with underscore are exported.

Q130. [Linux] What is Upstart?

A: An event-based init system developed by Canonical for Ubuntu (2006-2015). Replaced by systemd in Ubuntu 15.04. It used .conf files in /etc/init/ and supported event-driven service management.


Batch 14

Q131. [Python] What is the Ellipsis object (...) used for in Python?

A: As a placeholder in stubs/protocols (def method(self) -> None: ...), in NumPy for advanced slicing (array[..., 0]), and in type hints (tuple[int, ...] for variable-length tuples).

Q132. [Linux] What is CAP_SYS_ADMIN?

A: The "new root" capability — a catch-all granting many administrative operations (mounting filesystems, setting hostname, loading kernel modules). Should be avoided when possible.

Q133. [Ansible] What does the safety lint profile add?

A: Rules that avoid non-determinant outcomes or security concerns: avoid-implicit, latest, package-latest, risky-file-permissions, risky-octal, risky-shell-pipe.

Q134. [Linux] What does "wget" stand for?

A: "Web GET" — a non-interactive network downloader.

Q135. [Ansible] What is the gathered state in network resource modules?

A: It retrieves the current configuration from the device and returns it as structured data without making any changes.

Q136. [Ansible] What year did Ansible 2.0 introduce the new execution engine?

A: January 2016.

Q137. [Ansible] What is the complete Ansible variable precedence order (lowest to highest)?

A: 1) command line values (e.g., -u user), 2) role defaults, 3) inventory file/script group vars, 4) inventory group_vars/all, 5) playbook group_vars/all, 6) inventory group_vars/, 7) playbook group_vars/, 8) inventory file/script host vars, 9) inventory host_vars/, 10) playbook host_vars/, 11) host facts / cached set_facts, 12) play vars, 13) play vars_prompt, 14) play vars_files, 15) role vars (role/vars/main.yml), 16) block vars, 17) task vars, 18) include_vars, 19) set_facts / registered vars, 20) role/include_role params, 21) include params, 22) extra vars (-e) -- highest priority and always win.

Q138. [Ansible] How do you securely manage control node credentials?

A: Use SSH key agents, keep credentials out of playbooks, use Ansible Vault for encryption, set no_log: true for sensitive tasks, and limit control node access.

Q139. [Ansible] What is the block keyword?

A: Groups multiple tasks together as a single logical unit. Allows applying common attributes (like when, become) and error handling to the group.

Q140. [Python] What does functools.total_ordering require you to define?

A: You must define __eq__ and one of the other comparison methods (__lt__, __le__, __gt__, or __ge__). The decorator fills in the rest.


Batch 15

Q141. [Ansible] How do you create a custom Jinja2 filter for Ansible?

A: Create a Python file in a filter_plugins/ directory relative to your playbook or role, or in a path specified by ANSIBLE_FILTER_PLUGINS. Define a class with a filters() method that returns a dictionary mapping filter names to Python functions.

Q142. [Linux] What does $? contain?

A: The exit status of the most recently executed foreground command. 0 = success, non-zero = failure.

Q143. [Python] What does itertools.islice() do?

A: It slices an iterator lazily, similar to sequence slicing but works on any iterable and doesn't support negative indices. islice(iterable, stop) or islice(iterable, start, stop, step).

Q144. [Ansible] What is a rolling update strategy?

A: Using serial to update hosts in batches, draining servers from load balancers before updating, performing health checks after each batch, and using block/rescue for rollback.

Q145. [Linux] How do you send a message to syslog from the command line?

A: logger -p local0.info "My log message". The -t flag sets a tag, -p sets facility.priority.

Q146. [Ansible] What does ansible_check_mode contain?

A: A boolean (True/False) indicating whether the current playbook run is in check mode (--check). Useful for conditionally skipping tasks that don't support check mode.

Q147. [Linux] What does fs.file-max control?

A: The system-wide maximum number of open file descriptors. Check current usage with cat /proc/sys/fs/file-nr (allocated, free, max).

Q148. [Linux] What is the difference between NTP and chrony?

A: NTP (ntpd) is the classic time synchronization daemon. chrony (chronyd) is the modern replacement — faster synchronization, better for intermittent connections, handles large clock jumps, and is the default on RHEL/Fedora.

Q149. [Linux] What does readlink -f do?

A: Resolves a symbolic link to its absolute canonical path, following all intermediate symlinks. Useful in scripts to find the real location of a file.

Q150. [Linux] What happens when you delete the target of a symbolic link?

A: The symlink becomes a "dangling" or "broken" link. Accessing it returns ENOENT (No such file or directory).


Batch 16

Q151. [Python] What is sys.maxsize?

A: The largest positive integer supported by the platform's Py_ssize_t type (typically 2^63 - 1 on 64-bit). It limits container sizes, not integer values.

Q152. [Ansible] What are the five reserved tag names in Ansible?

A: always, never, tagged, untagged, and all.

Q153. [Ansible] Why is YAML 1.2 relevant to Ansible's future?

A: YAML 1.2 drops the boolean interpretation of yes/no/on/off (only true/false are booleans) and changes octal syntax from 0777 to 0o777. If Ansible ever migrates from PyYAML (YAML 1.1) to a YAML 1.2 parser, many playbooks using yes/no values would break. ---

Q154. [Linux] What is the maximum size of a TCP window?

A: 65,535 bytes with the standard 16-bit window field. TCP window scaling (RFC 1323) extends this to over 1GB using a scale factor negotiated in the handshake.

Q155. [Linux] What filesystem does most RHEL/CentOS/Fedora systems use by default?

A: XFS — chosen for its scalability, performance with large files, and support for online growth. RHEL 7+ uses XFS as default.

Q156. [Linux] What does the timeout command do?

A: Runs a command with a time limit: timeout 30s curl http://example.com. Sends SIGTERM (or specified signal) when the time expires. --- ## 22. Comparison & Ecosystem

Q157. [Python] What is the help() built-in?

A: It invokes the interactive help system. help(obj) displays the docstring and other information about the object. It uses the pydoc module internally.

Q158. [Ansible] What are magic variables in Ansible?

A: Special variables automatically set by Ansible: hostvars, groups, group_names, inventory_hostname, ansible_play_hosts, ansible_version, etc.

Q159. [Ansible] What is the namespace.collection format, and why does it matter?

A: Collections use a two-part name: namespace.collection (e.g., ansible.builtin, community.general, amazon.aws). The namespace prevents naming collisions and identifies the maintainer or organization.

Q160. [Ansible] A variable is defined in playbook group_vars/all and also in inventory group_vars/webservers. Which wins?

A: The inventory group_vars/webservers (level 6) wins over playbook group_vars/all (level 5), because specific group vars have higher precedence than "all" group vars, and inventory group vars and playbook group vars of the same type are on the same level but specific groups win over "all."


Batch 17

Q161. [Python] What is the __bool__ method?

A: It defines the truth value of an object. If not defined, Python falls back to __len__ (0 is falsy), then defaults to True.

Q162. [Ansible] What is Event-Driven Ansible (EDA) and when was it introduced?

A: EDA was introduced as a technology preview in AAP 2.3 (2023) and became generally available in AAP 2.4. It allows automation to be triggered by events from external sources (monitoring tools, webhooks, ServiceNow, GitHub/GitLab) using rulebooks that define conditions and actions.

Q163. [Ansible] What is the shared lint profile intended for?

A: Content creators publishing to galaxy.ansible.com, automation-hub, or private instances. It adds rules like ignore-errors, no-changed-when, no-handler, meta-incorrect, and meta-no-tags.

Q164. [Linux] What is the clone() system call?

A: A more flexible version of fork() that allows fine-grained sharing of resources (memory, file descriptors, signal handlers, namespaces) between parent and child. It is the underlying syscall for creating both processes and threads.

Q165. [Python] What does dis.dis() do?

A: It disassembles Python bytecode, showing the low-level instructions that CPython executes. Useful for understanding performance and how Python compiles your code.

Q166. [Ansible] What does state: absent mean in a module?

A: Ensures the resource does NOT exist (e.g., a package is removed, a user is deleted).

Q167. [Python] What does id() return?

A: The identity of an object — an integer guaranteed to be unique for that object during its lifetime. In CPython, it is the memory address.

Q168. [Python] Can f-strings contain the backslash character?

A: Before Python 3.12, f-string expressions could not contain backslashes. In Python 3.12+, this restriction was lifted and backslashes are allowed in f-string expressions.

Q169. [Linux] What is systemd-tmpfiles?

A: Manages creation, deletion, and cleanup of temporary and volatile files. Configuration in /etc/tmpfiles.d/ and /usr/lib/tmpfiles.d/. Runs at boot via systemd-tmpfiles-setup.service.

Q170. [Python] What does __hash__ need to be consistent with?

A: __eq__. Objects that compare equal must have the same hash. If you define __eq__, Python sets __hash__ to None (making instances unhashable) unless you also define __hash__.


Batch 18

Q171. [Python] What is the subprocess.PIPE constant?

A: It indicates that a pipe should be created for stdin, stdout, or stderr, allowing the parent process to communicate with the child process.

Q172. [Python] What is __add__ vs __radd__?

A: __add__ handles self + other. __radd__ (reflected add) handles other + self when the left operand's __add__ returns NotImplemented.

Q173. [Python] Why should you never use shell=True with subprocess when handling user input?

A: It enables shell injection attacks. User input could contain shell metacharacters that execute arbitrary commands. Always pass arguments as a list instead.

Q174. [Ansible] What are lookup plugins?

A: Retrieve data from external sources. Examples: file, env, password, aws_ssm, pipe.

Q175. [Python] What does contextlib.suppress() do?

A: It is a context manager that suppresses specified exceptions. For example, with contextlib.suppress(FileNotFoundError): os.remove('file') silently ignores the error if the file doesn't exist.

Q176. [Ansible] What is a requirements.yml file for Galaxy?

A: A YAML file listing roles and/or collections with optional version constraints to install. Example: yaml collections: - name: community.general version: ">=5.0.0,<6.0.0" roles: - name: geerlingguy.docker ---

Q177. [Python] What is poetry?

A: A Python dependency management and packaging tool that uses pyproject.toml, provides deterministic builds via a lock file, and manages virtual environments.

Q178. [Linux] What is /proc/PID/maps?

A: Shows the virtual memory mappings of a process — address ranges, permissions, offsets, device, inode, and mapped file paths. Useful for understanding a process's memory layout.

Q179. [Linux] What is virt-install?

A: A command-line tool for creating KVM virtual machines. Defines CPU, memory, disk, network, and installation source in a single command. Part of the virt-manager package.

Q180. [Linux] What does the nice command do?

A: Sets the scheduling priority of a process. Nice values range from -20 (highest priority) to 19 (lowest priority). Default is 0. Only root can set negative nice values.


Batch 19

Q181. [Linux] What is the w command's JCPU and PCPU columns?

A: JCPU: total CPU time used by all processes attached to the user's tty. PCPU: CPU time of the current process shown in the WHAT column.

Q182. [Linux] What is the BSD license?

A: A permissive license allowing redistribution in source or binary form with minimal restrictions (attribution required). Unlike GPL, it does not require derivative works to be open source.

Q183. [Ansible] What is the expect module?

A: Handles interactive command prompts by providing automated responses (requires pexpect library).

Q184. [Python] What is the __prepare__ method in metaclasses?

A: A classmethod on the metaclass that returns the namespace dict to use during class body execution. It allows custom namespace objects (like OrderedDict) for tracking definition order.

Q185. [Linux] What is the difference between nohup and disown?

A: nohup runs a command immune to SIGHUP with output redirected to nohup.out (used at launch). disown removes an already-running background job from the shell's job table so it won't receive SIGHUP when the shell exits.

Q186. [Ansible] What does the combine filter do?

A: Merges two or more dictionaries: {{ dict1 | combine(dict2) }}. Later dictionaries override earlier ones for duplicate keys.

Q187. [Python] Why is the language called "Python"?

A: Guido van Rossum named it after "Monty Python's Flying Circus," the British comedy group, not the snake.

Q188. [Ansible] What does wantlist=True do in a lookup?

A: Forces the lookup to return a list instead of a comma-separated string. lookup('file', '/etc/hosts', wantlist=True) is equivalent to query('file', '/etc/hosts'). ---

Q189. [Linux] What is a firewalld rich rule?

A: A complex firewall rule with specific match criteria. Example: firewall-cmd --add-rich-rule='rule family=ipv4 source address=10.0.0.0/8 port port=8080 protocol=tcp accept' --permanent.

Q190. [Linux] What is the difference between DHCP and static IP configuration?

A: DHCP dynamically assigns IP addresses, subnet mask, gateway, and DNS from a server. Static IP is manually configured and does not change. Servers typically use static IPs; workstations use DHCP.


Batch 20

Q191. [Linux] What is a reverse DNS lookup?

A: Resolving an IP address to a hostname (opposite of normal DNS). Uses PTR records in the in-addr.arpa domain. Commonly used for email verification and logging.

Q192. [Ansible] Where does the Steering Committee conduct business?

A: Primarily on the Ansible Forum (forum.ansible.com) for asynchronous discussions and voting on proposals. Regular Community Working Group meetings are also held.

Q193. [Linux] What is an I/O scheduler?

A: Kernel component that orders and merges block I/O requests for optimal disk performance. Modern options: mq-deadline (good for SSDs and HDDs), bfq (fairness-oriented), none/noop (no reordering, best for NVMe).

Q194. [Ansible] What is the search order for ansible.cfg?

A: (1) ANSIBLE_CONFIG environment variable, (2) ./ansible.cfg in the current directory, (3) ~/.ansible.cfg in the home directory, (4) /etc/ansible/ansible.cfg.

Q195. [Linux] How do you persist journald logs across reboots?

A: Create /var/log/journal/ directory: mkdir -p /var/log/journal && systemd-tmpfiles --create --prefix /var/log/journal. Or set Storage=persistent in /etc/systemd/journald.conf.

Q196. [Python] What does copy.deepcopy() do differently from copy.copy()?

A: copy() creates a shallow copy (new container but same references to contained objects). deepcopy() recursively copies all contained objects, creating fully independent copies.

Q197. [Ansible] What does group_names contain?

A: A list of all groups the current host belongs to. It always reflects the inventory_hostname and is not affected by delegation.

Q198. [Linux] What does OnCalendar= do in a systemd timer?

A: Specifies a calendar-based schedule: OnCalendar=*-*-* 02:00:00 (daily at 2 AM), OnCalendar=Mon *-*-* 09:00:00 (Mondays at 9 AM), OnCalendar=hourly.

Q199. [Ansible] What does the password_hash filter do?

A: Generates hashed passwords suitable for the user module: {{ 'password' | password_hash('sha512', 'salt') }}

Q200. [Python] What is the select module?

A: It provides I/O multiplexing: monitoring multiple file descriptors for readability/writability. It wraps select(), poll(), and epoll() system calls.


Batch 21

Q201. [Python] Why must arguments to an lru_cache-decorated function be hashable?

A: Because the cache uses a dictionary internally, and dictionary keys must be hashable. Passing unhashable arguments like lists will raise a TypeError.

Q202. [Linux] What is an ACL in Linux?

A: Access Control List — extends the traditional user/group/other permission model to allow fine-grained permissions for specific users and groups on individual files. Managed with getfacl and setfacl.

Q203. [Python] What is a parameterized decorator?

A: A decorator that takes arguments: @retry(max_attempts=3). It is implemented as a function that returns a decorator, creating a three-level nesting pattern (decorator factory -> decorator -> wrapper).

Q204. [Python] Is OrderedDict still useful now that regular dicts maintain insertion order (since Python 3.7)?

A: Yes. OrderedDict supports move_to_end(), equality comparisons consider order (unlike regular dicts), and it has a different __eq__ behavior: two OrderedDicts with the same items in different order are not equal, while two regular dicts would be.

Q205. [Linux] What is /proc/PID/oom_score?

A: The current OOM killer score (0-1000) for a process. Higher means more likely to be killed when memory is critically low. Based on memory usage, oom_score_adj, and other factors.

Q206. [Linux] What does ${var#pattern} do?

A: Removes the shortest match of pattern from the beginning of $var. ${var##pattern} removes the longest match. Used for prefix stripping (e.g., ${path##*/} extracts the filename).

Q207. [Ansible] What is group_by module?

A: Dynamically creates groups during playbook execution based on facts or variables: group_by: key=os_{{ ansible_distribution }}.

Q208. [Ansible] Who created Ansible and when?

A: Michael DeHaan created Ansible in February 2012. He had previously created Cobbler (a provisioning tool) and Func (a remote command framework).

Q209. [Python] What is the types module?

A: It provides access to special type objects like FunctionType, MethodType, ModuleType, GeneratorType, and SimpleNamespace.

Q210. [Linux] What was Log4Shell?

A: CVE-2021-44228 — a critical RCE vulnerability in Apache Log4j 2 (a Java logging library) that allowed attackers to execute arbitrary code via crafted log messages containing JNDI lookups. While not a Linux bug per se, it devastated Linux-hosted Java services.


Batch 22

Q211. [Python] What does re.subn() return differently from re.sub()?

A: re.subn() returns a tuple (new_string, number_of_substitutions_made), while re.sub() returns just the new string.

Q212. [Ansible] What is the ansible.builtin.reboot module?

A: Reboots the remote host and waits for it to come back. Handles the connection drop and reconnection automatically.

Q213. [Ansible] What is the etymology of the word "ansible"?

A: It is a contraction of "answerable" -- reflecting the device's ability to deliver responses across interstellar distances in reasonable time.

Q214. [Linux] What is port 53 used for?

A: DNS (Domain Name System) — uses both TCP and UDP. UDP for queries under 512 bytes; TCP for zone transfers and large responses.

Q215. [Linux] What is the key difference between cgroups v1 and v2?

A: v1 has separate hierarchies per resource controller (cpu, memory, blkio, etc.). v2 has a single unified hierarchy where all controllers are managed together, simplifying configuration and avoiding inconsistencies.

Q216. [Linux] Where does the name "grep" come from?

A: From the ed editor command g/re/p — "global / regular expression / print."

Q217. [Ansible] What is the maximum recommended inventory size for a single Ansible control node?

A: There is no hard limit, but practical performance degrades beyond several thousand hosts without tuning (increasing forks, enabling pipelining, using fact caching, using pull mode or AWX/Controller for very large fleets).

Q218. [Ansible] You have a slow playbook on 500 hosts. What do you investigate first?

A: Enable SSH pipelining, increase forks, configure fact caching, check for unnecessary gather_facts, optimize slow tasks, consider async for long-running operations.

Q219. [Linux] What is swappiness and what's a good value for servers?

A: vm.swappiness controls the kernel's tendency to swap. Default is 60. For database servers: 1-10 (minimize swapping). For desktop: 60 (responsive). Value 0 doesn't disable swap; it just makes the kernel prefer dropping cache over swapping.

Q220. [Ansible] What is the Ansible equivalent of try/catch/finally?

A: block/rescue/always. block contains the tasks to try, rescue runs if block fails, always runs regardless.


Batch 23

Q221. [Python] What is broadcasting in NumPy?

A: A set of rules that allows NumPy to perform operations on arrays of different shapes by automatically expanding the smaller array.

Q222. [Python] What is a negative lookahead?

A: (?!...) asserts that what follows does NOT match the pattern. For example, foo(?!bar) matches foo only if NOT followed by bar.

Q223. [Ansible] What is the ansible.builtin.debug module's var vs msg parameter?

A: var prints a variable's value (auto-evaluated, no Jinja2 braces needed). msg prints a formatted message string (supports Jinja2 expressions in braces).

Q224. [Linux] What is the difference between $@ and $*?

A: Unquoted, they are identical. Quoted: "$@" expands to separate words (preserving arguments), "$*" expands to a single word with arguments joined by the first character of IFS. Always use "$@" for passing arguments.

Q225. [Ansible] What does the pipelining setting do?

A: When enabled, Ansible pipes modules directly into the remote Python interpreter via stdin instead of writing temporary files to disk. This reduces SSH round-trips and avoids leaving sensitive data in temp files.

Q226. [Linux] What is nftables advantage over iptables for large rulesets?

A: nftables supports sets, maps, and concatenations that replace hundreds of individual rules with a single rule referencing a set. Dramatically better performance for large rulesets and atomic rule replacement.

Q227. [Python] What does int.to_bytes() do?

A: Converts an integer to a bytes representation. For example, (1024).to_bytes(2, byteorder='big') returns b'\x04\x00'.

Q228. [Linux] What does 2> do?

A: Redirects stderr (file descriptor 2) to a file. 2>/dev/null discards error messages.

Q229. [Ansible] What is the relationship between Jinja2's built-in filters and Ansible's filters?

A: Ansible supports all standard Jinja2 filters (e.g., default, join, length, upper, lower, replace) PLUS Ansible-specific filters (e.g., to_yaml, to_json, from_json, ipaddr, regex_search, vault, combine). Users can also create custom filter plugins.

Q230. [Ansible] How do you test playbooks?

A: Use --syntax-check for syntax, --check for dry runs, ansible-lint for linting, Molecule for role testing, and integration with CI/CD for automated testing.


Batch 24

Q231. [Python] What is Starlette?

A: A lightweight ASGI framework that provides routing, middleware, WebSocket support, and background tasks. FastAPI is built on top of it.

Q232. [Python] What is Typer?

A: A CLI library by Sebastian Ramirez (FastAPI author) built on top of Click that uses Python type hints for argument parsing.

Q233. [Ansible] What is the failed_when: false idiom?

A: Makes a task NEVER fail, regardless of return code or output. The task always succeeds. Often combined with register to capture the result and handle it in subsequent tasks.

Q234. [Ansible] What is Instance Groups in AWX?

A: A way to group execution capacity, allowing specific job templates to run on specific sets of instances for resource isolation or geographic distribution.

Q235. [Ansible] How does the free strategy differ from linear?

A: With free, each host runs through tasks as fast as it can independently, without waiting for other hosts to complete the current task. Fast hosts finish the entire play before slow hosts.

Q236. [Linux] What is /dev/shm?

A: A tmpfs mount for POSIX shared memory. Applications using shm_open() create files here. Commonly used for high-speed inter-process communication.

Q237. [Ansible] When and by whom was Ansible acquired?

A: Red Hat acquired Ansible in October 2015.

Q238. [Linux] What is Cilium?

A: A Kubernetes CNI plugin that uses eBPF for networking, security, and observability. Replaces kube-proxy and iptables with eBPF programs for higher performance and more granular network policies.

Q239. [Linux] What is the difference between the GPL, LGPL, MIT, and Apache licenses?

A: GPL: strong copyleft — derivatives must also be GPL. LGPL: weak copyleft — allows linking with proprietary code. MIT: permissive — do anything with attribution. Apache 2.0: permissive with patent grant. The kernel uses GPLv2.

Q240. [Ansible] What is max_fail_percentage used for?

A: Stops a rolling update if more than the specified percentage of hosts fail, preventing cascading failures.


Batch 25

Q241. [Python] What does str.translate() do?

A: It maps characters using a translation table created by str.maketrans(). It is the fastest way to replace or delete multiple characters at once.

Q242. [Ansible] What does the mandatory filter do?

A: It forces a variable to be defined. If the variable is undefined, the playbook fails with a clear error message instead of silently using an empty value. Usage: {{ my_var | mandatory }}.

Q243. [Linux] What is /proc/version?

A: Contains the kernel version string, compiler version, and build date. Similar to uname -a.

Q244. [Linux] Which BSD variants are actively developed?

A: FreeBSD (servers/storage, powers Netflix CDN), OpenBSD (security-focused, developed OpenSSH), NetBSD (portability, runs on 50+ platforms), DragonFlyBSD (performance, HAMMER filesystem).

Q245. [Python] What major features were added in Python 3.11?

A: Exception groups and except*, asyncio.TaskGroup, tomllib, typing.Self, 10-60% speed improvement, much better error messages with precise locations, StrEnum, and typing.Never.

Q246. [Python] What was the "Python 3000" or "Py3k" initiative?

A: The long-term project to create Python 3, which was known as "Python 3000" during development. The name was a tongue-in-cheek suggestion that it would take until the year 3000 to finish. --- ## 2. Language Fundamentals

Q247. [Linux] What does ${var:?error_message} do?

A: Returns $var if set and non-null, otherwise prints error_message to stderr and exits.

Q248. [Linux] What is seccomp?

A: Secure Computing mode — a kernel feature that restricts the system calls a process can make. Used by containers (Docker, Kubernetes), browsers, and sandboxes to reduce the attack surface. seccomp-bpf allows flexible filtering using BPF programs.

Q249. [Ansible] How do you write a loop in Jinja2?

A: {% for item in list %} {{ item }} {% endfor %}

Q250. [Python] What is type() with one argument vs three arguments?

A: With one argument, type(obj) returns the type of the object. With three arguments, type(name, bases, dict) dynamically creates a new class.


Batch 26

Q251. [Python] What is the decimal module's ROUND_HALF_EVEN rounding mode?

A: Banker's rounding — rounds to the nearest even number when the value is exactly halfway. This is the default rounding mode for Decimal and Python's built-in round().

Q252. [Ansible] What does connection: local do?

A: Executes tasks on the control node itself instead of connecting to a remote host. Used with delegate_to: localhost or for local operations.

Q253. [Linux] What is the difference between kill and killall?

A: kill sends a signal to a specific PID. killall sends a signal to all processes matching a name. pkill matches by pattern (name, user, etc.) and is generally preferred over killall.

Q254. [Linux] What are the four freedoms of the GPL?

A: Freedom 0: run the program; Freedom 1: study and modify source code; Freedom 2: redistribute copies; Freedom 3: distribute modified versions. The GPL's "copyleft" requirement mandates derivative works also be GPL-licensed.

Q255. [Linux] How do you identify which process is consuming the most disk I/O?

A: Use iotop (interactive, shows per-process I/O), pidstat -d 1, or dstat --top-io. Also check /proc/PID/io for cumulative I/O statistics. --- ## 14. Containers & Virtualization

Q256. [Python] What arguments does __exit__ receive?

A: Three arguments: exc_type, exc_val, and exc_tb (exception type, value, and traceback). If no exception occurred, all are None. Returning True suppresses the exception.

Q257. [Python] What does python -m site do?

A: It prints the site-packages paths, user site-packages path, and other configuration details.

Q258. [Python] What is @dataclass an example of in terms of Python internals?

A: A class decorator that uses code generation — it inspects annotations and generates __init__, __repr__, __eq__, and other methods at class definition time.

Q259. [Python] What does int.bit_length() return?

A: The number of bits needed to represent the integer (excluding sign and leading zeros). For example, (255).bit_length() returns 8.

Q260. [Ansible] What major AAP 2.5 feature unified the user experience across components?

A: The Platform Gateway introduced a single unified web UI that consolidates Automation Controller, Automation Hub, and EDA Controller interfaces with centralized authentication and management.


Batch 27

Q261. [Ansible] How does Mitogen achieve its performance gains?

A: Instead of opening a new SSH channel, transferring a module file, executing it, and cleaning up for every task, Mitogen establishes persistent Python interpreters on remote hosts and sends module code through an efficient RPC protocol.

Q262. [Linux] What is the difference between systemd and SysVinit?

A: SysVinit uses sequential shell scripts in /etc/init.d/ and /etc/rc.d/ with numeric runlevels (0-6). systemd uses declarative unit files, parallel startup, dependency management, socket activation, cgroup integration, and journald. systemd boots significantly faster.

Q263. [Linux] What are the three LVM layers?

A: PV (Physical Volume) = a disk or partition. VG (Volume Group) = a pool of PVs. LV (Logical Volume) = a virtual partition carved from a VG, onto which you create a filesystem.

Q264. [Ansible] What is a Molecule scenario?

A: A scenario is a self-contained test suite within a role or collection. Each scenario has its own molecule.yml, converge playbook, and verify playbook. A single role can have multiple scenarios testing different configurations.

Q265. [Linux] What is the difference between tar and gzip?

A: tar is an archiver — bundles multiple files into one. gzip is a compressor — reduces file size. Combined: tar czf archive.tar.gz dir/ creates a compressed archive. tar does not compress by itself.

Q266. [Linux] How do you clean up zombie processes?

A: You cannot kill a zombie — it is already dead. You must signal the parent to call wait() (e.g., kill -SIGCHLD <parent_pid>). If the parent is unresponsive, killing the parent causes init to adopt and reap the zombies.

Q267. [Ansible] What does the min lint profile enforce?

A: Only rules that prevent fatal errors: internal-error, load-failure, parser-error, syntax-check.

Q268. [Ansible] What does meta/main.yml in a role contain?

A: Role metadata: dependencies, minimum Ansible version, supported platforms, Galaxy metadata (author, license, description, tags).

Q269. [Python] What is the enum.nonmember() function added in Python 3.11?

A: It wraps a value to explicitly exclude it from being an enum member: x = nonmember(42). Similarly, member() forces inclusion.

Q270. [Ansible] What must a filter plugin Python file contain?

A: A FilterModule class with a filters() method that returns a dictionary mapping filter names to Python callables.


Batch 28

Q271. [Ansible] What is Private Automation Hub?

A: A self-hosted instance of Automation Hub that organizations deploy internally to host their own custom collections, curate approved content, and serve as a proxy/mirror for certified collections.

Q272. [Python] What does os.path.expanduser('~') return?

A: The current user's home directory path.

Q273. [Linux] How do you count occurrences of a word in a file using command-line tools?

A: grep -o -w "word" file | wc -l-o prints each match on its own line, -w matches whole words only. --- ## 11. systemd

Q274. [Linux] What is the difference between a process context switch and an interrupt?

A: A process context switch saves/restores full process state including user-space registers and page tables. An interrupt only saves minimal CPU state, runs the interrupt handler in kernel context, then returns — no page table switch is needed if returning to the same process.

Q275. [Linux] What is CPU steal time?

A: The percentage of time a virtual CPU waits for the hypervisor to schedule it on a physical CPU. Visible in top as st. High steal indicates the host is overcommitted or noisy neighbors are consuming resources.

Q276. [Ansible] What is the automation controller REST API used for?

A: Programmatic interaction with all controller features: launching jobs, managing inventory, credentials, templates, users, and organizations. Enables CI/CD integration.

Q277. [Linux] What is DPDK?

A: Data Plane Development Kit — a set of libraries for fast packet processing that bypasses the kernel network stack entirely. Used in high-performance networking (NFV, SDN). Packets go directly from NIC to userspace via huge pages and poll mode drivers.

Q278. [Ansible] List all the string values that YAML 1.1 interprets as boolean true.

A: true, True, TRUE, yes, Yes, YES, on, On, ON.

Q279. [Python] What does NumPy stand for?

A: Numerical Python.

Q280. [Ansible] What does ansible-config list show?

A: All available configuration options with descriptions, defaults, and environment variable names.


Batch 29

Q281. [Python] What do parentheses () do in a regex pattern?

A: They create capturing groups. Matched text can be retrieved via group(n) on the match object.

Q282. [Python] What are descriptors in Python?

A: Objects that define __get__, __set__, or __delete__ methods. They control attribute access on classes. Properties, methods, classmethods, and staticmethods are all implemented using descriptors.

Q283. [Ansible] What is the ansible.builtin.find module?

A: Searches for files/directories on remote hosts matching specified criteria (patterns, age, size). Returns a list of matching paths.

Q284. [Ansible] What is the standard collection directory structure?

A: galaxy.yml, plugins/ (modules, filter, lookup, inventory, callback, etc.), roles/, playbooks/, docs/, meta/runtime.yml, tests/.

Q285. [Ansible] What does the never tag do?

A: Tasks tagged with never never run unless you explicitly request them with --tags never or another tag also applied to that task.

Q286. [Ansible] What does ansible-vault do?

A: Encrypts and decrypts files and strings for secure secret management.

Q287. [Ansible] What is the raw module, and when is it needed?

A: raw executes a raw SSH command without the Ansible module subsystem. It's needed when the target has no Python installed (bootstrapping Python on a new host) or for network devices that don't support the Ansible module system.

Q288. [Ansible] What are the main components of Red Hat Ansible Automation Platform (AAP) 2.x?

A: (1) Automation Controller (formerly Ansible Tower) -- the web UI and API for running playbooks; (2) Automation Hub -- a repository for certified/validated collections; (3) Event-Driven Ansible (EDA) Controller -- event-driven automation triggers; (4) Ansible Lightspeed with IBM watsonx Code Assistant -- AI-powered playbook generation; (5) Platform Gateway -- unified web UI consolidating all components (introduced in AAP 2.5).

Q289. [Ansible] What is Ansible Tower?

A: A web-based enterprise solution (now called Red Hat Ansible Automation Platform) providing a UI, RBAC, job scheduling, dashboards, and REST API for managing Ansible automation.

Q290. [Ansible] What is ansible.builtin.set_stats?

A: A module that sets custom statistics for playbook runs, visible in Automation Controller/AWX. Stats are displayed in the job summary and can be used for reporting.


Batch 30

Q291. [Python] What is the difference between is and == in Python?

A: is checks identity (same object in memory). == checks equality (same value). Due to integer caching, a is b might be True for small integers but this should never be relied upon.

Q292. [Linux] What is Gentoo Linux known for?

A: Source-based package management via Portage where packages are compiled from source on the user's machine, allowing extreme customization and optimization through USE flags.

Q293. [Linux] What is SSH agent forwarding?

A: Allows using local SSH keys on remote servers without copying private keys. The remote server forwards key operations back to the local ssh-agent. Enabled with ssh -A or ForwardAgent yes. Use cautiously — a compromised remote host can use your agent.

Q294. [Ansible] What is the any_errors_fatal setting?

A: If set to true at the play level, any task failure on any host causes all hosts to fail and the play to abort.

Q295. [Linux] What is ss -i useful for?

A: Shows internal TCP information including congestion window (cwnd), round-trip time (rtt), retransmissions, and MSS. Valuable for diagnosing TCP performance issues.

Q296. [Ansible] What is the debug module's verbosity parameter?

A: Controls at which verbosity level (-v, -vv, -vvv, -vvvv) the debug message appears. verbosity: 2 means the message only shows with -vv or higher.

Q297. [Ansible] What are callback plugins?

A: Customize how Ansible displays output, sends notifications, or logs results. Examples: profile_tasks (timing), json (JSON output), slack (notifications).

Q298. [Linux] What does systemd-cgtop show?

A: Real-time resource usage (CPU, memory, I/O) per cgroup/service, similar to top but organized by systemd unit. Shows which services consume the most resources.

Q299. [Ansible] What are the key features of Ansible?

A: Agentless architecture, SSH-based communication, human-readable YAML syntax, idempotent operations, push-based model, extensive module library, inventory management, and a large community ecosystem.

Q300. [Ansible] What is the all group?

A: A special built-in group that contains every host in the inventory.


Batch 31

Q301. [Linux] What is anacron?

A: A cron complement for machines not running 24/7. It ensures daily, weekly, and monthly jobs run even if the machine was off at the scheduled time. Uses timestamps in /var/spool/anacron/ to track execution.

Q302. [Ansible] What was the approximate annual cost of Ansible Tower licensing before the AAP rebrand?

A: Standard licensing ranged from approximately $13,000/year to $17,500/year for up to 100 managed nodes.

Q303. [Ansible] How do you test a specific scenario when multiple exist?

A: molecule test -s <scenario_name> ---

Q304. [Linux] How do you override part of a unit file without modifying the original?

A: Create a drop-in directory: /etc/systemd/system/<unit>.d/override.conf. Use systemctl edit <unit> to create it automatically.

Q305. [Python] What does functools.lru_cache do?

A: It is a decorator that caches the results of a function using a Least Recently Used eviction policy. By default, it caches up to 128 results. Use @lru_cache(maxsize=None) for unbounded caching.

Q306. [Ansible] How does ansible-navigator differ from ansible-playbook?

A: ansible-navigator runs playbooks inside EE containers by default (using podman or docker), provides an interactive TUI for exploring results, and offers subcommands like images, collections, doc, and config. ansible-playbook runs directly on the control node with no container isolation and no TUI.

Q307. [Python] What is the difference between NumPy's np.array() and np.asarray()?

A: np.array() always creates a new array. np.asarray() only creates a new array if the input is not already an ndarray, avoiding unnecessary copies.

Q308. [Linux] What is the difference between user time and system time in process statistics?

A: User time: CPU time spent executing user-space code. System time: CPU time spent in kernel code on behalf of the process (system calls, page faults). time command reports both as user and sys.

Q309. [Python] What is __len__ used for?

A: It implements len(obj). It should return a non-negative integer. An object with __len__ is also considered falsy if __len__ returns 0 (unless __bool__ is defined).

Q310. [Python] What are the advantages of collections.deque over a list?

A: O(1) append and pop from both ends (lists are O(n) for insert(0, x) and pop(0)). Deques also support a maxlen parameter for fixed-size buffers.


Batch 32

Q311. [Ansible] How do you view an encrypted file without decrypting?

A: ansible-vault view secrets.yml

Q312. [Python] What is unittest.mock.sentinel?

A: Unique objects useful as placeholders in tests: sentinel.some_value creates a unique object that can only be equal to itself.

Q313. [Linux] What is the oldest actively maintained Linux distribution?

A: Slackware, first released on July 17, 1993 by Patrick Volkerding. It remains actively developed.

Q314. [Linux] What is the PATH variable?

A: A colon-separated list of directories the shell searches for executable commands. Searched left to right. Example: /usr/local/bin:/usr/bin:/bin.

Q315. [Python] What is typing.ClassVar used for?

A: Marking an annotation as a class variable (not an instance variable) in dataclasses and type-checked code: count: ClassVar[int] = 0.

Q316. [Linux] What is the purpose of keepalived?

A: Implements VRRP (Virtual Router Redundancy Protocol) for high-availability virtual IP addresses. Also provides health checking for LVS (Linux Virtual Server) load balancing.

Q317. [Python] What is the enum.verify decorator added in Python 3.11?

A: It validates enum classes according to named rules: @verify(UNIQUE) ensures no duplicate values, @verify(CONTINUOUS) ensures no gaps in integer values.

Q318. [Python] What is shlex.split() used for?

A: Splitting a shell command string into a list of arguments using shell-like syntax. Useful for converting "cmd --flag 'arg with spaces'" into ['cmd', '--flag', 'arg with spaces'].

Q319. [Linux] How do you harden SSH?

A: In /etc/ssh/sshd_config: PermitRootLogin no, PasswordAuthentication no, PubkeyAuthentication yes, AllowUsers admin, Port 2222 (non-default), MaxAuthTries 3. Also deploy fail2ban and use key-based authentication only.

Q320. [Linux] What is port 123 used for?

A: NTP (Network Time Protocol) — for clock synchronization.


Batch 33

Q321. [Python] What performance improvement was made in Python 3.11?

A: CPython 3.11 is 10-60% faster than 3.10 thanks to the "Faster CPython" project (led by Mark Shannon, funded by Microsoft). Key optimizations include adaptive specialization of bytecode.

Q322. [Python] What is __eq__ and __ne__?

A: __eq__ implements ==, __ne__ implements !=. By default, __ne__ delegates to __eq__ and negates the result.

Q323. [Python] What is the difference between a "naive" and "aware" datetime in Python?

A: A naive datetime has no timezone information (tzinfo is None). An aware datetime has timezone info attached. Comparing naive and aware datetimes raises a TypeError.

Q324. [Python] What is virtualenv and why is it important?

A: It creates isolated Python environments with their own packages, preventing dependency conflicts between projects.

Q325. [Ansible] How do you integrate Ansible with Jenkins?

A: Create Jenkins jobs that call ansible-playbook commands, use Jenkins Ansible plugin, pass build parameters as extra-vars, and archive job logs.

Q326. [Linux] What is pam_tally2 / pam_faillock?

A: PAM modules for account lockout after failed login attempts. pam_tally2 is deprecated; pam_faillock (RHEL 8+) is the replacement. Configured in /etc/security/faillock.conf.

Q327. [Linux] What are the Linux process states and their codes?

A: R = Running/runnable, S = Interruptible sleep, D = Uninterruptible sleep (usually I/O), Z = Zombie, T = Stopped (signal or debugger), I = Idle kernel thread (not consuming CPU).

Q328. [Python] What is asyncio.create_task() vs await?

A: await coro() runs and waits for a single coroutine. asyncio.create_task(coro()) schedules it to run concurrently without waiting, returning a Task that can be awaited later.

Q329. [Linux] What is PSS (Proportional Set Size)?

A: A memory metric that divides shared pages equally among all processes sharing them. More accurate than RSS for processes sharing libraries. PSS of all processes sums to total physical memory used.

Q330. [Linux] What is tuned?

A: A systemd service that applies performance profiles to optimize the system for specific workloads. Profiles include throughput-performance, latency-performance, virtual-guest, powersave. Set with tuned-adm profile <name>.


Batch 34

Q331. [Linux] How do you list all installed packages on RHEL/Fedora?

A: rpm -qa or dnf list installed.

Q332. [Linux] How do you enter GRUB rescue mode?

A: Press 'c' at the GRUB menu for a command shell, or 'e' to edit a boot entry. If GRUB can't find its config, it drops to grub rescue> automatically.

Q333. [Linux] What does xxd do?

A: Creates a hex dump of a file. xxd file | head shows the binary content in hex. Can also reverse a hex dump back to binary with xxd -r.

Q334. [Ansible] What are the mutually_exclusive, required_together, required_one_of, required_if, and required_by parameters?

A: Validation constraints in AnsibleModule() that enforce relationships between arguments: mutually exclusive prevents using certain args together, required_together mandates certain args appear together, required_one_of needs at least one from a set, required_if requires args conditionally, and required_by specifies arg dependencies.

Q335. [Linux] What does ltrace do?

A: Traces dynamic library calls made by a process, similar to how strace traces system calls. Useful for debugging library interactions.

Q336. [Python] Why is unpickling data from untrusted sources a security risk?

A: Because pickle.loads() can execute arbitrary code during deserialization. A malicious pickle payload can use the __reduce__ method to run arbitrary commands.

Q337. [Ansible] Where are remote temporary files stored on managed nodes?

A: By default in ~/.ansible/tmp/ on the remote host (configurable via remote_tmp in ansible.cfg).

Q338. [Python] What PEP defines the Python style guide?

A: PEP 8, "Style Guide for Python Code," originally written by Guido van Rossum, Barry Warsaw, and Alyssa Coghlan.

Q339. [Linux] How do RHEL and Ubuntu differ in their default security stack?

A: RHEL uses SELinux (enforcing by default), firewalld, and auditd. Ubuntu uses AppArmor (enabled by default), ufw (simplified iptables frontend), and relies on journald for audit logging.

Q340. [Python] What is atexit used for?

A: Registering cleanup functions to be called when the interpreter exits normally. atexit.register(func) ensures func is called at shutdown.


Batch 35

Q341. [Ansible] What command runs an Ansible playbook?

A: ansible-playbook playbook.yml

Q342. [Linux] What is the DNS resolution order on Linux?

A: Controlled by /etc/nsswitch.conf (the hosts: line). Typically: files dns meaning check /etc/hosts first, then DNS resolvers listed in /etc/resolv.conf.

Q343. [Ansible] What happens when you apply become: true with the local connection?

A: Privilege escalation happens on the control node itself. Ansible will sudo on the machine running the playbook, which can be dangerous and is often unintended.

Q344. [Python] Why did Guido join Microsoft in 2020?

A: To work on improving CPython performance. Microsoft funded the "Faster CPython" project that led to significant speed improvements in Python 3.11+.

Q345. [Linux] Where are udev rules stored?

A: /usr/lib/udev/rules.d/ (defaults) and /etc/udev/rules.d/ (overrides). Files are processed in lexical order; /etc/ rules take precedence over /usr/lib/.

Q346. [Python] What is the difference between str.join() and concatenation with +?

A: str.join() is O(n) — it preallocates memory for the final string. Repeated + concatenation is O(n^2) because each concatenation creates a new string. Always prefer join() for combining many strings.

Q347. [Linux] What is audit2allow?

A: A tool that generates SELinux policy allow rules from audit log denials: grep denied /var/log/audit/audit.log | audit2allow -M mypolicy && semodule -i mypolicy.pp.

Q348. [Linux] What is the last command?

A: Shows the last logged-in users by reading /var/log/wtmp. last reboot shows system reboot history. lastb shows failed login attempts from /var/log/btmp.

Q349. [Ansible] What is the difference between stdout callbacks and non-stdout callbacks?

A: Only ONE stdout callback can be active (it controls terminal output). Multiple non-stdout callbacks can run simultaneously for logging, notifications, or metrics.

Q350. [Python] Why should you not catch BaseException?

A: Because it would catch SystemExit (preventing clean exit), KeyboardInterrupt (preventing Ctrl+C), and GeneratorExit. Catch Exception instead for general error handling.


Batch 36

Q351. [Linux] What is structured logging?

A: Logging with key-value metadata (timestamp, host, service, severity, message) rather than free-form text. journald stores structured data natively. JSON is a common structured log format.

Q352. [Python] What is FastAPI's key distinguishing feature?

A: Automatic API documentation (Swagger UI and ReDoc) generated from Python type hints, along with automatic request validation using Pydantic models.

Q353. [Python] What is sys.exc_info() used for?

A: Returns a tuple (type, value, traceback) of the exception currently being handled. Returns (None, None, None) if no exception is being handled.

Q354. [Python] What is TypeAlias used for?

A: Explicitly declaring a type alias: Vector: TypeAlias = list[float]. Added in Python 3.10. In Python 3.12, the type statement replaced it.

Q355. [Linux] What does the unshare command do?

A: Creates new namespaces and runs a command in them, without forking. For example, unshare --net bash starts a shell with its own isolated network namespace.

Q356. [Ansible] What does ansible-config dump show?

A: All current configuration settings, their values, and their sources (default, config file, environment variable).

Q357. [Ansible] How does inventory caching work?

A: Inventory plugins can use configured cache plugins (jsonfile, Redis, memcached, etc.) to store and retrieve data, avoiding repeated costly external API calls. Controlled by cache, cache_plugin, cache_timeout, and cache_connection settings.

Q358. [Linux] What is socket activation?

A: systemd listens on a socket and starts the associated service only when a connection arrives. This speeds up boot (services start on demand) and allows zero-downtime restarts.

Q359. [Python] What did Python 2.6 introduce?

A: It served as a transition release toward Python 3, adding many Python 3 features with backward compatibility. It introduced the multiprocessing module and the -3 flag for warnings about Python 3 incompatibilities.

Q360. [Python] What year did Guido van Rossum receive the Award for the Advancement of Free Software from the FSF?

A: 2001.


Batch 37

Q361. [Ansible] What is register in Ansible?

A: Captures the return value of a task into a variable for use in subsequent tasks. The registered variable contains stdout, stderr, rc, changed, failed, and module-specific keys.

Q362. [Linux] What does cat /proc/PID/wchan show?

A: The kernel function a sleeping process is blocked in. Helps identify why a process is stuck (waiting on I/O, lock, futex, etc.).

Q363. [Ansible] What is ANSIBLE_STDOUT_CALLBACK?

A: Environment variable that sets the stdout callback plugin, controlling output formatting (json, yaml, debug, minimal, etc.).

Q364. [Ansible] What are the six ansible-lint profiles in order from least to most strict?

A: min, basic, moderate, safety, shared, production. Each profile includes all rules from profiles below it.

Q365. [Ansible] How does privilege escalation work on network devices like Cisco IOS?

A: Using ansible_become: yes, ansible_become_method: enable, and ansible_become_password: <enable_password>. This tells Ansible to enter enable mode after connecting.

Q366. [Linux] What files does a Bash interactive non-login shell source?

A: /etc/bash.bashrc (on some distros) and ~/.bashrc. This is why .bash_profile often sources .bashrc.

Q367. [Linux] What is the Devuan distribution?

A: A fork of Debian that replaces systemd with SysVinit or OpenRC. Created by developers who objected to Debian's adoption of systemd as the default init system. --- ## 2. Kernel Architecture & Internals

Q368. [Ansible] What is meta: clear_facts?

A: Removes all cached facts for the current host.

Q369. [Ansible] What does the user module do?

A: Manages user accounts -- create, remove, modify users, set passwords, manage groups.

Q370. [Ansible] What is the difference between defaults/main.yml and vars/main.yml?

A: defaults has the lowest variable precedence and is meant to be overridden by users. vars has higher precedence and contains internal variables that should not normally be overridden.


Batch 38

Q371. [Python] What critical requirement does itertools.groupby() have?

A: The input must be sorted (or at least grouped) by the key function. groupby only groups consecutive elements with the same key. If the data is not pre-sorted, elements with the same key will appear in separate groups.

Q372. [Linux] What supercomputing milestone does Linux hold?

A: As of 2017, Linux runs on 100% of the world's Top 500 supercomputers.

Q373. [Ansible] What format do Ansible modules return data in?

A: JSON (sent to stdout).

Q374. [Ansible] What year was Event-Driven Ansible (EDA) first introduced?

A: 2022 as a technology preview, generally available in AAP 2.4 (2023).

Q375. [Linux] How do you check filesystem disk usage?

A: df -h shows mounted filesystem usage in human-readable format. du -sh /path shows directory/file space usage.

Q376. [Ansible] What is ansible-playbook --syntax-check?

A: Parses the playbook and checks for YAML/Ansible syntax errors without executing anything. Faster than --check but only catches structural problems.

Q377. [Linux] What company acquired Red Hat in 2019?

A: IBM acquired Red Hat for approximately $34 billion, the largest software acquisition at the time.

Q378. [Python] What is argparse.FileType?

A: A factory for argparse that opens files: parser.add_argument('input', type=argparse.FileType('r')) automatically opens the file for reading.

Q379. [Python] What is functools.singledispatchmethod used for?

A: It is the method version of singledispatch for use inside classes. It dispatches based on the type of the first non-self/non-cls argument.

Q380. [Ansible] How do you view all facts for a host?

A: ansible hostname -m setup or filter with ansible hostname -m setup -a "filter=ansible_os_family"


Batch 39

Q381. [Python] What is uv in the Python ecosystem?

A: uv is an extremely fast Python package installer and resolver written in Rust by Astral (the makers of Ruff). It is a drop-in replacement for pip and pip-tools, often 10-100x faster.

Q382. [Ansible] What is the ansible-doc command?

A: Displays documentation for modules, plugins, and keywords from the command line: ansible-doc ansible.builtin.copy, ansible-doc -t callback json.

Q383. [Python] What does itertools.starmap(func, iterable) do?

A: It applies func to each element of the iterable using argument unpacking. For example, starmap(pow, [(2,3), (3,2)]) yields 8, 9.

Q384. [Linux] What does RHEL stand for?

A: Red Hat Enterprise Linux.

Q385. [Python] What is AIOHTTP?

A: An async HTTP client/server framework built on asyncio. It serves as both a web server framework and an HTTP client library.

Q386. [Python] What is the PYTHONDONTWRITEBYTECODE environment variable?

A: When set, it prevents Python from creating __pycache__ directories and .pyc files. Equivalent to the -B flag.

Q387. [Linux] What does > vs >> do?

A: > redirects stdout to a file, overwriting it. >> appends to the file.

Q388. [Linux] What is systemd's role in the boot process?

A: systemd is PID 1 — the first user-space process. The kernel execs it after mounting the root filesystem. systemd parses its unit files, builds a dependency graph, and starts services in parallel to reach the default target.

Q389. [Linux] Why was UsrMerge implemented?

A: Simplifies packaging (no need to decide between /bin and /usr/bin), eliminates path issues, simplifies initramfs construction, and aligns with how most modern systems actually use the filesystem. --- ## 18. Environment & Shell Variables

Q390. [Ansible] Can handlers notify other handlers?

A: Yes. Handlers can contain notify directives to trigger other handlers, creating a chain.


Batch 40

Q391. [Ansible] When was Ansible Tower renamed to automation controller?

A: With the release of Ansible Automation Platform 2.0 in late 2021. ---

Q392. [Linux] What is the install command?

A: Copies files while setting permissions and ownership in one step: install -m 755 -o root -g root binary /usr/local/bin/. More efficient than separate cp/chmod/chown.

Q393. [Python] What is the walrus operator in Python?

A: The := assignment expression operator, introduced in Python 3.8 (PEP 572). It assigns a value to a variable as part of an expression.

Q394. [Python] What is threading.Event?

A: A synchronization primitive where one thread signals an event and other threads wait for it: event.set(), event.wait(), event.clear().

Q395. [Linux] What is LVS (Linux Virtual Server)?

A: A Layer 4 load balancer built into the Linux kernel using IPVS (IP Virtual Server). Supports NAT, Direct Routing (DR), and IP tunneling modes. Managed with ipvsadm.

Q396. [Python] What is fnmatch used for?

A: Unix filename pattern matching: fnmatch.fnmatch('file.py', '*.py') returns True. It supports *, ?, [seq], and [!seq] patterns.

Q397. [Ansible] When would you use ansible-pull instead of the default push model?

A: For decentralized environments, self-healing systems, edge devices, or scenarios where nodes should independently fetch and apply configurations from a Git repository on a schedule.

Q398. [Python] What parameter to @dataclass was added in Python 3.10 to allow slot-based instances?

A: slots=True. When set, the generated class uses __slots__ instead of __dict__, resulting in faster attribute access and less memory usage.

Q399. [Linux] What is an inode?

A: An index node — a kernel data structure storing metadata about a file: permissions, ownership, size, timestamps, and pointers to data blocks. Each file has a unique inode number within its filesystem. Notably, an inode does NOT store the filename.

Q400. [Python] What is __file__ in a module?

A: The path to the file from which the module was loaded. It is not defined for C extensions or built-in modules.


Batch 41

Q401. [Ansible] What is collections: at the play level?

A: A list of collections to search for modules/plugins, allowing short names instead of FQCNs within that play. ---

Q402. [Ansible] What is a dynamic inventory?

A: An inventory that automatically fetches host lists from external sources (AWS, Azure, GCP, VMware, etc.) at runtime using inventory plugins or scripts.

Q403. [Ansible] Where do network modules execute -- on the control node or managed node?

A: On the control node. Unlike Linux automation, network modules do not execute on the network device itself because most network devices cannot run Python.

Q404. [Python] What is the significance of Python 3.6?

A: It added f-strings (PEP 498), variable annotations (PEP 526), underscores in numeric literals, the secrets module, async generators, and dict ordering as an implementation detail.

Q405. [Linux] What is the origin of the term "free software" vs "open source"?

A: "Free software" was coined by Richard Stallman (free as in freedom, not price). "Open source" was coined in 1998 by Christine Peterson and adopted by Eric Raymond and Bruce Perens to make the concept more business-friendly. The OSI (Open Source Initiative) maintains the Open Source Definition.

Q406. [Ansible] Which of the "big four" (Ansible, Puppet, Chef, Salt) are agentless?

A: Ansible is fully agentless (SSH/WinRM). Salt can run agentless via salt-ssh but normally uses agents (minions). Puppet and Chef both typically require agents, though Puppet can run agentless via bolt.

Q407. [Python] What is sysconfig used for?

A: Accessing Python's configuration: installation paths, compiler flags, platform tags. sysconfig.get_paths() returns where packages are installed.

Q408. [Ansible] Name five dynamic inventory plugins included in popular collections.

A: (1) amazon.aws.aws_ec2; (2) google.cloud.gcp_compute; (3) azure.azcollection.azure_rm; (4) community.vmware.vmware_vm_inventory; (5) kubernetes.core.k8s.

Q409. [Ansible] Why do you always use {{ }} in Ansible except in when clauses?

A: The when clause is always processed through Jinja2 automatically, so adding braces would cause errors. Everywhere else, braces are required to distinguish variables from plain strings. ---

Q410. [Python] What is collections.abc.MutableMapping?

A: An abstract base class for dict-like objects. Implementing __getitem__, __setitem__, __delitem__, __len__, and __iter__ gives you the full mapping API for free.


Batch 42

Q411. [Python] What is the compile() built-in?

A: It compiles a string of Python code into a code object that can be executed with exec() or eval(). It accepts 'exec', 'eval', or 'single' mode.

Q412. [Python] What major features were added in Python 3.10?

A: Structural pattern matching match/case (PEP 634), TypeGuard, ParamSpec, pairwise() in itertools, zip(strict=True), and better error messages.

Q413. [Python] What does @dataclass generate automatically?

A: By default, __init__, __repr__, and __eq__ methods. With additional parameters it can generate __hash__, ordering methods, and use __slots__.

Q414. [Linux] What does ${var%pattern} do?

A: Removes the shortest match of pattern from the end of $var. ${var%%pattern} removes the longest match. Used for suffix stripping (e.g., ${filename%.txt}).

Q415. [Ansible] What is the single most important thing to remember about extra vars (-e)?

A: Extra vars always win. They have the highest precedence of any variable source and cannot be overridden by anything else. This makes them useful for emergency overrides but dangerous if overused.

Q416. [Linux] What is /dev/null?

A: A special device that discards everything written to it and returns EOF on read. The "bit bucket." Common usage: command 2>/dev/null discards stderr.

Q417. [Ansible] What is ansible-galaxy collection verify?

A: Verifies the integrity of installed collections by comparing checksums against the Galaxy server manifest. Detects if collection files have been modified locally.

Q418. [Ansible] What module manages SELinux?

A: selinux module (set mode to enforcing, permissive, or disabled).

Q419. [Python] Why should you avoid using datetime.utcnow()?

A: It returns a naive datetime (no timezone info) representing UTC time, which can be confused with local time. Use datetime.now(timezone.utc) instead. utcnow() was deprecated in Python 3.12.

Q420. [Python] What is the type statement in Python 3.12?

A: A new syntax for defining type aliases: type Vector = list[float]. It is lazily evaluated and supports generic type parameters inline.


Batch 43

Q421. [Ansible] Where can variables be defined?

A: In playbook vars sections, vars_files, group_vars/, host_vars/, role defaults, role vars, inventory files, command line (-e/--extra-vars), registered variables, and set_fact.

Q422. [Python] What is the __annotations__ attribute?

A: A dictionary storing the annotations of a function, class, or module. For example, def f(x: int) -> str: results in f.__annotations__ == {'x': int, 'return': str}.

Q423. [Ansible] What drivers does Molecule support for creating test instances?

A: Docker (default), Podman, Delegated (custom), and community-maintained drivers for Vagrant, EC2, GCE, Azure, DigitalOcean, LXD, and more.

Q424. [Python] What standard library module provides support for generating universally unique identifiers?

A: The uuid module, supporting UUID versions 1, 3, 4, and 5.

Q425. [Python] What is Gunicorn?

A: A popular WSGI HTTP server for Unix. It uses a pre-fork worker model and is commonly deployed with Django or Flask behind Nginx.

Q426. [Ansible] What is ansible_play_name?

A: A magic variable containing the name of the currently executing play.

Q427. [Ansible] What does ansible-console do?

A: Provides an interactive REPL (Read-Eval-Print Loop) for executing ad-hoc commands interactively.

Q428. [Python] What are .pth files?

A: Path configuration files in site-packages that contain paths to add to sys.path at startup.

Q429. [Ansible] What is ansible-inventory --graph?

A: A command that displays the inventory hierarchy as an ASCII tree graph, showing groups, subgroups, and hosts. Adding --vars also shows the variables for each host.

Q430. [Linux] How does chmod octal notation work?

A: Three octal digits represent owner, group, and others. Each digit is the sum of: read=4, write=2, execute=1. Example: chmod 755 = rwxr-xr-x.


Batch 44

Q431. [Python] What is the perf profiler support added in Python 3.12?

A: Python 3.12 added support for the Linux perf profiler, allowing Python function names to appear in perf output for system-level profiling.

Q432. [Linux] What is the difference between Linux, Unix, and BSD?

A: Unix is the original OS (Bell Labs, 1969). BSD (Berkeley Software Distribution) is a Unix derivative with its own kernel and userland. Linux is a Unix-like kernel written from scratch by Linus Torvalds with GNU userland. Linux is not Unix-certified, but follows POSIX standards.

Q433. [Linux] What is $#?

A: The number of positional parameters passed to the script. --- ## 10. Text Processing

Q434. [Ansible] What is the password_hash filter?

A: Generates a system-compatible password hash: {{ 'mypassword' | password_hash('sha512', 'salt') }}. Used for setting user passwords idempotently.

Q435. [Ansible] What is the "golden image" pattern using Ansible?

A: Using Ansible with Packer to provision a base VM/container image with all required software, then deploying instances from that image. Ansible handles the configuration during image build time rather than at runtime. --- Total: 220+ Q&A pairs covering Ansible history, ecosystem, trivia, deep internals, and edge cases. --- ## 26. Scenarios & Real-World Problems

Q436. [Python] What does os.scandir() return and why is it preferred over os.listdir()?

A: It returns an iterator of DirEntry objects that include file metadata (type, stat info) cached from the directory scan. This avoids extra system calls, making it faster than listdir() followed by os.stat().

Q437. [Linux] What is the difference between VIRT, RES, and SHR in top?

A: VIRT = total virtual memory (allocated, not necessarily used). RES = actual physical memory in use (resident set size). SHR = memory shared with other processes (shared libraries, shared memory segments).

Q438. [Linux] How do you regenerate the initramfs on RHEL/Fedora vs Debian/Ubuntu?

A: RHEL/Fedora: dracut -f. Debian/Ubuntu: update-initramfs -u.

Q439. [Ansible] How does serial support rolling updates?

A: It limits how many hosts are updated at a time: serial: 2 updates two hosts at a time. It can also be a list: serial: [1, 5, 10] for gradual rollout.

Q440. [Ansible] How do you look up documentation for a module?

A: ansible-doc <module_name> (e.g., ansible-doc copy)


Batch 45

Q441. [Linux] What is the difference between TCP CLOSE_WAIT and TIME_WAIT?

A: CLOSE_WAIT: the remote end has closed but the local application hasn't — usually a bug (application not calling close()). TIME_WAIT: the local end initiated close and is waiting 2×MSL for late packets — normal behavior.

Q442. [Python] What is getattr(obj, name, default) used for?

A: It retrieves an attribute by name string. If the attribute does not exist, it returns the default (or raises AttributeError if no default is given).

Q443. [Ansible] What file must exist in the root of an Ansible Galaxy role for it to be recognized?

A: A meta/main.yml file containing role metadata (author, description, license, platforms, dependencies, galaxy_info).

Q444. [Linux] What is the difference between initramfs and initrd?

A: initrd (initial RAM disk) is an older mechanism that creates a block device in RAM and mounts it as a filesystem. initramfs is a cpio archive extracted into a tmpfs instance. Modern Linux uses initramfs, though the term "initrd" persists colloquially.

Q445. [Ansible] If you create a custom fact in the same play, how do you access it?

A: You must explicitly re-run the setup module to refresh facts: ansible.builtin.setup: filter=ansible_local.

Q446. [Python] What are named groups in regex and how do you use them?

A: (?P<name>...) creates a named group accessible via match.group('name') or match.groupdict(). Backreferences use (?P=name).

Q447. [Python] What is difflib.get_close_matches() used for?

A: Finding strings similar to a target: get_close_matches('appel', ['apple', 'ape', 'maple']) returns ['apple', 'maple']. Useful for "did you mean?" suggestions.

Q448. [Ansible] What is ansible_loop?

A: A magic variable available inside loops (with loop/with_*) that contains metadata about the current iteration: index0, index, first, last, length, previtem, nextitem, revindex0, revindex.

Q449. [Ansible] What happens if a handler is notified multiple times?

A: It runs only once, regardless of how many tasks notified it.

Q450. [Python] What is the surprising behavior of is with short strings?

A: Due to string interning, a = 'hello'; b = 'hello'; a is b is True. But a = 'hello world'; b = 'hello world'; a is b may be False because strings with spaces are not automatically interned. --- ## 19. Python for DevOps/SRE


Batch 46

Q451. [Python] What is the match statement guard clause?

A: An if condition added to a case pattern: case [x, y] if x > 0: only matches if the pattern matches AND the guard condition is true.

Q452. [Python] What governance model replaced the BDFL?

A: The Steering Council — a group of 5 people elected by core developers, established by PEP 13. They are re-elected after each major Python release.

Q453. [Linux] What does "SSH" stand for?

A: Secure Shell.

Q454. [Linux] What is a context switch?

A: The process of saving the state (registers, program counter, page table pointer) of the currently running process and restoring the state of the next process to run. Context switches are expensive due to cache and TLB invalidation.

Q455. [Linux] What does "TTY" stand for?

A: TeleTYpewriter — a historical term for the text input/output terminal devices. In Linux, /dev/tty* are virtual consoles and /dev/pts/* are pseudo-terminals.

Q456. [Linux] What is a TAP vs TUN device?

A: TUN (tunnel) operates at Layer 3 (IP packets). TAP (network tap) operates at Layer 2 (Ethernet frames). Used by VPNs — OpenVPN can use either; WireGuard uses TUN.

Q457. [Ansible] What is the constructed inventory plugin?

A: An inventory plugin that creates groups and variables dynamically based on Jinja2 expressions evaluated against existing inventory data. It lets you create groups based on facts or other variables without modifying the source inventory. --- --- ## 4. Playbooks, Plays & Tasks

Q458. [Ansible] Why does Ansible have separate Python requirements for control node vs. managed nodes?

A: The control node runs the full Ansible engine and needs a modern Python for its dependencies. Managed nodes only need Python to execute transferred module code, so older Python versions are supported longer to accommodate legacy systems. ---

Q459. [Ansible] What is the YAML octal number gotcha?

A: YAML 1.1 interprets numbers starting with 0 as octal. So 0777 is fine (it's an intentional octal for file permissions), but 0123 becomes decimal 83 -- not 123 as you might expect. If you mean the string "0123" or the integer 123, you must quote it or remove the leading zero.

Q460. [Ansible] What is Ansible Galaxy?

A: A community hub (website and CLI tool) for finding, sharing, and installing reusable Ansible roles and collections.


Batch 47

Q461. [Python] What does pass do in Python?

A: It is a null operation — a placeholder that does nothing. It is used where a statement is syntactically required but no action is needed (empty class bodies, stubs, etc.).

Q462. [Linux] What is the mpstat -I ALL command useful for?

A: Shows interrupt statistics per CPU including hardware interrupts, software interrupts, and individual interrupt counts. Helps diagnose interrupt storms and imbalances.

Q463. [Linux] What is SIGSEGV?

A: Signal 11 — segmentation fault. Sent when a process accesses invalid memory. Default action is termination with core dump.

Q464. [Python] What is the operator module?

A: It provides function equivalents of Python operators: operator.add(a, b) is equivalent to a + b. Useful as arguments to map(), reduce(), and sorted().

Q465. [Linux] What does tr do?

A: Translates or deletes characters: tr 'a-z' 'A-Z' converts lowercase to uppercase. tr -d '\r' removes carriage returns. tr -s ' ' squeezes repeated spaces.

Q466. [Ansible] What module is used to reboot a host?

A: reboot

Q467. [Python] How many keywords does Python 3.12 have?

A: 35 keywords. You can see them with import keyword; print(keyword.kwlist).

Q468. [Python] What Monty Python references exist in the Python stdlib?

A: The spam module (C extension example), spam/eggs in examples throughout documentation, the antigravity Easter egg (references XKCD which often features Python), and the "Spanish Inquisition" references in some test suites.

Q469. [Linux] What is the difference between /dev/random and /dev/urandom?

A: Historically, /dev/random blocked when the entropy pool was depleted while /dev/urandom never blocked. Since kernel 5.6, /dev/random also uses the CSPRNG and only blocks until initially seeded. In practice, /dev/urandom is recommended for almost all uses.

Q470. [Ansible] What are strategy plugins?

A: Control the order of task execution across hosts. Examples: linear (default -- tasks in order), free (each host runs independently), debug (interactive stepping).


Batch 48

Q471. [Ansible] How do dynamic inventory plugins for cloud providers work?

A: They query cloud provider APIs in real-time, returning current infrastructure as Ansible inventory. Examples: amazon.aws.aws_ec2, azure.azcollection.azure_rm, google.cloud.gcp_compute.

Q472. [Linux] What is the purpose of /proc?

A: Virtual filesystem providing kernel and process information. Not stored on disk — generated dynamically by the kernel.

Q473. [Python] What is conda and how does it differ from pip?

A: conda is a cross-platform package and environment manager that handles non-Python dependencies (C libraries, etc.). pip only manages Python packages.

Q474. [Linux] What does ip route add default via 10.0.0.1 do?

A: Sets 10.0.0.1 as the default gateway. All traffic without a more specific route is sent to this address.

Q475. [Python] What is a "free list" in CPython?

A: A cache of recently deallocated objects of a specific type (like floats, tuples, lists) that can be reused instead of calling malloc(). This speeds up creation of frequently used objects.

Q476. [Linux] What is journald?

A: systemd's logging daemon (systemd-journald). Stores structured, binary logs with rich metadata (unit, PID, UID, boot ID, etc.). Queried with journalctl. Can forward to syslog.

Q477. [Ansible] How do you use variables in Jinja2 templates?

A: {{ variable_name }} for variable substitution.

Q478. [Ansible] When would you use the local connection plugin?

A: When running tasks on the Ansible control node itself (localhost). It bypasses SSH entirely and executes directly. Used with connection: local or delegate_to: localhost.

Q479. [Ansible] List all 22 variable precedence levels from lowest to highest.

A: 1. command line values (e.g., -u my_user -- these are NOT extra vars) 2. role defaults (roles/x/defaults/main.yml) 3. inventory file or script group vars 4. inventory group_vars/all 5. playbook group_vars/all 6. inventory group_vars/ 7. playbook group_vars/ 8. inventory file or script host vars 9. inventory host_vars/ 10. playbook host_vars/ 11. host facts / cached set_facts 12. play vars 13. play vars_prompt 14. play vars_files 15. role vars (roles/x/vars/main.yml) 16. block vars (only for tasks in the block) 17. task vars (only for the task) 18. include_vars 19. set_facts / registered vars 20. role parameters (roles listed in play with vars:) 21. include parameters 22. extra vars (-e / --extra-vars) -- ALWAYS WIN

Q480. [Ansible] What is ansible-config dump?

A: Displays all current configuration settings with their values and sources (default, config file, environment variable). ansible-config dump --only-changed shows only settings that differ from defaults.


Batch 49

Q481. [Ansible] What collection is the ipaddr filter now in, and why?

A: ansible.utils collection. It was moved there during the collections migration because it depends on the netaddr Python library, which is not part of ansible-core's dependencies.

Q482. [Python] What is a virtual subclass in Python's ABC framework?

A: A class registered with MyABC.register(SomeClass) that passes isinstance() and issubclass() checks for the ABC without actually inheriting from it.

Q483. [Ansible] What is ansible.builtin.add_host?

A: Dynamically adds a host to the in-memory inventory during playbook execution. Useful for adding newly provisioned hosts.

Q484. [Linux] What does $# contain?

A: The number of positional parameters (arguments) passed to the script or function.

Q485. [Linux] What is syslog-ng?

A: An alternative syslog daemon with advanced log routing, filtering by message content/regex, structured data support, and flexible output options (files, databases, network, message queues).

Q486. [Linux] What kernel parameter controls the maximum number of connections tracked by netfilter?

A: net.netfilter.nf_conntrack_max — default varies by system memory. If exhausted, new connections are dropped. Monitor with /proc/sys/net/netfilter/nf_conntrack_count.

Q487. [Python] What is hmac module used for?

A: Creating keyed-hash message authentication codes for verifying message integrity and authenticity: hmac.new(key, message, hashlib.sha256).hexdigest().

Q488. [Python] What is Pydantic v2's key change from v1?

A: Pydantic v2 rewrote the core validation engine in Rust (pydantic-core), making it 5-50x faster than v1. It also uses model_validate() instead of parse_obj().

Q489. [Ansible] What are Jinja2 filters?

A: Functions that transform data. Examples: {{ var | default('fallback') }}, {{ list | join(',') }}, {{ string | upper }}, {{ data | to_json }}, {{ data | to_nice_yaml }}.

Q490. [Linux] What is the LANG variable?

A: Sets the default locale for the system (e.g., en_US.UTF-8). Affects date formats, number formats, sorting, and character encoding.


Batch 50

Q491. [Python] What did Guido work on at Google?

A: He spent half his time on Python and half on internal Google tools. He helped with the internal code review tool Mondrian and worked on App Engine.

Q492. [Ansible] What are the key sections in an execution-environment.yml file?

A: version (schema version), build_arg_defaults (base image settings), dependencies (galaxy requirements, Python requirements, system packages), additional_build_steps (prepend/append custom build commands), and images (base and builder image references).

Q493. [Python] What is ctypes used for?

A: Calling functions in C shared libraries from Python without writing C extension code. It provides C-compatible data types and function prototypes.

Q494. [Ansible] What are managed nodes?

A: The target servers/systems that Ansible manages. They only need SSH access and Python installed (no Ansible agent required).

Q495. [Python] What is functools.update_wrapper() and how does it relate to functools.wraps?

A: update_wrapper() is the function that does the actual work. functools.wraps is a convenience decorator that calls update_wrapper().

Q496. [Linux] What does set -o pipefail do?

A: Causes a pipeline to return the exit code of the last command that failed (non-zero), rather than only the last command. Without this, false | true returns 0.

Q497. [Linux] What does the export command do?

A: Makes a variable available to child processes (adds it to the environment). Without export, variables are local to the current shell.

Q498. [Ansible] When was Ansible 2.10 (the first "split" release) published?

A: September 2020 -- the first release with the monolithic content split into ansible-base + collections.

Q499. [Python] What does functools.cached_property do?

A: It transforms a method into a property that is computed once and then cached as a normal attribute. Unlike @property, the computation only runs on the first access.

Q500. [Python] What is __import__ hook?

A: Python's import system can be customized by adding finder objects to sys.meta_path or sys.path_hooks. These hooks intercept import statements and can load modules from custom sources.


Batch 51

Q501. [Linux] What is a process in Linux?

A: An instance of a running program with its own virtual address space, file descriptors, registers, and kernel metadata stored in a task_struct. Each process has a unique PID.

Q502. [Ansible] What is a Job Template in Tower/AWX?

A: A definition that combines a playbook, inventory, credentials, and other settings into a reusable, launchable automation job.

Q503. [Ansible] What method must a lookup plugin implement?

A: The run(self, terms, variables=None, **kwargs) method.

Q504. [Python] What does isinstance() check that type() does not?

A: isinstance() checks the entire inheritance chain (including virtual subclasses registered with ABCs). type() only returns the exact type.

Q505. [Ansible] How do you handle version control for playbooks?

A: Treat playbooks as code in Git. Use branches for changes, tags for versioning, code reviews for quality, and publish roles to Galaxy. --- --- ## 25. Best Practices & Patterns

Q506. [Ansible] Can tags be applied to roles?

A: Yes. Tags applied to a role import apply to all tasks within that role.

Q507. [Python] What is the unicodedata module?

A: It provides access to the Unicode Character Database: unicodedata.name('A') returns 'LATIN CAPITAL LETTER A', and unicodedata.normalize() handles Unicode normalization forms.

Q508. [Python] What does the dataclasses.asdict() function do?

A: It recursively converts a dataclass instance into a dictionary. There is also astuple() for converting to a tuple.

Q509. [Ansible] What are filter plugins?

A: Transform data within Jinja2 expressions. Examples: to_json, to_yaml, regex_replace, combine, default.

Q510. [Ansible] What is the notify keyword?

A: Used in a task to trigger a handler by name when the task reports a change.


Batch 52

Q511. [Ansible] Can you use when conditions with import_tasks?

A: Yes, but the condition is applied to every task inside the imported file, not to the import itself. This is a common gotcha.

Q512. [Python] What is typing.TypeVarTuple used for?

A: Added in Python 3.11 (PEP 646), it represents a variadic number of types. Used for typing functions that accept variable numbers of arguments of different types, like tensor shapes.

Q513. [Linux] What is the difference between xfs_growfs and resize2fs?

A: xfs_growfs grows XFS filesystems (must be mounted, specify mount point). resize2fs resizes ext4 filesystems (can grow online or shrink offline). XFS cannot be shrunk; ext4 can.

Q514. [Ansible] What is a task in Ansible?

A: A single unit of action that calls a specific Ansible module with parameters. Tasks are executed sequentially within a play.

Q515. [Ansible] What versioning scheme does ansible-core follow vs the ansible package?

A: ansible-core uses traditional semver (e.g., 2.15.x, 2.16.x). The ansible package uses independent versioning (e.g., 7.x, 8.x, 9.x) where each major version pins a specific ansible-core version.

Q516. [Ansible] How is Ansible used in a CI/CD pipeline?

A: Ansible automates infrastructure provisioning, application deployment, and configuration management, triggered by code commits or merge requests via tools like Jenkins, GitHub Actions, or GitLab CI.

Q517. [Python] What is the wildcard pattern in Python's match statement?

A: case _: matches anything (like a default case). The _ is a special pattern that never binds a variable.

Q518. [Linux] What is the format of /etc/passwd?

A: username:x:UID:GID:comment:home_directory:shell. The x indicates the password is in /etc/shadow. Seven colon-separated fields.

Q519. [Python] Why does import this have 19 aphorisms when The Zen of Python was supposed to have 20?

A: Tim Peters intentionally left the 20th aphorism blank for Guido to fill in — he never did.

Q520. [Python] What is Jupyter's name derived from?

A: The three core programming languages it supports: Julia, Python, and R. It evolved from IPython Notebook.


Batch 53

Q521. [Linux] What is the difference between locate and find?

A: locate searches a pre-built database (updatedb) — very fast but may be stale. find searches the filesystem in real-time — slower but always current. locate doesn't check permissions.

Q522. [Ansible] How do you install roles from a requirements file?

A: ansible-galaxy install -r requirements.yml

Q523. [Linux] What are the private IP address ranges?

A: 10.0.0.0/8 (Class A), 172.16.0.0/12 (Class B), 192.168.0.0/16 (Class C). Defined in RFC 1918, not routable on the public internet.

Q524. [Ansible] Can you use any_errors_fatal at play level?

A: Yes. When set to true, any task failure on any host immediately aborts the entire play for all hosts. --- ## 13. Execution Strategies & Performance

Q525. [Linux] What log priorities does journalctl support?

A: 0=emerg, 1=alert, 2=crit, 3=err, 4=warning, 5=notice, 6=info, 7=debug. Use -p 0..3 to show only critical messages.

Q526. [Ansible] What is the ansible.posix collection?

A: A collection of POSIX-system modules including acl, at, authorized_key, firewalld, mount, patch, seboolean, selinux, synchronize, sysctl.

Q527. [Ansible] What is the default base image used by ansible-builder?

A: The default base image is the Red Hat-provided ee-minimal-rhel8 or the community quay.io/ansible/ansible-runner:latest, depending on the version and configuration.

Q528. [Ansible] What indentation is recommended for YAML?

A: 2 spaces (never tabs).

Q529. [Ansible] What is wait_for_connection used for?

A: Waiting until a host becomes reachable, typically after a reboot. It repeatedly attempts to connect until successful or timeout.

Q530. [Python] What is typing.Optional[X] equivalent to?

A: Union[X, None] or X | None (Python 3.10+). It indicates the value can be of type X or None.


Batch 54

Q531. [Ansible] How does Mitogen transfer data?

A: Using UNIX pipes on remote machines, passing "pickled" Python code compressed with zlib. It caches unmodified modules in RAM after first use.

Q532. [Linux] What kernel parameter boots into single-user/rescue mode?

A: Append single, 1, or systemd.unit=rescue.target to the kernel command line in GRUB.

Q533. [Linux] What is the difference between symmetric and asymmetric routing?

A: Symmetric: packets take the same path in both directions. Asymmetric: packets take different paths. Asymmetric routing can cause issues with stateful firewalls and reverse path filtering (rp_filter).

Q534. [Python] What is contextlib.ExitStack used for?

A: It is a context manager that manages a dynamic collection of other context managers and cleanup functions. It is useful when you don't know at coding time how many context managers you need.

Q535. [Python] What is uvloop?

A: A fast, drop-in replacement for asyncio's event loop, written in Cython and based on libuv. It can make asyncio 2-4x faster.

Q536. [Linux] What does the term "distro-hopping" mean?

A: The practice of frequently switching between Linux distributions, common among new Linux users exploring the ecosystem.

Q537. [Linux] What is systemd-resolved?

A: systemd's DNS resolver daemon. It provides a local DNS stub listener at 127.0.0.53, supports DNSSEC, DNS-over-TLS, and LLMNR. Configured via resolvectl or /etc/systemd/resolved.conf.

Q538. [Python] How do you set the precision for decimal.Decimal operations?

A: Via decimal.getcontext().prec = n. The default precision is 28 significant digits.

Q539. [Python] What does sys.argv contain?

A: A list of command-line arguments passed to the script. sys.argv[0] is the script name.

Q540. [Linux] What is a gratuitous ARP?

A: An ARP reply sent without being requested, used to announce an IP address change, update ARP caches after failover, or detect IP conflicts. Important in high-availability setups.


Batch 55

Q541. [Ansible] What is a Fully Qualified Collection Name (FQCN), and why does it matter post-migration?

A: An FQCN is the complete namespace.collection.module_name identifier (e.g., ansible.builtin.copy, community.general.docker_container). After the migration, FQCNs became the authoritative way to specify which collection a module comes from, preventing ambiguity when multiple collections provide similarly-named modules.

Q542. [Ansible] What is become_user?

A: Specifies which user to escalate to (default is root).

Q543. [Python] What is the http.server module used for?

A: A simple HTTP server: python -m http.server 8000 serves the current directory. It is intended for development only, not production.

Q544. [Python] What is sdist in Python packaging?

A: Source distribution — a tarball (.tar.gz) containing the source code and build instructions. Unlike wheels, sdists require building during installation.

Q545. [Linux] What is the purpose of /dev?

A: Device files — special files representing hardware and virtual devices. Managed by udev. Contains block devices (disks), character devices (terminals), and special files (/dev/null, /dev/zero, /dev/urandom).

Q546. [Ansible] What is the set_fact module's cacheable option?

A: When cacheable: true, the fact is stored in the fact cache and persists across playbook runs (if fact caching is enabled).

Q547. [Python] What is collections.abc.Coroutine?

A: An abstract base class for coroutine objects (those created by async def functions). It defines send(), throw(), and close() methods.

Q548. [Linux] What was Dirty COW?

A: CVE-2016-5195 — a race condition in the kernel's copy-on-write (COW) mechanism in memory management that allowed unprivileged local users to gain write access to read-only memory mappings, enabling privilege escalation.

Q549. [Linux] What was Ubuntu's first release?

A: Ubuntu 4.10 "Warty Warthog," released October 20, 2004. It was founded by Mark Shuttleworth and developed by Canonical.

Q550. [Python] What is the property built-in?

A: A descriptor that lets you define getter, setter, and deleter methods for an attribute. It provides a Pythonic alternative to Java-style getter/setter methods: @property for the getter, @attr.setter for the setter. --- ## 6. Iterators, Generators & Functional


Batch 56

Q551. [Python] What are exception groups, introduced in Python 3.11?

A: ExceptionGroup and BaseExceptionGroup allow raising and handling multiple unrelated exceptions simultaneously. They are caught with the new except* syntax.

Q552. [Ansible] What is Jinja2 in the context of Ansible?

A: The templating engine Ansible uses for dynamic content generation in templates and playbooks. It allows variables, filters, loops, and conditionals.

Q553. [Ansible] What port does WinRM use by default for Ansible Windows management?

A: Port 5985 for HTTP, port 5986 for HTTPS. ---

Q554. [Linux] Why does Stallman insist on calling the OS "GNU/Linux"?

A: Because the complete operating system includes GNU userland tools (compiler, shell, coreutils, C library) alongside the Linux kernel. Stallman argues calling it just "Linux" erases the GNU Project's foundational contributions.

Q555. [Linux] How do you find which package provides a file on RHEL?

A: dnf provides /path/to/file or rpm -qf /path/to/file for already installed files.

Q556. [Ansible] How do you generate an encrypted password for the user module?

A: ansible all -i localhost, -m debug -a "msg={{ 'password' | password_hash('sha512', 'salt') }}"

Q557. [Linux] What is the difference between dpkg and apt?

A: dpkg is the low-level tool that installs/removes .deb files without resolving dependencies. apt is the high-level tool that resolves dependencies, downloads from repositories, and calls dpkg.

Q558. [Python] What is the result of bool([])?

A: False. Empty sequences (list, tuple, string, dict, set) are falsy.

Q559. [Ansible] What is supports_check_mode in module development?

A: A boolean parameter passed to AnsibleModule() indicating the module can run in check (dry-run) mode. When True, the module should report what would change without making actual changes.

Q560. [Python] What is a TYPE_CHECKING guard?

A: if TYPE_CHECKING: is a block that only runs during type checking, not at runtime. Used for importing types needed only for annotations, avoiding circular imports.


Batch 57

Q561. [Linux] What is the difference between /tmp and /var/tmp?

A: /tmp is cleared on reboot (often tmpfs). /var/tmp persists across reboots and is for temporary files that should survive reboots (e.g., large downloads, package build files).

Q562. [Python] What does python -O do?

A: Runs Python with basic optimizations: removes assert statements and sets __debug__ to False. -OO also removes docstrings.

Q563. [Python] What is base64 encoding used for in Python?

A: Encoding binary data as ASCII text: base64.b64encode(data). Commonly used for embedding binary data in JSON, URLs, or email.

Q564. [Python] What is the standard library module for parsing command-line arguments?

A: argparse (since Python 3.2, replacing the older optparse).

Q565. [Linux] What is the correct way to edit the sudoers file?

A: Always use visudo, which validates syntax before saving. Editing /etc/sudoers directly risks syntax errors that can lock you out of sudo.

Q566. [Python] How does CPython implement dicts internally?

A: Using a compact hash table with two arrays: a sparse index array and a dense key-value array. This design (introduced in CPython 3.6) saves 20-25% memory compared to the old implementation.

Q567. [Linux] What is the fork() system call?

A: It creates a new child process that is a near-exact copy of the parent. The child gets a new PID but inherits the parent's memory (via COW), file descriptors, and environment. Fork returns 0 to the child and the child's PID to the parent.

Q568. [Ansible] What is the Ansiballz framework?

A: The mechanism Ansible uses to package Python modules for remote execution. It creates a zipfile containing the module file, imported module_utils files, and boilerplate code. This is Base64-encoded, wrapped in a small Python script, transferred to the remote host, and executed.

Q569. [Linux] What is the umask for a secure system?

A: umask 077 ensures new files are only accessible by the creating user (files get 600, directories get 700). Default of 022 allows group and others to read. --- ## 13. System Monitoring & Performance

Q570. [Python] What does functools.singledispatch do?

A: It provides single-dispatch generic functions — function overloading based on the type of the first argument. You register implementations for different types using @func.register(type).


Batch 58

Q571. [Linux] What is the difference between an interactive and non-interactive shell?

A: An interactive shell reads commands from the user (terminal). A non-interactive shell executes commands from a script or pipe. Interactive shells show prompts and enable job control.

Q572. [Ansible] What are the _raw_params in free-form modules?

A: The internal parameter name used by modules like command, shell, and raw that accept a free-form command string instead of structured key=value arguments.

Q573. [Python] What is a Pandas DataFrame?

A: A 2D labeled data structure with columns of potentially different types, similar to a spreadsheet or SQL table.

Q574. [Python] What does __subclasshook__ do?

A: An ABC classmethod that customizes issubclass() behavior. It can return True, False, or NotImplemented to override the default subclass check.

Q575. [Linux] What is dm-crypt?

A: A kernel device-mapper target that provides transparent encryption of block devices. LUKS uses dm-crypt as its backend. cryptsetup is the userspace tool for managing LUKS volumes.

Q576. [Linux] What is chage used for?

A: Manages password aging policies per user. chage -l user lists policy. chage -M 90 user sets maximum password age to 90 days. chage -E 2026-12-31 user sets account expiry date.

Q577. [Linux] What programming language is the Linux kernel primarily written in?

A: C, with some assembly for architecture-specific code. As of kernel 6.1, Rust was introduced as a second supported language for new driver development.

Q578. [Python] What is the difference between a += b and a = a + b for lists?

A: For lists, += modifies the list in-place (calls __iadd__), while a = a + b creates a new list. This matters when other variables reference the same list.

Q579. [Ansible] How does an event payload get passed to a triggered playbook?

A: Through the event variable, which contains the full event payload accessible in playbook tasks (e.g., event.payload.message).

Q580. [Linux] What is the difference between fdisk, parted, and gdisk?

A: fdisk: traditional partitioning tool, supports MBR and GPT. parted: supports MBR and GPT with resize capability. gdisk: GPT-specific tool (like fdisk but for GPT only).


Batch 59

Q581. [Python] What does itertools.takewhile(predicate, iterable) do?

A: It yields elements from the beginning as long as the predicate is true, then stops entirely at the first false element.

Q582. [Ansible] What is changed_when: false used for?

A: Marks a task as never having made changes, useful for read-only commands that should not show as "changed" in output. ---

Q583. [Python] What is the collections.OrderedDict popitem(last=True) method?

A: It removes and returns a (key, value) pair. With last=True (default), it removes from the end (LIFO). With last=False, it removes from the beginning (FIFO).

Q584. [Python] What is the difference between Pandas and Polars?

A: Pandas uses NumPy arrays internally and runs single-threaded. Polars uses Apache Arrow memory format, supports lazy evaluation, and automatically parallelizes operations across CPU cores. --- ## 18. Python Easter Eggs & WAT Moments

Q585. [Ansible] Why do Ansible community package version numbers jump from 2.10 to 3.0, 4.0, etc., while ansible-core continues with 2.11, 2.12, etc.?

A: The community package adopted a new versioning scheme (3.x, 4.x, 5.x...) to differentiate it from ansible-core versioning. ansible-core continues the 2.x line. For example, Ansible 4.0.0 shipped with ansible-core 2.11, Ansible 5.0.0 with ansible-core 2.12, and so on.

Q586. [Linux] What is the maximum number of file descriptors per process?

A: Controlled by ulimit -n (soft limit, default 1024) and /proc/sys/fs/nr_open (hard limit, default 1048576). Can be set per-service in systemd with LimitNOFILE=.

Q587. [Linux] What is the relationship between RHEL, CentOS, Rocky Linux, and AlmaLinux?

A: CentOS was a free rebuild of RHEL source. In 2020, Red Hat shifted CentOS to CentOS Stream (a rolling preview of RHEL). Rocky Linux (founded by CentOS co-founder Gregory Kurtzer) and AlmaLinux (backed by CloudLinux) emerged as 1:1 RHEL-compatible replacements.

Q588. [Python] What happens when you multiply a list: [[]] * 3?

A: You get [[], [], []], but all three inner lists are the SAME object. Modifying one modifies all: a = [[]] * 3; a[0].append(1) gives [[1], [1], [1]].

Q589. [Linux] What is FIPS mode in Linux?

A: Federal Information Processing Standards compliance mode, required by US government systems. Restricts the system to FIPS-approved cryptographic algorithms. Enabled via fips=1 kernel parameter on RHEL.

Q590. [Ansible] What happened to with_items, with_dict, with_fileglob etc.?

A: They still work but are considered legacy. The modern replacement is the loop keyword combined with filters: loop: "{{ my_list }}", loop: "{{ my_dict | dict2items }}", loop: "{{ query('fileglob', '*.conf') }}".


Batch 60

Q591. [Linux] What is the difference between /dev/random and /dev/urandom in practice?

A: On modern kernels (5.6+), they are equivalent for cryptographic purposes once initially seeded. Use /dev/urandom — it never blocks and is cryptographically secure. /dev/random blocking behavior was an unnecessary precaution.

Q592. [Ansible] What is the "two-stage" or "delegate and register" pattern?

A: Running a task on one host (via delegate_to), registering the result, and using that result on the original host. Common for checking load balancer status before making changes to a backend server.

Q593. [Ansible] What are the four verbosity levels in Ansible?

A: -v (verbose -- task results), -vv (more verbose -- task input), -vvv (even more -- connection debugging), -vvvv (maximum -- includes connection plugin details and local script execution).

Q594. [Python] What is the difflib module?

A: It provides tools for comparing sequences: unified_diff() and context_diff() for text comparisons, SequenceMatcher for computing similarity ratios.

Q595. [Linux] What does ${var:=default} do?

A: Returns $var if set and non-null, otherwise assigns default to var AND returns it.

Q596. [Linux] What does free show?

A: Memory usage: total, used, free, shared, buffers, cache, and available. free -h for human-readable output.

Q597. [Linux] What does /proc/net/ contain?

A: Network-related pseudo-files: tcp and tcp6 (open TCP connections), udp, arp, route, dev (interface statistics), snmp (protocol statistics), sockstat (socket summary).

Q598. [Linux] What is ARP?

A: Address Resolution Protocol — maps IPv4 addresses to MAC addresses on a local network. View the ARP cache with ip neigh show.

Q599. [Linux] What is the curl -v flag useful for?

A: Verbose mode showing the complete request/response cycle: DNS resolution, TCP connection, TLS handshake, request headers, response headers, and body. Essential for HTTP debugging.

Q600. [Linux] What is the format of /etc/shadow?

A: username:encrypted_password:last_change:min_age:max_age:warn:inactive:expire:reserved. Nine colon-separated fields. Only readable by root.


Batch 61

Q601. [Linux] What does the nsenter command do?

A: Enters an existing namespace of a running process. For example, nsenter -t <PID> -n bash enters the network namespace of process PID.

Q602. [Linux] What does systemctl mask do?

A: Creates a symlink to /dev/null, making it impossible to start the unit (manually or as a dependency). Stronger than disable. Undo with systemctl unmask.

Q603. [Python] What does itertools.combinations('ABCD', 2) return?

A: An iterator of 2-element tuples containing all unique combinations without repetition: ('A','B'), ('A','C'), ('A','D'), ('B','C'), ('B','D'), ('C','D').

Q604. [Linux] What was the first version number of the Linux kernel?

A: Linux 0.01, released September 17, 1991. It was not publicly announced; only 0.02 (October 1991) was posted to comp.os.minix.

Q605. [Python] What is DeprecationWarning vs PendingDeprecationWarning?

A: DeprecationWarning is for features scheduled for removal. PendingDeprecationWarning is for features that may be deprecated in the future. By default, DeprecationWarning is shown in __main__ but hidden in imported modules.

Q606. [Ansible] How do you access a variable of the first host in a group?

A: {{ hostvars[groups['webservers'][0]]['ansible_eth0']['ipv4']['address'] }}

Q607. [Linux] What is a man page section number system?

A: 1=user commands, 2=system calls, 3=library functions, 4=special files, 5=file formats, 6=games, 7=miscellaneous, 8=system administration. Access with man 5 passwd for the passwd file format.

Q608. [Linux] What is runc?

A: The reference implementation of the OCI runtime specification. It creates and runs containers using Linux namespaces, cgroups, and seccomp. Both Docker and Podman use it (or compatible alternatives like crun).

Q609. [Linux] What is the difference between shutdown, halt, poweroff, and reboot?

A: shutdown gracefully notifies users and stops services before halting/rebooting (safest). halt stops the CPU. poweroff stops the CPU and powers off the machine. reboot restarts. On systemd systems, all ultimately call systemctl.

Q610. [Ansible] What does the hosts keyword define in a play?

A: The target hosts or groups that the play will execute against.


Batch 62

Q611. [Ansible] What language is Ansible written in?

A: Python (and PowerShell for Windows modules).

Q612. [Linux] What does $* contain?

A: All positional parameters. When double-quoted ("$*"), all parameters are joined into a single word separated by the first character of IFS.

Q613. [Python] What are namespace packages?

A: Packages without __init__.py (PEP 420, Python 3.3). They allow a single logical package to be split across multiple directories or even distributions.

Q614. [Ansible] What is removes parameter in command/shell modules?

A: If the specified file does NOT exist, the task is skipped. The inverse of creates.

Q615. [Python] What is Timsort?

A: The sorting algorithm used by Python's sorted() and list.sort(). Designed by Tim Peters in 2002, it is a hybrid merge sort/insertion sort with O(n log n) worst case and O(n) best case for partially sorted data. Adopted by Java, Android, and other platforms.

Q616. [Ansible] What is the difference between a Galaxy role and a Galaxy collection?

A: A role is a structured set of tasks, handlers, vars, templates, and files for a specific purpose. A collection is a broader distribution format that can contain roles, modules, plugins, playbooks, and documentation -- it is the modern packaging standard post-2.10.

Q617. [Linux] What is iSCSI?

A: Internet Small Computer Systems Interface — a protocol that allows SCSI commands to be sent over TCP/IP networks, providing block-level access to remote storage. Uses initiators (clients) and targets (servers).

Q618. [Ansible] What port does Ansible use by default for SSH connections?

A: Port 22 (standard SSH). Configurable via ansible_port per host or remote_port in ansible.cfg.

Q619. [Ansible] What is the ansible_date_time fact?

A: A fact containing the managed host's date/time in multiple formats: date, time, epoch, iso8601, tz, weekday, year, month, day, hour, minute, second, and more.

Q620. [Ansible] What is the deprecation cycle length in ansible-core for features?

A: Features are deprecated across 4 feature releases and normally removed in the 4th release after deprecation. For example, something deprecated in 2.10 would be removed in 2.14. ---


Batch 63

Q621. [Ansible] What are Vault IDs?

A: Labels that allow using multiple vault passwords in a single playbook run, enabling different encryption keys for different secrets.

Q622. [Python] What is the difference between bisect.bisect_left() and bisect.bisect_right()?

A: bisect_left() returns the leftmost position where an element can be inserted to keep the list sorted (before any existing equal elements), while bisect_right() returns the rightmost position (after existing equal elements). bisect() is an alias for bisect_right().

Q623. [Linux] What replaces ifconfig in the ip command suite?

A: ip addr show (or ip a) replaces ifconfig. ip route replaces route. ip neigh replaces arp. ip link replaces ifconfig for interface state management.

Q624. [Ansible] How does block/rescue/always work in Ansible?

A: block groups tasks. If any task in the block fails, execution jumps to the rescue section. The always section runs regardless of success or failure, similar to try/catch/finally in programming.

Q625. [Python] What is shutil.copytree() used for?

A: Recursively copying an entire directory tree. It supports ignore patterns and dirs_exist_ok (Python 3.8+) to copy into an existing directory.

Q626. [Python] What is __init_subclass__ used for?

A: A hook method called when a class is subclassed. It allows the parent class to customize subclass creation without a metaclass. Added in Python 3.6 (PEP 487).

Q627. [Ansible] What is the "pre_tasks / post_tasks" idiom for rolling updates?

A: pre_tasks remove a host from a load balancer, the main roles/tasks deploy updates, and post_tasks re-add the host to the load balancer.

Q628. [Linux] How do you create a virtual Ethernet pair (veth)?

A: ip link add veth0 type veth peer name veth1 — creates two connected virtual interfaces. Moving one end to a network namespace creates a connection between namespaces. Fundamental to container networking.

Q629. [Python] What is the typing.Self type, and when was it introduced?

A: Added in Python 3.11 (PEP 673), Self is used in method return annotations to indicate the method returns an instance of the enclosing class.

Q630. [Ansible] What does the setup module do?

A: Gathers facts (system information) from managed nodes -- OS details, IP addresses, memory, disk, CPU, etc.


Batch 64

Q631. [Python] What is Pandas groupby() used for?

A: Splitting a DataFrame into groups based on column values, applying a function to each group, and combining results — the "split-apply-combine" pattern.

Q632. [Linux] What is /etc/resolv.conf?

A: Contains DNS resolver configuration: nameserver (IP of DNS server, up to 3), search (domain search list), and options (timeout, attempts, etc.). Often managed by NetworkManager or systemd-resolved.

Q633. [Python] When did Guido van Rossum start working on Python?

A: Late December 1989, during Christmas vacation at CWI in Amsterdam. He was looking for a hobby programming project to keep him occupied.

Q634. [Ansible] What is callback plugin timer?

A: Shows the total playbook execution time.

Q635. [Ansible] What is vars_prompt?

A: A play-level directive that prompts the user for input at playbook start. Supports private (hide input), default, confirm, and encrypt options.

Q636. [Ansible] What is meta: flush_handlers?

A: Forces all pending handlers to execute immediately, rather than waiting until the end of the play.

Q637. [Ansible] What is the ansible.builtin.script module?

A: Transfers and executes a local script on the remote host. The script runs in the remote host's shell.

Q638. [Python] Why are NumPy operations faster than Python loops?

A: NumPy operations are implemented in C and operate on contiguous memory arrays, avoiding Python's per-element type checking and interpreter overhead. This is called vectorization.

Q639. [Python] What does python -v do?

A: Verbose mode — prints a message each time a module is imported, showing which file is loaded.

Q640. [Linux] What is copy-on-write (COW)?

A: A memory optimization where forked processes initially share the same physical pages as the parent. Pages are only copied when one process writes to them, reducing memory usage and fork time.


Batch 65

Q641. [Linux] What is the difference between Layer 4 and Layer 7 load balancing?

A: Layer 4 (transport): routes based on IP and port, fast, cannot inspect content. Layer 7 (application): routes based on HTTP headers, URLs, cookies — more flexible but higher overhead.

Q642. [Ansible] How do you debug a failing Ansible task?

A: Increase verbosity (-vvv), use debug module to inspect variables, use register to capture output, run in check mode, isolate with --limit and --start-at-task, and check system logs.

Q643. [Python] What does Counter.elements() return?

A: An iterator over elements, each repeated as many times as its count. Elements with zero or negative counts are excluded.

Q644. [Linux] What is the /etc/skel directory?

A: The skeleton directory — its contents are copied to a new user's home directory at creation time. Contains default .bashrc, .profile, and other dotfiles.

Q645. [Ansible] What are the main components of Ansible's architecture?

A: Control node, managed nodes, inventory, playbooks, modules, tasks, roles, handlers, variables, facts, plugins, and the Ansible configuration file (ansible.cfg).

Q646. [Linux] When would you choose Btrfs?

A: When you need built-in snapshots, checksumming for data integrity, transparent compression, or send/receive for backups. Good for desktop and NAS use cases.

Q647. [Linux] What does the ip -s link show command display?

A: Interface statistics including RX/TX bytes, packets, errors, dropped, overruns, and carrier errors. Useful for diagnosing network interface problems.

Q648. [Ansible] What does ansible-pull require on each managed node?

A: Ansible must be installed, along with Git (to clone the playbook repository) and any Python dependencies needed by the playbooks.

Q649. [Linux] What is the /proc/net/tcp file format?

A: Each line represents a TCP socket with hex-encoded local/remote addresses and ports, socket state, transmit/receive queue sizes, timer info, UID, inode, and more. ss reads this for its output.

Q650. [Linux] What is a firewalld zone?

A: A trust level for a network interface. Common zones: drop (drop all incoming), block (reject all incoming), public (default, limited incoming), trusted (accept all), dmz, home, work, internal.


Batch 66

Q651. [Ansible] What is ansible-pull and how does it invert Ansible's normal model?

A: Instead of a central control node pushing to targets, each target runs ansible-pull to clone a Git repository containing playbooks and execute them locally. This creates a pull-based (agent-like) model.

Q652. [Python] What is a positive lookahead in regex?

A: (?=...) asserts that what follows matches the pattern, without consuming any characters. For example, foo(?=bar) matches foo only if followed by bar.

Q653. [Linux] What are the iptables chains in the filter table?

A: INPUT (packets destined for the local host), FORWARD (packets routed through the host), OUTPUT (packets generated by the local host).

Q654. [Ansible] What is the default Ansible strategy?

A: linear -- tasks execute in order on all hosts before moving to the next task.

Q655. [Ansible] What is the push-based model in Ansible?

A: The control node initiates connections and pushes configurations to managed nodes, as opposed to pull-based models where agents on nodes poll a central server.

Q656. [Linux] What does vm.swappiness control?

A: How aggressively the kernel swaps memory pages to disk (0-200, default 60). Lower values prefer keeping data in RAM and evicting file cache. 0 means swap only to avoid OOM. Higher values swap more aggressively.

Q657. [Ansible] What is an "action plugin" and how does it differ from a module?

A: An action plugin runs on the control node before (and sometimes instead of) the module on the remote host. Some modules are actually action plugins in disguise (e.g., template, copy, fetch). The action plugin handles local processing and file transfer, while the module handles remote state.

Q658. [Linux] What is Secure Boot?

A: A UEFI feature that verifies the cryptographic signature of boot loaders and kernels before execution, preventing unsigned or tampered code from running. Linux distros use Microsoft-signed shim bootloaders for compatibility.

Q659. [Ansible] How do you access nested variables?

A: Use dot notation ({{ user.address.city }}) or bracket notation ({{ user['address']['city'] }}).

Q660. [Linux] What does exit code 127 mean?

A: Command not found.


Batch 67

Q661. [Ansible] What are Surveys in AWX/automation controller?

A: Interactive forms that prompt users for input when launching a job template, passing responses as extra variables. They support text, passwords, dropdowns, multiple choice, integers, and floats.

Q662. [Linux] What is XFS?

A: A high-performance 64-bit journaling filesystem originally developed by SGI. Known for excellent parallel I/O, allocation group-based design, online growth (but not shrinking), and reflink/COW support.

Q663. [Linux] What is PID 1, and why is it special?

A: PID 1 is the init process (systemd on modern systems). It is the ancestor of all user-space processes, adopts orphaned processes, and cannot be killed by signals it does not explicitly handle. If PID 1 dies, the kernel panics.

Q664. [Linux] What is the difference between crontab -e and /etc/crontab?

A: crontab -e edits the per-user crontab (stored in /var/spool/cron/). /etc/crontab is the system-wide crontab that includes a user field (which user to run as) and uses a slightly different format.

Q665. [Linux] What is the conntrack command?

A: Manages the kernel's connection tracking table (used by stateful firewalling in iptables/nftables). conntrack -L lists tracked connections. conntrack -F flushes the table.

Q666. [Python] Can you match against object attributes in Python's pattern matching?

A: Yes. Class patterns like case Point(x=0, y=y) can destructure objects by matching against their attributes.

Q667. [Linux] What is the Year 2038 problem?

A: 32-bit time_t (signed) overflows on January 19, 2038 03:14:07 UTC. Linux has migrated to 64-bit time on 64-bit systems. 32-bit systems need kernel and library patches.

Q668. [Python] What is functools.reduce with an initial value?

A: reduce(func, iterable, initializer) starts accumulation from the initializer instead of the first element. Without it, an empty iterable raises TypeError.

Q669. [Python] What method on a namedtuple returns a regular dictionary?

A: ._asdict(). Despite the leading underscore, it is part of the public API — the underscore prevents name conflicts with field names.

Q670. [Ansible] What is the FQCN for the AWS EC2 module?

A: amazon.aws.ec2_instance (or amazon.aws.ec2 for the legacy version).


Batch 68

Q671. [Python] When did dict ordering become a language guarantee?

A: Python 3.7 (it was an implementation detail in CPython 3.6). Dicts maintain insertion order as part of the language spec.

Q672. [Python] Where do "spam" and "eggs" come from as Python variable names?

A: From Monty Python's famous "Spam" sketch, where everything on the menu contains spam. They replace the traditional "foo" and "bar" in Python examples.

Q673. [Ansible] What is AWX?

A: The open-source upstream project for Ansible Tower. Ideal for development and testing; lacks enterprise support and hardening.

Q674. [Linux] What command lists currently loaded kernel modules?

A: lsmod, which reads from /proc/modules.

Q675. [Ansible] How are lookup plugins different from filter plugins in how they execute?

A: Lookup plugins run on the control node (not the remote host), pull data from external sources, and are expected to return lists. Filter plugins transform data inline within Jinja2 expressions.

Q676. [Python] What is MicroPython?

A: A lean Python 3 implementation designed to run on microcontrollers and constrained environments. It implements a subset of the standard library optimized for embedded systems.

Q677. [Python] When did Python 2 reach end of life?

A: January 1, 2020. Python 2.7.18 (April 2020) was the absolute final release.

Q678. [Ansible] What is a practical use case for async with poll > 0?

A: Long-running tasks that might exceed the SSH connection timeout, like large package installations. Ansible keeps polling the task status rather than holding the SSH connection open for the duration. ---

Q679. [Python] What does sys.intern(string) do?

A: It interns the string, ensuring only one copy exists in memory. Subsequent equal strings will be the same object, enabling is comparisons instead of == for performance.

Q680. [Ansible] What tool is used to build Execution Environments?

A: ansible-builder. It reads an execution-environment.yml definition file and uses a container runtime (podman or docker) to build the EE image.


Batch 69

Q681. [Python] What does functools.cmp_to_key do?

A: It converts an old-style comparison function (that returns -1, 0, or 1) into a key function suitable for sorted(), min(), max(), etc. This bridges the gap from Python 2's cmp parameter.

Q682. [Ansible] What Python version does ansible-core 2.16 require on the control node?

A: Python 3.10+.

Q683. [Ansible] What are the server requirements for Ansible?

A: The control node requires Linux/macOS with Python 2.6+ (or Python 3.5+). Managed nodes need SSH access and Python. Windows managed nodes need WinRM and PowerShell.

Q684. [Linux] What is $0?

A: The name of the script or shell.

Q685. [Linux] How do you view logs with journalctl?

A: journalctl shows all logs. -u <service> filters by unit. -b shows current boot. --since "1 hour ago" filters by time. -p err shows priority err and above. -f follows (like tail -f). -k shows kernel messages.

Q686. [Ansible] What is fact caching and what backends are supported?

A: Fact caching stores gathered facts between playbook runs. Backends include jsonfile, redis, memcached, mongodb, and yaml. ---

Q687. [Python] What does hash(float('inf')) return?

A: 314159 in CPython — a reference to pi.

Q688. [Linux] What is virtio?

A: A paravirtualization standard for I/O in virtual machines. virtio devices (network, disk, memory, GPU) provide near-native performance by avoiding full hardware emulation. Used by KVM/QEMU.

Q689. [Python] What does type(...) return?

A: <class 'ellipsis'>. The ... literal is the singleton Ellipsis object.

Q690. [Python] What is pathlib.Path.resolve() used for?

A: It returns the absolute path with all symlinks resolved and .. components eliminated.


Batch 70

Q691. [Ansible] What has the lowest variable precedence?

A: Command line values (e.g., -u my_user), followed by role defaults (roles/x/defaults/main.yml).

Q692. [Python] What does collections.deque(maxlen=n) do when you append beyond capacity?

A: It automatically discards elements from the opposite end. Appending to the right discards from the left, and vice versa. This creates a bounded buffer.

Q693. [Ansible] What is the difference between lookup() and query() in Ansible?

A: query() always returns a list. lookup() returns a comma-separated string by default (unless wantlist=True is passed). query() is the preferred modern form. ---

Q694. [Python] What is YAML handling in Python?

A: The pyyaml library is the standard. Use yaml.safe_load() (not yaml.load()) to avoid arbitrary code execution from untrusted YAML.

Q695. [Ansible] How do you handle multiple environments (dev, staging, prod)?

A: Create separate inventory files per environment, use environment-specific group_vars and host_vars, and specify the appropriate inventory with -i at runtime.

Q696. [Ansible] What does the groups magic variable contain?

A: A dictionary mapping every group name in the inventory to a list of hosts in that group. For example, groups['webservers'] returns all hosts in the webservers group.

Q697. [Python] What standard library module provides an interface to the operating system's random number generator?

A: os.urandom() provides raw random bytes. The secrets module (added in Python 3.6) wraps this in a more convenient API.

Q698. [Linux] What is a rootless container?

A: A container running entirely under an unprivileged user (no root daemon). Uses user namespaces to map container root to an unprivileged host UID. Podman supports this natively; Docker requires additional configuration.

Q699. [Python] What is int.as_integer_ratio() added in Python 3.8?

A: It returns a pair of integers (numerator, denominator) equal to the integer with a positive denominator: (10).as_integer_ratio() returns (10, 1).

Q700. [Ansible] How does the YAML octal gotcha specifically bite Ansible users?

A: Most commonly with file permission modes. Writing mode: 0644 works as expected because 0644 octal is what you want. But writing mode: 644 (no leading zero) gives you decimal 644, which is octal 1204 -- not what you wanted. Best practice: always quote file modes as strings: mode: "0644".


Batch 71

Q701. [Python] How do you create a named tuple with collections.namedtuple?

A: Point = namedtuple('Point', ['x', 'y']) or equivalently with a space-separated string 'x y'. Instances are immutable tuples with named fields.

Q702. [Python] What is PyData?

A: A conference series (with events worldwide) focused on data science, machine learning, and analytics in the Python ecosystem. Organized by NumFOCUS.

Q703. [Ansible] What is the INJECT_FACTS_AS_VARS configuration?

A: When true (default), facts are injected as top-level variables (e.g., ansible_hostname). When false, facts are only accessible via ansible_facts['hostname']. Disabling it reduces variable namespace pollution and improves security.

Q704. [Ansible] How do you install a collection from a specific Git repository?

A: ansible-galaxy collection install git+https://github.com/org/repo.git,branch_or_tag

Q705. [Ansible] What is ansible_become_method and what options exist besides sudo?

A: The privilege escalation method. Options: sudo (default), su, pbrun, pfexec, doas, dzdo, ksu, runas (Windows), enable (network devices), machinectl (systemd).

Q706. [Python] What is the io module?

A: It provides Python's main I/O implementation with text streams (TextIOWrapper), binary streams (BufferedReader, BufferedWriter), and raw I/O (FileIO).

Q707. [Linux] What is a Linux "spin" or "flavor"?

A: A variant of a distribution with a different default desktop environment or package selection, such as Kubuntu (Ubuntu with KDE) or Fedora Spins.

Q708. [Python] What is the difference between None and False?

A: None is the singleton representing absence of a value (NoneType). False is a boolean. Both are falsy, but None is not False evaluates to True.

Q709. [Python] What is pytest.monkeypatch?

A: A built-in fixture for safely modifying objects, dictionaries, and environment variables during tests: monkeypatch.setattr(), monkeypatch.setenv(), etc.

Q710. [Ansible] What are network resource modules?

A: Modules that manage specific network resource configurations (interfaces, VLANs, ACLs, etc.) through a declarative state-based model with states like merged, replaced, overridden, deleted, and gathered.


Batch 72

Q711. [Ansible] What is ansible-navigator?

A: A modern text-based user interface (TUI) for running and developing Ansible content. It can run playbooks inside execution environments and provides interactive exploration of playbook results, inventory, and documentation.

Q712. [Python] What is PyInstaller?

A: A tool that packages Python applications into standalone executables, bundling the interpreter and all dependencies.

Q713. [Python] What module provides functions for working with temporary files and directories?

A: The tempfile module, with NamedTemporaryFile, TemporaryDirectory, mkstemp(), and mkdtemp().

Q714. [Ansible] Where do set_facts and registered variables fall in the precedence order?

A: Level 19 -- very high, above include_vars, block vars, task vars, and role vars. Only role parameters, include parameters, and extra vars can override them.

Q715. [Ansible] What does loop_control: extended provide?

A: Access to ansible_loop.allitems, ansible_loop.index, ansible_loop.index0, ansible_loop.first, ansible_loop.last, ansible_loop.length, ansible_loop.revindex, ansible_loop.revindex0.

Q716. [Ansible] How is ansible-pull typically scheduled?

A: Via a cron job (commonly every 15-30 minutes). Example: */30 * * * * ansible-pull -U git@repo.example.com/config.git

Q717. [Linux] What is a page table?

A: A hierarchical data structure (4 or 5 levels on x86-64) that maps virtual addresses to physical page frames. Each entry (PTE) contains the physical frame number and flags (present, read/write, user/supervisor, dirty, accessed).

Q718. [Linux] What is reverse path filtering?

A: A security feature (net.ipv4.conf.all.rp_filter) that drops packets arriving on an interface if the source address would not be routed back through that same interface. Prevents IP spoofing. Values: 0=disabled, 1=strict, 2=loose.

Q719. [Linux] What does touch actually do?

A: Updates the access and modification timestamps of a file. If the file doesn't exist, it creates an empty file. Not primarily a file creation tool, despite common use.

Q720. [Python] What is importlib used for?

A: Programmatic control of Python's import system — importing modules by name string, reloading modules, finding loaders, and customizing import behavior.


Batch 73

Q721. [Python] What is operator.methodcaller() used for?

A: It creates a callable that calls a method: methodcaller('lower') is equivalent to lambda x: x.lower(). Can also pass arguments.

Q722. [Linux] What is a "magic SysRq key"?

A: A kernel-level key combination (Alt+SysRq+key) for emergency actions even when the system is unresponsive. "REISUB" is the safe reboot sequence: unRaw, tErminate, kIll, Sync, Unmount, reBoot. Enabled via kernel.sysrq.

Q723. [Ansible] What is the difference between a playbook and an ad-hoc command?

A: Playbooks are YAML files with multiple organized tasks for complex, repeatable automation. Ad-hoc commands are one-off CLI commands for quick, simple tasks.

Q724. [Ansible] What is ansible_play_hosts?

A: A magic variable containing the list of active hosts in the current play (excludes failed hosts).

Q725. [Ansible] What is the environment keyword at the task/play/block level?

A: Sets environment variables for the remote execution context. Example: setting http_proxy, PATH, or LD_LIBRARY_PATH for tasks that need them on the remote host.

Q726. [Ansible] What keyword defines tasks in a playbook?

A: tasks:

Q727. [Linux] What are ports 3306, 5432, and 6379?

A: 3306 = MySQL/MariaDB, 5432 = PostgreSQL, 6379 = Redis.

Q728. [Linux] What is a here string?

A: <<< feeds a string directly as stdin: grep "pattern" <<< "$variable".

Q729. [Python] What does sys.getswitchinterval() return?

A: The thread switch interval in seconds (default 0.005 = 5ms). This controls how often the GIL is released to allow other threads to run.

Q730. [Ansible] How do AWX and Red Hat Ansible Automation Platform differ?

A: AWX is free/open-source for dev/test. Ansible Automation Platform (AAP) is the commercial, enterprise-grade solution with official Red Hat support, SLAs, security hardening, and additional components like Automation Hub and Event-Driven Ansible.


Batch 74

Q731. [Ansible] How do you write a conditional task in Ansible?

A: Use the when keyword: when: ansible_os_family == "Debian"

Q732. [Ansible] What is hostvars?

A: A dictionary containing variables for all hosts in the inventory, accessible via hostvars['hostname']['variable'].

Q733. [Ansible] What other tools did Michael DeHaan create before Ansible?

A: Cobbler (provisioning tool) and Func (remote command framework).

Q734. [Linux] What is a flame graph?

A: A visualization of profiled stack traces where the x-axis represents the proportion of time spent and the y-axis shows the call stack. Created by Brendan Gregg. Generated from perf record data using flamegraph.pl.

Q735. [Python] What is the difference between bytes and str in Python 3?

A: str holds Unicode text, bytes holds raw binary data. They are distinct types and cannot be mixed without explicit encoding/decoding.

Q736. [Linux] What is Tux?

A: The Linux mascot — a penguin. Created by Larry Ewing in 1996 using GIMP. Linus Torvalds suggested a penguin because he was bitten by a fairy penguin at an Australian zoo and thought penguins were "sitting around lounging" — a good vibe for an OS.

Q737. [Python] Does finally always execute?

A: Yes, even if there is a return, break, or continue in the try or except blocks. The only exception is if the process is killed by the OS or os._exit() is called.

Q738. [Ansible] What are the two display modes in ansible-navigator?

A: stdout mode (output goes directly to terminal, similar to traditional ansible-playbook) and interactive mode (TUI with navigable, drill-down views of playbook results).

Q739. [Python] Can the walrus operator be used in all expression contexts?

A: No. It cannot be used as a top-level statement (use regular = instead). It also has restrictions in comprehension scoping and augmented assignments.

Q740. [Python] What is asyncio.Queue?

A: An async-safe queue for producer-consumer patterns in asyncio code. Unlike queue.Queue (for threads), it uses await for get() and put().


Batch 75

Q741. [Linux] What is /proc/mounts?

A: Lists all currently mounted filesystems with device, mount point, filesystem type, and options. Equivalent to the output of mount command. Symlink to /proc/self/mounts.

Q742. [Python] What does struct.pack('>I', 1024) return?

A: It returns b'\x00\x00\x04\x00' — the integer 1024 packed as a big-endian unsigned 32-bit integer.

Q743. [Ansible] What is an Ansible role?

A: A structured way to organize playbooks into reusable, modular components following a standard directory structure containing tasks, handlers, templates, files, variables, and metadata.

Q744. [Python] What does re.findall() return when the pattern contains groups?

A: It returns a list of the groups (or tuples of groups if multiple groups exist), not the full matches. If there are no groups, it returns the full matches.

Q745. [Linux] What does the rd.break kernel parameter do?

A: It interrupts the boot process inside the initramfs before the root filesystem is mounted, dropping to an emergency shell. Useful for resetting a forgotten root password (the real root is at /sysroot).

Q746. [Python] What is __slots__ and why use it?

A: A class variable that explicitly declares instance attributes, replacing __dict__. It saves memory (no per-instance dict) and slightly speeds up attribute access. Instances cannot have attributes not listed in __slots__.

Q747. [Ansible] What does the copy module do?

A: Copies files from the control node to managed nodes.

Q748. [Ansible] What does ansible-vault rekey do?

A: Changes the encryption password on vault-encrypted files. Useful for password rotation. Can also change the vault ID with --new-vault-id.

Q749. [Ansible] What is the difference between AWX, Ansible Tower, and automation controller?

A: AWX is the open-source upstream. Ansible Tower was the Red Hat commercial product (now retired name). Automation controller is the current name within Ansible Automation Platform.

Q750. [Ansible] Can Ansible Vault encrypt an entire directory?

A: No. Vault operates on individual files. You must encrypt each file separately or use encrypt_string for individual variables.


Batch 76

Q751. [Linux] What is /sys/devices/?

A: The master tree of all devices in the system, organized by bus topology. /sys/class/ and /sys/block/ are symlinks into this hierarchy.

Q752. [Linux] Who is Richard Stallman, and what is his role in the Linux ecosystem?

A: Richard Stallman founded the GNU Project in 1983 and the Free Software Foundation in 1985. He created core userland tools (GCC, Bash, coreutils) that, combined with the Linux kernel, form a complete operating system.

Q753. [Ansible] Can you use multiple vault passwords in a single playbook run?

A: Yes. Pass multiple --vault-id options: ansible-playbook --vault-id dev@dev_pass --vault-id prod@prod_pass site.yml.

Q754. [Linux] What is the chvt command?

A: Changes the foreground virtual terminal (console): chvt 3 switches to tty3. Equivalent to pressing Ctrl+Alt+F3 but usable from scripts.

Q755. [Linux] What is /sys/block/?

A: Contains entries for each block device (sda, nvme0n1, etc.) with attributes like size, queue parameters, and partitions.

Q756. [Linux] What does exit code 0 mean?

A: Success. Any non-zero exit code indicates failure.

Q757. [Ansible] What is the default driver in modern Molecule?

A: The delegated driver (previously called default). Podman and Docker drivers are provided via separate packages like molecule-plugins.

Q758. [Python] What does PSF stand for?

A: Python Software Foundation — the non-profit organization that manages the Python programming language, owns its intellectual property, and supports the community.

Q759. [Python] What does typing.Unpack do?

A: Added in Python 3.11, it is used for typing variadic generics with TypeVarTuple, enabling typed variable-length tuple types and **kwargs typing.

Q760. [Python] What is concurrent.futures and when was it introduced?

A: Added in Python 3.2, it provides a high-level interface for asynchronous execution using ThreadPoolExecutor and ProcessPoolExecutor, both implementing a unified Future pattern.


Batch 77

Q761. [Python] What is str.isidentifier()?

A: It returns True if the string is a valid Python identifier. Use keyword.iskeyword() to additionally check if it is a reserved keyword.

Q762. [Ansible] Why was the monolithic repo problematic?

A: The core dev team was burdened with thousands of issues and PRs for thousands of components they could not even test. It slowed releases, made testing unwieldy, and prevented module maintainers from releasing independently.

Q763. [Ansible] What is an Ansible playbook?

A: A YAML file that defines a series of plays (each targeting a group of hosts and specifying tasks, variables, and handlers) to automate configuration and deployment.

Q764. [Linux] What is the /proc/1/cgroup trick for detecting containers?

A: Inside a container, /proc/1/cgroup shows cgroup paths containing "docker", "kubepods", or "containerd" instead of the default / seen on a bare host. Not foolproof but commonly used.

Q765. [Ansible] What happens when poll: 0 is set with async?

A: Ansible starts the task and immediately moves to the next task without waiting (fire-and-forget). The async task runs until it completes, fails, or times out.

Q766. [Ansible] What class attributes must a callback plugin define?

A: CALLBACK_VERSION, CALLBACK_TYPE (stdout, notification, or aggregate), and CALLBACK_NAME.

Q767. [Ansible] What is the assert module used for?

A: Validates conditions and fails the playbook with a custom message if assertions are not met. Useful for pre-flight checks.

Q768. [Ansible] What happened to AnsibleFest after 2022?

A: Starting in 2024, AnsibleFest was merged with Red Hat Summit into a combined "Red Hat Summit and AnsibleFest" event, rather than running as a separate standalone conference. ---

Q769. [Linux] What is the difference between GPT and MBR?

A: MBR (Master Boot Record) supports up to 4 primary partitions and 2TB disks. GPT (GUID Partition Table) supports up to 128 partitions, disks larger than 2TB, and includes a backup partition table. GPT requires UEFI (or a BIOS boot partition).

Q770. [Ansible] How does Ansible differ from Chef?

A: Ansible uses YAML and is agentless; Chef uses Ruby DSL and requires agent installation (client-server model). Ansible has a lower learning curve; Chef offers more flexibility for experienced users.


Batch 78

Q771. [Linux] What does whoami do?

A: Prints the effective username of the current user.

Q772. [Ansible] What is Mitogen for Ansible?

A: A completely redesigned UNIX connection layer that replaces Ansible's shell-centric SSH implementation with pure-Python equivalents using efficient remote procedure calls to persistent interpreters tunnelled over SSH.

Q773. [Python] What module provides memory-mapped file access?

A: The mmap module. It maps a file into memory, allowing file I/O via memory operations, which can be significantly faster for large files.

Q774. [Linux] What does vm.overcommit_memory control?

A: 0 = heuristic overcommit (default, kernel estimates). 1 = always overcommit (never fail malloc). 2 = don't overcommit (limit to swap + ratio of physical RAM). Setting 2 is used in environments requiring guaranteed memory. --- ## 17. Filesystem Hierarchy Standard

Q775. [Ansible] What is the gotcha with run_once and serial?

A: With serial, run_once executes once PER BATCH, not once for the entire play. If you have serial: 5 and 20 hosts, run_once executes 4 times (once per batch of 5). To truly run once, use when: inventory_hostname == ansible_play_hosts_all[0].

Q776. [Ansible] What is ansible_managed?

A: A special variable containing a string (configurable in ansible.cfg) used in templates to mark files as Ansible-managed: {{ ansible_managed }}

Q777. [Linux] What was the "Year of the Linux Desktop" meme?

A: A recurring joke/prediction in the Linux community that "this year" Linux will finally achieve mainstream desktop adoption. It has been predicted annually since the late 1990s.

Q778. [Linux] What is the ip -brief addr show command?

A: Shows a compact summary of all interfaces with their state and IP addresses. Much more readable than the full ip addr show output.

Q779. [Linux] What does resolvectl status show?

A: Current DNS resolver configuration from systemd-resolved: DNS servers, search domains, DNSSEC status, and per-link configuration. Replacement for checking /etc/resolv.conf directly.

Q780. [Python] How does CPython's garbage collector handle circular references?

A: It uses a generational garbage collector with three generations. Objects that survive collection are promoted to older generations, which are collected less frequently. It detects unreachable cycles by tracking container objects.


Batch 79

Q781. [Ansible] What are the gather_subset and gather_timeout options?

A: gather_subset limits which facts to collect (e.g., network, hardware, virtual, !facter). gather_timeout sets the maximum time for fact gathering.

Q782. [Ansible] What is fact caching?

A: Storing gathered facts between playbook runs to avoid re-gathering. Backends include jsonfile, redis, and memcached. Configured in ansible.cfg.

Q783. [Ansible] What types of errors do NOT trigger the rescue block?

A: Invalid task definitions (syntax errors) and unreachable hosts. Only task execution failures trigger rescue.

Q784. [Linux] What is the purpose of /etc?

A: Host-specific system configuration files. Everything in /etc should be text files (no binaries). Examples: /etc/fstab, /etc/passwd, /etc/ssh/sshd_config.

Q785. [Ansible] What does throttle do at the task level?

A: Limits the number of hosts executing that specific task simultaneously, regardless of the forks setting. Useful for tasks that hit rate-limited APIs or shared resources. ---

Q786. [Ansible] What is host_key_checking?

A: Controls whether Ansible verifies SSH host keys. Disabling it (host_key_checking = False) can speed up initial connections but reduces security.

Q787. [Ansible] What command initializes a new collection skeleton?

A: ansible-galaxy collection init namespace.collection_name

Q788. [Linux] What does apt-mark hold <package> do?

A: Prevents a package from being automatically upgraded. Equivalent to dnf versionlock add <package> on RHEL. --- ## 9. Shell & Bash Scripting

Q789. [Python] What is typing.NamedTuple and how does it compare to collections.namedtuple?

A: typing.NamedTuple is a class-based syntax for named tuples that supports type annotations: class Point(NamedTuple): x: int; y: int. It is more readable and type-checker-friendly than the functional namedtuple() form.

Q790. [Python] What does float('inf') represent?

A: Positive infinity, per IEEE 754. It is greater than any other number. float('-inf') is negative infinity. float('nan') is Not a Number.


Batch 80

Q791. [Python] What does re.compile() return and why use it?

A: It returns a compiled regular expression pattern object. Compiling is useful when you reuse the same pattern many times. Python caches recently used patterns internally.

Q792. [Ansible] What was significant about Ansible 1.0, and when was it released?

A: Ansible 1.0 was released in early 2013 (around February). It marked the project's first stable release, establishing the core push-based, agentless, SSH-driven architecture.

Q793. [Ansible] What is the Ansible Lightspeed "intelligent assistant"?

A: A generative AI chat assistant embedded within AAP that helps administrators install, configure, maintain, and optimize Ansible Automation Platform, and helps operators troubleshoot automation jobs.

Q794. [Ansible] Can Ansible use SSH to manage Windows?

A: Yes, since Windows 10/Server 2019 include OpenSSH. However, WinRM remains the primary and most mature connection method.

Q795. [Python] What is hatch?

A: A modern Python project manager and build backend. It manages environments, builds packages, publishes to PyPI, and runs scripts.

Q796. [Linux] What is the shebang (#!)?

A: The first line of a script (e.g., #!/bin/bash or #!/usr/bin/env python3) that tells the kernel which interpreter to use. #!/usr/bin/env is preferred for portability as it searches PATH.

Q797. [Python] What template engine does Django use by default?

A: The Django Template Language (DTL), though it also supports Jinja2 as an alternative backend.

Q798. [Ansible] Can you encrypt only specific variables in a file?

A: Yes, using ansible-vault encrypt_string to create inline encrypted values within an otherwise plaintext YAML file.

Q799. [Linux] What does 0 0 1 * * mean in cron?

A: Run at midnight on the first day of every month.

Q800. [Ansible] What is ansible_host?

A: An inventory variable that specifies the actual IP/hostname to connect to, overriding the inventory name.


Batch 81

Q801. [Ansible] What is the win_updates module used for?

A: Installing Windows updates by category (Security, Critical, etc.). The win_hotfix module handles individual hotfix files.

Q802. [Linux] What does mtr do?

A: Combines ping and traceroute into a single tool that continuously displays per-hop statistics (packet loss, latency, jitter). More informative than either tool alone for network troubleshooting.

Q803. [Linux] What is the difference between reboot and shutdown -r now?

A: Functionally equivalent on modern systemd systems. shutdown provides the ability to schedule reboots (shutdown -r +10 "message") and notify logged-in users. Both ultimately call systemctl reboot.

Q804. [Linux] What is the difference between su and sudo?

A: su switches to another user entirely (requires that user's password, or root's for su). sudo runs a single command as another user (requires the caller's password, authorization via sudoers). sudo provides better auditing and granular control.

Q805. [Python] What PEP introduced type hints to Python?

A: PEP 484, accepted in Python 3.5. It introduced the typing module.

Q806. [Python] What is os._exit() and when is it used?

A: It exits immediately without cleanup (no atexit handlers, no flushing buffers, no finally blocks). Used in child processes after os.fork() to avoid running parent cleanup code.

Q807. [Linux] What is systemd-networkd-wait-online.service?

A: A systemd service that blocks boot until network connectivity is established. Often causes boot delays when not all interfaces come up. Can be configured with --any to proceed when any interface is online.

Q808. [Python] What is a Pandas Series?

A: A 1D labeled array — essentially a single column of a DataFrame. It can hold any data type.

Q809. [Ansible] What collection provides platform-independent network modules?

A: ansible.netcommon -- it includes cli_command, cli_config, netconf_config, netconf_get, and cli_parse. ---

Q810. [Linux] What does /proc/sys/net/ipv4/tcp_syncookies control?

A: Enables SYN cookies — a defense against SYN flood attacks. When the SYN queue is full, the server encodes connection state in the SYN-ACK sequence number instead of allocating resources, allowing legitimate connections to complete.


Batch 82

Q811. [Linux] What is crun?

A: A fast, lightweight OCI container runtime written in C. Alternative to runc with lower memory usage and faster startup. Used by default in some Podman configurations.

Q812. [Python] What integers does CPython cache (intern)?

A: Integers from -5 to 256 inclusive. These are pre-allocated singleton objects, so a = 256; b = 256; a is b is True, but a = 257; b = 257; a is b may be False.

Q813. [Ansible] What is ansible.builtin.lineinfile vs ansible.builtin.blockinfile?

A: lineinfile manages single lines in files (insert, replace, ensure present/absent). blockinfile manages multi-line blocks surrounded by markers.

Q814. [Linux] What does umask do?

A: Sets the default permission mask for new files and directories. The umask is subtracted from the maximum permissions (666 for files, 777 for directories). A umask of 022 results in files at 644 and directories at 755.

Q815. [Python] What is TypeVar used for?

A: Defining generic type variables. For example, T = TypeVar('T') allows writing def first(items: list[T]) -> T to indicate the return type matches the list element type.

Q816. [Python] What does sys.exit() actually raise?

A: SystemExit exception. It does not immediately terminate — it can be caught by except BaseException or except SystemExit.

Q817. [Linux] Compare SELinux vs AppArmor.

A: SELinux: label-based MAC, more granular, steeper learning curve, used by RHEL/Fedora/CentOS. AppArmor: path-based MAC, simpler to configure, used by Ubuntu/Debian/SUSE. Both achieve Mandatory Access Control but through different mechanisms.

Q818. [Linux] What is trap in Bash?

A: Registers a command to execute when a signal is received or on script exit: trap 'rm -f /tmp/lockfile' EXIT. Common signals to trap: EXIT, ERR, INT, TERM.

Q819. [Python] What does if __name__ == '__main__': do?

A: It checks whether the script is being run directly (not imported). Code in this block only executes when the file is the entry point, not when imported as a module.

Q820. [Linux] What is Android's relationship to Linux?

A: Android uses the Linux kernel but replaces most of the GNU userland with its own (Bionic libc, Dalvik/ART runtime). It is the most widely deployed Linux kernel variant by device count.


Batch 83

Q821. [Linux] What is /etc/hostname?

A: Contains the system's static hostname. Set with hostnamectl set-hostname.

Q822. [Linux] What does */5 * * * * mean in cron?

A: Run every 5 minutes.

Q823. [Ansible] What is fact_caching, and what backends does it support?

A: Fact caching stores gathered facts between playbook runs so they don't need to be re-gathered. Supported backends include: jsonfile, redis, memcached, mongodb, yaml, and others via plugins. --- --- ## 14. Tags, Import vs Include

Q824. [Python] What is a positive lookbehind?

A: (?<=...) asserts that what precedes the current position matches the pattern.

Q825. [Ansible] What subcommand in ansible-navigator lists available collections inside an EE?

A: ansible-navigator collections

Q826. [Linux] What is the exec() family of system calls?

A: Functions (execve, execvp, execl, etc.) that replace the current process image with a new program. After exec, the PID stays the same but code, data, and stack are replaced.

Q827. [Python] Why was the Python 2 to 3 migration so painful?

A: The breaking changes were extensive, many popular libraries were slow to port, the 2to3 tool was imperfect, and organizations had millions of lines of Python 2 code. The migration took over a decade.

Q828. [Linux] What is /proc/cmdline?

A: Contains the kernel command line passed by the bootloader (GRUB). Shows all kernel parameters used during boot.

Q829. [Python] What is py3-none-any in a wheel filename?

A: A pure Python wheel: works with any Python 3 version, no ABI dependency, any platform. Example: requests-2.31.0-py3-none-any.whl.

Q830. [Python] What is __init_subclass__ vs a metaclass?

A: __init_subclass__ is simpler and covers many use cases (registering subclasses, validating class attributes). Metaclasses are more powerful but harder to compose — use __init_subclass__ when possible.


Batch 84

Q831. [Linux] What are the layers of the TCP/IP model?

A: Four layers: Network Access/Link (1), Internet/Network (2), Transport (3), Application (4). It maps to OSI as: Layers 1-2 → Link, Layer 3 → Internet, Layer 4 → Transport, Layers 5-7 → Application.

Q832. [Linux] What is the purpose of /opt?

A: Add-on application software packages. Third-party software installs here to avoid conflicts with system packages. Each package gets its own subdirectory (e.g., /opt/google/chrome).

Q833. [Ansible] What are block, rescue, and always?

A: block groups tasks. rescue handles failures (like catch). always executes regardless of outcome (like finally). Together they implement try-catch-finally error handling.

Q834. [Linux] What does "cpio" stand for?

A: "Copy In and Out" — an archive format and utility used by initramfs, RPM packages, and the find | cpio pattern.

Q835. [Ansible] What Python package manager does Ansible recommend for installation?

A: pip (pipx for isolated installations). The recommended approach is pipx install ansible or pip install ansible in a virtual environment. --- --- ## 11. Ansible Vault & Security

Q836. [Linux] How do you set a default ACL on a directory?

A: setfacl -d -m u:alice:rwx /shared/ — the -d flag sets a default ACL that new files and subdirectories inherit.

Q837. [Linux] When would you choose XFS?

A: For large file workloads, high-throughput I/O, and environments with many parallel operations. Excellent for media servers, databases, and enterprise storage. Handles large directories efficiently.

Q838. [Linux] What are Linux namespaces?

A: Kernel features that isolate and virtualize system resources for groups of processes. Each namespace type provides an independent instance of a global resource.

Q839. [Python] What does the re.MULTILINE (or re.M) flag do?

A: It makes ^ and $ match the start and end of each line (after/before a newline), not just the start and end of the entire string.

Q840. [Ansible] What ansible-lint rule catches boolean value problems in YAML?

A: The yaml[truthy] rule. It flags bare truthy values (yes/no/on/off) and recommends using true/false instead for clarity and YAML 1.2 forward-compatibility.


Batch 85

Q841. [Linux] What does $! contain?

A: The PID of the last background process started.

Q842. [Ansible] What two open-source projects did Michael DeHaan create before Ansible, both at Red Hat?

A: Cobbler (a PXE-based bare-metal provisioning tool) and Func (a remote command execution framework). Concepts from both influenced Ansible's design.

Q843. [Python] What does functools.partial do?

A: It creates a new callable with some arguments of the original function pre-filled. For example, int_from_binary = partial(int, base=2) creates a function that parses binary strings.

Q844. [Python] What is __missing__ used for?

A: It is called by dict.__getitem__() when a key is not found. defaultdict uses this to generate default values. You can override it in dict subclasses.

Q845. [Python] What is smtplib used for?

A: Sending emails via SMTP: creating an SMTP connection, authenticating, and sending messages.

Q846. [Linux] What is the uptime command?

A: Shows current time, how long the system has been running, number of logged-in users, and load averages.

Q847. [Ansible] What is the difference between a lookup and a filter?

A: A lookup fetches data from an external source (file, URL, API) and runs on the control node. A filter transforms data that already exists in the playbook (string manipulation, type conversion, etc.).

Q848. [Linux] What does set -x do?

A: Enables debug mode — each command is printed to stderr before execution, prefixed with +.

Q849. [Python] What does sys.getsizeof(()) vs sys.getsizeof([]) show?

A: Empty tuples are smaller than empty lists in memory. An empty tuple is about 40 bytes; an empty list is about 56 bytes (on 64-bit CPython), because lists have extra overhead for mutability (over-allocation buffer).

Q850. [Ansible] What does the fetch module do?

A: Fetches (downloads) files from managed nodes to the control node. The inverse of copy.


Batch 86

Q851. [Ansible] What is an "Execution Environment" in the Ansible ecosystem?

A: A container image containing ansible-core, Python dependencies, collections, and system libraries needed to run automation. Built with ansible-builder and used by Automation Controller and ansible-navigator.

Q852. [Linux] What does set -u do?

A: Treats references to unset variables as errors, causing the script to exit.

Q853. [Python] What does math.gcd() compute?

A: The greatest common divisor. Since Python 3.9, it accepts multiple arguments: math.gcd(12, 18, 24) returns 6.

Q854. [Linux] What is a mount namespace used for in containers?

A: Gives each container its own view of the filesystem mount tree, isolated from the host and other containers. The container sees only its own root filesystem and mounted volumes.

Q855. [Linux] What command shows your current UID and group memberships?

A: id — shows UID, GID, and all supplementary groups for the current user or specified username.

Q856. [Ansible] How often does ansible-core release a new major version?

A: Approximately every six months, typically in May and November, with a 4-week Z-release patch cycle for bugfixes and security fixes.

Q857. [Linux] What is the difference between rpm, yum, and dnf?

A: rpm is the low-level package installer (no dependency resolution). yum (Yellowdog Updater Modified) is the traditional high-level resolver. dnf (Dandified YUM) replaced yum in Fedora 22+ and RHEL 9 with better dependency resolution (libsolv) and performance.

Q858. [Linux] What is an LVM snapshot?

A: A point-in-time copy of a logical volume using copy-on-write. The snapshot stores only changed blocks, making it space-efficient. Used for backups and testing.

Q859. [Python] What is the iterator protocol?

A: An object must implement __iter__() (returning itself) and __next__() (returning the next value or raising StopIteration).

Q860. [Linux] What is dpkg-buildpackage?

A: The Debian tool for building .deb packages from source. It reads debian/control, debian/rules, and other files in the debian/ directory.


Batch 87

Q861. [Linux] How do you persistently set a static IP on RHEL 9?

A: nmcli connection modify eth0 ipv4.addresses 10.0.0.5/24 ipv4.gateway 10.0.0.1 ipv4.dns "8.8.8.8" ipv4.method manual && nmcli connection up eth0.

Q862. [Linux] What is the arping command?

A: Sends ARP request packets to detect if an IP address is in use on the local network and identify the responding MAC address. arping -D 10.0.0.1 checks for duplicate addresses.

Q863. [Ansible] Can async tasks run in check mode?

A: No. Asynchronous mode does not support check mode and will fail.

Q864. [Ansible] What is gather_subset and how does it speed up fact gathering?

A: Instead of gathering all facts, you can specify a subset: gather_subset: [network, hardware] or gather_subset: [!hardware, !virtual]. Minimizing gathered facts reduces setup time.

Q865. [Python] How do you create a custom exception?

A: Subclass Exception (or a more specific built-in exception): class MyError(Exception): pass. You can add custom attributes in __init__.

Q866. [Python] Why are tuples slightly faster than lists?

A: Tuples are immutable, so CPython can optimize their storage (contiguous memory, no over-allocation). Small tuples (up to length 20) are also cached and reused by the free-list allocator.

Q867. [Ansible] What are best practices for writing Ansible playbooks?

A: Use roles for modularity, maintain proper YAML formatting, use meaningful task names, test in staging first, use check mode for validation, use version control, keep secrets encrypted with Vault, document your automation.

Q868. [Ansible] What is omit?

A: A special variable that, when used as a module parameter value, causes that parameter to be omitted entirely. Useful with conditional defaults: mode: "{{ item.mode | default(omit) }}". ---

Q869. [Ansible] What is the ask_sudo_pass setting?

A: Controls whether Ansible prompts for a sudo password. Default is no. ---

Q870. [Ansible] What is the to_json and from_json filter pair used for?

A: to_json serializes a Python object to a JSON string. from_json parses a JSON string into a Python data structure.


Batch 88

Q871. [Ansible] What does the service module do?

A: Manages system services -- start, stop, restart, enable, disable.

Q872. [Linux] What is the boot sequence order from power-on to login prompt?

A: Firmware (BIOS/UEFI) → Bootloader (GRUB2) → Kernel loading + initramfs → Kernel initialization → PID 1 (systemd) → Default target → Login prompt.

Q873. [Python] When was Python 1.0 released?

A: January 1994. It added lambda, map, filter, and reduce — functional programming features inspired by Lisp.

Q874. [Python] What is types.SimpleNamespace?

A: A simple class that allows attribute access on an object: ns = SimpleNamespace(x=1, y=2); ns.x returns 1. Useful as a lightweight alternative to classes or dicts.

Q875. [Linux] What is wget vs curl?

A: wget is a non-interactive downloader (recursive download, resume). curl is a data transfer tool supporting many protocols (HTTP, FTP, SMTP, etc.) with more flexible output options. curl is better for APIs; wget for mirroring websites.

Q876. [Python] What is Django's primary design philosophy?

A: "The web framework for perfectionists with deadlines." It follows the "batteries included" philosophy with an ORM, admin interface, authentication, templating, and more built-in.

Q877. [Ansible] Can individual ansible.cfg settings be overridden by environment variables?

A: Yes. Every ansible.cfg setting can be overridden by a corresponding environment variable, typically named ANSIBLE_ followed by the uppercase setting name. Environment variables have higher precedence than ansible.cfg file entries.

Q878. [Linux] What is nftables?

A: The replacement for iptables, ip6tables, arptables, and ebtables. It uses a single framework with a new syntax, improved performance, and atomic rule updates. The nft command is the primary interface.

Q879. [Python] What does python -m ensurepip do?

A: It bootstraps pip into a Python installation that does not have it. Useful for minimal Python installations.

Q880. [Ansible] When did Red Hat acquire Ansible, and what was the reported price?

A: Red Hat announced the acquisition on October 16, 2015. The price was reportedly around $150 million, though Red Hat never officially confirmed the amount. Ansible had raised only $6 million prior, mostly from Menlo Ventures and e.ventures.


Batch 89

Q881. [Linux] What is GRUB2's main configuration file?

A: /boot/grub2/grub.cfg (or /boot/grub/grub.cfg on Debian-family). It is auto-generated by grub2-mkconfig / update-grub from scripts in /etc/grub.d/ and settings in /etc/default/grub.

Q882. [Python] What is the pickle protocol version?

A: Pickle has protocol versions 0-5. Higher versions are more efficient. Protocol 5 (Python 3.8) added out-of-band data support for large buffers.

Q883. [Linux] What is the bridge command?

A: Part of iproute2, manages Linux bridge devices. bridge fdb show displays the forwarding database (MAC table). bridge link shows bridge ports and their states.

Q884. [Ansible] What does the ansible-galaxy CLI do?

A: Manages roles and collections -- install, create, remove, list, and search for reusable content.

Q885. [Linux] What is skopeo?

A: A tool for working with container registries — copying images between registries, inspecting images remotely, and deleting tags. Does not require a daemon or pulling the full image.

Q886. [Python] What major features were added in Python 3.8?

A: The walrus operator := (PEP 572), positional-only parameters / (PEP 570), f-string = for debugging, functools.cached_property, typing.Literal, typing.Protocol, math.prod(), and statistics.NormalDist.

Q887. [Ansible] What does run_once: true do?

A: Executes the task on only one host in the play, regardless of how many hosts are targeted. Typically runs on the first host in the batch.

Q888. [Ansible] What is the Tower/AWX REST API used for?

A: Programmatic access to launch jobs, manage inventory, check job status, and integrate Tower with CI/CD tools and external systems. ---

Q889. [Ansible] When was the last time the migration script (migrate.py) was run to move content from the monolithic ansible repo to collections?

A: The final migration run happened on Friday, March 6, 2020. The ansible-community/collection_migration repository was left as a historical record. ---

Q890. [Linux] What is the alias command?

A: Creates shorthand for commands: alias ll='ls -la'. Defined in .bashrc for persistence. unalias ll removes it. alias with no arguments lists all aliases.


Batch 90

Q891. [Python] What does collections.Counter.subtract() do differently from -?

A: subtract() subtracts counts in-place and allows negative results. The - operator drops zero and negative results.

Q892. [Ansible] What is ANSIBLE_COLLECTIONS_PATH?

A: An environment variable (or collections_paths in ansible.cfg) that specifies directories where Ansible searches for installed collections.

Q893. [Linux] What is cgroups v2 memory.pressure?

A: A file in cgroups v2 that reports memory pressure metrics (some, full) with 10-second, 60-second, and 300-second averages. Part of the PSI (Pressure Stall Information) system. Non-zero values indicate resource contention.

Q894. [Ansible] What is the no_log lint rule about?

A: It warns when tasks handle potentially sensitive data (passwords, tokens) without no_log: true to prevent secrets from appearing in logs. --- --- ## 21. Network Automation

Q895. [Linux] What is buildah?

A: A tool for building OCI container images without requiring a daemon or running containers. Works with Podman. Supports Dockerfile builds and scriptable image creation.

Q896. [Linux] What does sar do?

A: System Activity Reporter — collects and reports historical system performance data (CPU, memory, disk, network). Data is stored by sadc and queried with sar. Part of sysstat.

Q897. [Python] What standard library module can you use to measure execution time of small code snippets?

A: The timeit module, which runs code multiple times and reports the execution time, disabling the garbage collector during timing by default.

Q898. [Ansible] What is the COLLECTIONS_PATHS configuration?

A: Defines the search paths where Ansible looks for installed collections. Default: ~/.ansible/collections:/usr/share/ansible/collections. Can be set in ansible.cfg or via the ANSIBLE_COLLECTIONS_PATH environment variable.

Q899. [Python] What method can you define on a dataclass to customize how it is initialized after __init__?

A: __post_init__(). It is called automatically after the generated __init__ and is useful for validation or computing derived fields.

Q900. [Python] What is coverage.py used for?

A: Measuring code coverage — what percentage of your code is executed during testing. It can report line coverage, branch coverage, and generate HTML reports.


Batch 91

Q901. [Python] What is a requirements.txt file?

A: A text file listing Python package dependencies, one per line, with optional version specifiers. Used by pip install -r requirements.txt.

Q902. [Ansible] What is an Ansible callback whitelist?

A: The list of enabled callback plugins in ansible.cfg. Only whitelisted callbacks are active.

Q903. [Ansible] What is the serial keyword?

A: Controls how many hosts are updated at a time during a playbook run. serial: 2 updates two hosts at a time, enabling rolling updates.

Q904. [Python] What is __set_name__ used for?

A: Called on descriptors when a class is created, it receives the owner class and the attribute name. This allows descriptors to know what name they were assigned to without the user specifying it explicitly. Added in Python 3.6.

Q905. [Python] Name five alternative Python implementations.

A: PyPy (JIT-compiled, faster), Jython (runs on JVM), IronPython (runs on .NET), GraalPython (on GraalVM), and MicroPython (for microcontrollers).

Q906. [Ansible] What does the debug strategy allow?

A: Interactive step-through execution. When a task fails, it drops into a debug prompt where you can inspect variables, re-run the task, or continue execution.

Q907. [Ansible] How does become work differently on Windows?

A: On Windows, become uses runas to bypass WinRM's non-interactive session restrictions. It creates an interactive token, allowing access to APIs blocked under WinRM (Windows Update API, DPAPI, etc.).

Q908. [Python] How do you use itertools.product to get the equivalent of a triple nested loop?

A: itertools.product(range(3), range(3), range(3)) yields all 27 triples, equivalent to three nested for loops.

Q909. [Python] What is ansible-runner?

A: A Python library that provides a programmatic interface for running Ansible playbooks, roles, and tasks from Python code. --- ## 20. Dunder Methods Catalog

Q910. [Ansible] How do you install collections from a requirements file?

A: ansible-galaxy collection install -r requirements.yml


Batch 92

Q911. [Python] What built-in functions are considered functional-style?

A: map(), filter(), zip(), enumerate(), sorted(), reversed(), min(), max(), sum(), any(), all(). --- ## 7. Error Handling

Q912. [Linux] What does exit code 1 mean?

A: General error — the most common failure exit code.

Q913. [Ansible] What is groups in Ansible?

A: A dictionary/map of all groups in the inventory, where each group key maps to a list of hosts belonging to that group.

Q914. [Linux] What is the difference between crun and runc?

A: Both are OCI-compliant container runtimes. runc is written in Go (reference implementation). crun is written in C, resulting in significantly lower memory overhead and faster container creation. --- ## 15. Cron & Scheduling

Q915. [Linux] What does exit code 126 mean?

A: Command found but not executable (permission denied).

Q916. [Linux] What is PXE boot?

A: Preboot Execution Environment — boots a system over the network. The NIC firmware requests an IP via DHCP, downloads a bootloader via TFTP, and then loads the kernel and initramfs. Used for automated OS deployment.

Q917. [Ansible] What is ansible_host in inventory?

A: A variable that overrides the hostname or IP used to connect to a host. The inventory name stays the same for variable lookups, but ansible_host tells Ansible the actual connection address.

Q918. [Linux] What is SIGCHLD?

A: Signal 17, sent to a parent process when a child terminates or stops. Allows the parent to asynchronously reap child exit status.

Q919. [Python] What is __aiter__ and __anext__?

A: The async iterator protocol. __aiter__ returns the async iterator, __anext__ returns an awaitable that yields the next value or raises StopAsyncIteration.

Q920. [Linux] What is ldconfig?

A: Updates the shared library cache (/etc/ld.so.cache) so the dynamic linker can find shared libraries. Run after installing new libraries. Configuration in /etc/ld.so.conf and /etc/ld.so.conf.d/.


Batch 93

Q921. [Python] What is the difference between is and == for None?

A: Always use is None because None is a singleton. == None would call __eq__ which could be overridden to return True for non-None objects.

Q922. [Ansible] Can serial be expressed as a percentage?

A: Yes: serial: "25%" processes 25% of hosts per batch.

Q923. [Linux] What is the HOME variable?

A: The current user's home directory path. Used by cd with no arguments and tilde expansion (~).

Q924. [Ansible] What are the three Mitogen strategy plugins?

A: mitogen_linear, mitogen_free, and mitogen_host_pinned -- corresponding to Ansible's built-in strategy plugins.

Q925. [Python] What is nox?

A: Similar to tox but uses Python scripts instead of INI configuration files for defining test sessions. Created by Thea Flowers.

Q926. [Linux] What is the SLUB allocator?

A: The default slab allocator in modern Linux kernels, replacing the original SLAB allocator. It manages small kernel memory allocations efficiently using per-CPU caches and object pools organized by size.

Q927. [Linux] What are the key dependency directives in systemd?

A: Requires=: hard dependency (if the required unit fails, this unit fails). Wants=: soft dependency (failure is tolerated). After=/Before=: ordering only, no dependency. BindsTo=: like Requires but also stops this unit when the other stops.

Q928. [Ansible] What is a callback plugin?

A: A plugin that hooks into Ansible's event system to modify output, perform logging, send notifications, or track metrics. The standard terminal output you see is itself a callback plugin.

Q929. [Ansible] What is a "fully qualified collection name" (FQCN)?

A: The complete namespace.collection.module path, e.g., ansible.builtin.copy, community.general.ufw, amazon.aws.ec2_instance.

Q930. [Ansible] When did the collections concept first appear in Ansible?

A: Collections were introduced as a concept in Ansible 2.8 (2019) and became the primary content distribution mechanism in Ansible 2.10 (2020).


Batch 94

Q931. [Linux] What is SIGSTOP?

A: Signal 19 (on most architectures) that pauses a process. Like SIGKILL, it cannot be caught, blocked, or ignored. SIGCONT (18) resumes a stopped process.

Q932. [Ansible] What is a lookup plugin in Ansible?

A: A plugin that retrieves data from external sources during playbook execution. Lookups run on the control node (not on managed hosts) and return data to the playbook.

Q933. [Ansible] What does the map filter do with the attribute keyword?

A: Extracts a specific attribute from each item in a list: {{ users | map(attribute='name') | list }}.

Q934. [Python] Who created Flask?

A: Armin Ronacher, as part of the Pallets project. It was originally an April Fools' joke in 2010 that became wildly popular.

Q935. [Python] What features did Python 0.9.0 already include?

A: Classes with inheritance, exception handling, functions, the core data types (list, dict, str), and a module system. It was remarkably complete for a first public release.

Q936. [Linux] What is the file command?

A: Determines a file's type by examining its content (magic numbers, headers), not its extension: file /bin/ls outputs "ELF 64-bit LSB executable."

Q937. [Ansible] When should you use ad-hoc commands vs playbooks?

A: Ad-hoc for quick checks, testing connectivity, gathering info, or one-time fixes. Playbooks for repeatable, complex, multi-step automation. --- --- ## 5. Modules

Q938. [Ansible] What is the service_facts module?

A: Gathers data about all services on a managed node, returning their states.

Q939. [Python] What is exec() dangerous for?

A: It executes arbitrary Python code from a string, which is a security risk if the string comes from untrusted input. It also makes code harder to analyze and debug.

Q940. [Ansible] Can you override an extra var with set_fact?

A: No. Extra vars (level 22) always have the highest precedence. set_fact (level 19) cannot override them. ---


Batch 95

Q941. [Linux] What compression tools are available on Linux?

A: gzip/gunzip (.gz, fast), bzip2/bunzip2 (.bz2, better ratio), xz/unxz (.xz, best ratio, slower), zstd (.zst, excellent speed/ratio balance), lz4 (.lz4, fastest), zip/unzip (.zip, cross-platform).

Q942. [Python] What is __cached__ on a module?

A: The path to the compiled bytecode file (.pyc) for the module.

Q943. [Ansible] How do you inspect the contents of an EE image using ansible-navigator?

A: ansible-navigator images shows available EE images and lets you drill into their Python packages, Ansible collections, and system packages. ---

Q944. [Ansible] What is listen in handlers?

A: A way to group handlers under a topic name. Multiple handlers can listen to the same topic, and notifying the topic triggers all listening handlers. --- --- ## 10. Roles & Collections

Q945. [Python] What is the difference between boto3 client and resource interfaces?

A: Client provides a low-level, 1:1 mapping to AWS API operations. Resource provides a higher-level, object-oriented interface. Client is more complete; resource is more Pythonic.

Q946. [Python] What is the WAT moment with tuple addition?

A: () + () gives (). But (1,) + (2,) gives (1, 2). The trailing comma is required for single-element tuples: (1) is just the integer 1, not a tuple.

Q947. [Linux] How do you check the current SELinux mode?

A: getenforce or sestatus for detailed status.

Q948. [Python] What does int.from_bytes() do?

A: Creates an integer from a bytes object: int.from_bytes(b'\x04\x00', byteorder='big') returns 1024.

Q949. [Ansible] How do handlers differ from regular tasks?

A: Handlers only execute when explicitly notified and only run once at the end of a play (or when meta: flush_handlers is called), even if notified multiple times.

Q950. [Ansible] What happens if you use vars_prompt in Ansible Tower/Controller?

A: Tower/Controller presents a survey form to the user before job execution, mapping survey fields to the prompt variables. In CLI mode, the user is prompted interactively.


Batch 96

Q951. [Python] What is the requests library?

A: The most popular Python HTTP client library, known for its simple API: requests.get(url). Created by Kenneth Reitz.

Q952. [Python] What is CPython bytecode?

A: The intermediate representation that Python source code is compiled to before execution. Each .py file is compiled to bytecode (stored in .pyc files) which the CPython virtual machine interprets.

Q953. [Python] What is Invoke?

A: A task execution library — a Pythonic replacement for Make. It provides a clean API for running shell commands and organizing task functions.

Q954. [Python] What is manylinux?

A: A tag for Linux wheel files indicating compatibility across many Linux distributions. It defines a set of allowed system libraries, enabling portable binary wheels.

Q955. [Linux] What is the Linux Foundation?

A: A non-profit technology consortium founded in 2000 (as Open Source Development Labs, renamed in 2007) that hosts and promotes Linux development. It employs Linus Torvalds and Greg Kroah-Hartman and hosts projects like Kubernetes, Node.js, and Hyperledger.

Q956. [Ansible] Many people attribute the word "ansible" to Orson Scott Card's Ender's Game. Why is that incorrect for the original coinage?

A: Card popularized the term in Ender's Game (1985), but Le Guin invented it 19 years earlier in 1966. Card's usage spread the word to a much wider audience, creating the common misattribution.

Q957. [Linux] How can you detect if you're inside a container?

A: Check /proc/1/cgroup — if it shows docker, containerd, or kubepods paths, you're in a container. Also check for /.dockerenv file or the container environment variable.

Q958. [Python] Does Python have native support for complex numbers?

A: Yes. Use j or J for the imaginary part: z = 3 + 4j. Access parts with z.real and z.imag. The cmath module provides math functions for complex numbers.

Q959. [Ansible] What is the difference between is match and is search tests?

A: match anchors to the beginning of the string (like re.match). search finds a pattern anywhere in the string (like re.search).

Q960. [Python] What is PyCon US?

A: The largest annual gathering for the Python community, organized by the PSF. It includes talks, tutorials, sprints, and an expo hall. It typically attracts 3,000-4,000 attendees.


Batch 97

Q961. [Ansible] What two methods must a custom inventory plugin implement?

A: verify_file(self, path) (validates the inventory source) and parse(self, inventory, loader, path, cache=True) (populates the inventory).

Q962. [Ansible] Name five Jinja2 built-in filters commonly used in Ansible playbooks.

A: (1) default(value) -- provides a fallback if variable is undefined; (2) join(separator) -- joins list items; (3) length -- returns count of items; (4) upper/lower -- case conversion; (5) replace(old, new) -- string replacement.

Q963. [Python] What is the __main__.py file for?

A: It makes a package executable with python -m package. The __main__.py file is executed when the package is run as a script.

Q964. [Ansible] What are Ansible plugins?

A: Extensions that add functionality to Ansible core. They run on the control node (unlike modules which run on managed nodes).

Q965. [Linux] What is nl used for?

A: Numbers lines of a file. More configurable than cat -n: can number only non-blank lines, use custom formats, and handle section headers.

Q966. [Ansible] How many stdout-type callback plugins can be active at once?

A: Only one. The stdout_callback setting in ansible.cfg controls which one is active. Other non-stdout callback plugins can be enabled simultaneously.

Q967. [Python] How do you stack multiple decorators?

A: Apply them one above another: @decorator1 then @decorator2 above def func. This is equivalent to func = decorator1(decorator2(func)) — the bottommost decorator is applied first.

Q968. [Ansible] What is the fail module?

A: Explicitly fails a play with a custom error message. Often used with when for conditional failures.

Q969. [Ansible] Why does Ansible refuse to load an ansible.cfg from a world-writable current directory?

A: This is a security measure introduced in Ansible 2.7. If the current directory is world-writable (e.g., /tmp), Ansible ignores the ansible.cfg found there to prevent privilege escalation attacks where a malicious user plants a crafted config file. ---

Q970. [Ansible] Give an example of an ad-hoc ping command.

A: ansible all -m ping


Batch 98

Q971. [Linux] How do you perform a basic sed substitution?

A: sed 's/old/new/' file replaces the first occurrence per line. sed 's/old/new/g' file replaces all occurrences. sed -i 's/old/new/g' file edits in place.

Q972. [Ansible] What is the security concern with ./ansible.cfg in the current directory?

A: If Ansible is run in a world-writable directory, a malicious user could place an ansible.cfg that modifies behavior (e.g., pointing to a rogue callback plugin). Ansible warns or ignores current-directory config files in world-writable directories. ---

Q973. [Linux] What are the common HTTP status code ranges?

A: 1xx: informational. 2xx: success (200 OK, 201 Created, 204 No Content). 3xx: redirection (301 Moved, 302 Found, 304 Not Modified). 4xx: client error (400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found). 5xx: server error (500 Internal, 502 Bad Gateway, 503 Service Unavailable).

Q974. [Linux] What is the MTU?

A: Maximum Transmission Unit — the largest packet size that can be sent on a network link without fragmentation. Default is 1500 bytes for Ethernet. Jumbo frames use 9000 bytes.

Q975. [Ansible] How does ansible-pull know which playbook to run?

A: Via the -U (repository URL) and optionally -C (branch/tag) and playbook file path arguments. It clones/pulls the repo, then runs the specified playbook locally.

Q976. [Ansible] What is ansible-pull?

A: A mode that inverts Ansible's default push architecture. Each managed node runs ansible-pull on a schedule (e.g., via cron), pulling playbooks from a Git repository and executing them locally.

Q977. [Linux] What is the difference between ip link set dev eth0 down and ifdown eth0?

A: ip link directly changes the interface state at the kernel level. ifdown uses the distribution's network configuration system (ifupdown, NetworkManager) which may also remove routes, release DHCP, and run scripts.

Q978. [Python] What is sys.float_info?

A: A named tuple containing information about the float type: max (largest representable float), min (smallest positive normalized float), epsilon (smallest difference between 1.0 and the next float), etc.

Q979. [Ansible] What does meta: end_host do?

A: Stops executing tasks on the current host for the remainder of the play without failing it. Other hosts continue normally.

Q980. [Ansible] What are group_vars and host_vars?

A: Directories for storing variables that apply to groups or individual hosts respectively. group_vars/webservers.yml applies to all hosts in the webservers group; host_vars/server1.yml applies only to server1.


Batch 99

Q981. [Python] What is yield from used for?

A: Introduced in Python 3.3 (PEP 380), it delegates to a sub-generator: yield from iterable is equivalent to for item in iterable: yield item but also properly handles send(), throw(), and return values.

Q982. [Python] What is a closure in Python?

A: A function that captures variables from its enclosing scope. The inner function "closes over" the variables, retaining access even after the enclosing function has returned.

Q983. [Python] What is Polars?

A: A fast DataFrame library written in Rust with a Python interface. It is designed as a more performant alternative to Pandas, with lazy evaluation and better multi-threaded performance.

Q984. [Python] What does import __phello__ do in Python 3.12+?

A: It prints "Hello world!" — a frozen "hello world" package added as part of the frozen module infrastructure.

Q985. [Python] What is the output of print(0.1 + 0.2)?

A: 0.30000000000000004 due to IEEE 754 floating-point representation.

Q986. [Python] What ASGI server is commonly used with FastAPI?

A: Uvicorn, which is based on uvloop and httptools for high performance.

Q987. [Python] What is the apply() method in Pandas?

A: It applies a function along an axis of a DataFrame or to each element of a Series. It is flexible but slower than vectorized operations.

Q988. [Ansible] How does failed_when work?

A: It defines a custom condition for when a task should be considered failed, overriding the module's default success/failure determination. Example: failed_when: "'ERROR' in result.stdout"

Q989. [Linux] Where does the name "awk" come from?

A: Named after its creators: Alfred Aho, Peter Weinberger, and Brian Kernighan.

Q990. [Ansible] How long is each ansible-core major version maintained?

A: Each ansible-core major release is maintained for approximately 18 months (the current release plus two prior versions are actively maintained).


Batch 100

Q991. [Linux] What is the chattr command?

A: Changes file attributes on ext2/ext3/ext4 filesystems. chattr +i file makes it immutable (cannot be modified, deleted, renamed, or linked — even by root). chattr +a file makes it append-only. View with lsattr.

Q992. [Ansible] Name five major collections that were extracted from the monolithic Ansible repo during the migration.

A: (1) community.general -- miscellaneous modules that didn't fit elsewhere; (2) community.network -- network device modules; (3) community.crypto -- cryptographic modules; (4) community.docker -- Docker modules; (5) community.mysql -- MySQL modules; (6) amazon.aws / community.aws -- AWS modules; (7) ansible.posix -- POSIX-specific modules; (8) ansible.windows -- Windows modules.

Q993. [Ansible] Where does Molecule store scenario configuration?

A: In molecule/<scenario_name>/molecule.yml within the role directory.

Q994. [Ansible] What is a constructed inventory plugin?

A: A built-in plugin that creates groups and hostvars using Jinja2 expressions based on existing inventory data, without querying external sources. ---

Q995. [Python] What is pip freeze used for?

A: It outputs a list of installed packages and their versions in requirements.txt format, suitable for recreating the environment.

Q996. [Python] What tool is the modern standard for building Python packages?

A: build (as in python -m build), using a pyproject.toml configuration. setuptools remains the most common build backend.

Q997. [Ansible] How do you manage Windows systems with Ansible?

A: Enable WinRM on Windows hosts, install pywinrm on the control node, set ansible_connection=winrm in inventory, and use Windows-specific modules (win_feature, win_service, win_copy, etc.).

Q998. [Ansible] If both ANSIBLE_CONFIG and a local ansible.cfg exist in the current directory, which wins?

A: ANSIBLE_CONFIG always wins -- it has the highest precedence.

Q999. [Python] What is typing.Awaitable?

A: A type hint for objects that can be awaited: coroutines, tasks, futures.

Q1000. [Python] What is the maximum date Python's datetime can represent?

A: datetime.datetime.max is 9999-12-31 23:59:59.999999.


Batch 101

Q1001. [Ansible] How do you encrypt an existing file?

A: ansible-vault encrypt existing_file.yml

Q1002. [Ansible] Can you run Ansible on Windows as a control node?

A: No. Ansible's control node must run on a Unix-like system (Linux, macOS, BSDs). Windows can only be a managed node (via WinRM or PSRP). WSL (Windows Subsystem for Linux) is the workaround for running Ansible on Windows.

Q1003. [Python] What is operator.itemgetter() used for?

A: It creates a callable that retrieves items by index or key: itemgetter(1) is equivalent to lambda x: x[1]. Commonly used as a key function for sorted().

Q1004. [Python] How do you implement a max-heap using Python's heapq module?

A: By negating the values before pushing and after popping, e.g., heapq.heappush(heap, -value) and -heapq.heappop(heap).

Q1005. [Python] What is the surprising result of float('nan') == float('nan')?

A: False. NaN is not equal to anything, including itself. This is per the IEEE 754 standard. To check for NaN, use math.isnan().

Q1006. [Ansible] What does ANSIBLE_KEEP_REMOTE_FILES do?

A: When set to true, Ansible doesn't delete the temporary module files on remote hosts after execution. Useful for debugging module issues.

Q1007. [Python] What module provides abstract base classes?

A: The abc module, with ABC as a base class and @abstractmethod as a decorator.

Q1008. [Ansible] How do you detect configuration drift with Ansible?

A: Run playbooks in check mode (--check --diff) to see what would change without applying. Schedule regular runs to enforce desired state. ---

Q1009. [Ansible] What is a Job Template in AWX/automation controller?

A: A definition that combines a playbook, inventory, credentials, and configuration into a reusable, launchable unit.

Q1010. [Python] What does __init__ vs __new__ do?

A: __new__ creates and returns a new instance (it is a static method on the class). __init__ initializes the instance after creation. __new__ is called first and is rarely overridden except for immutable types or singletons.


Batch 102

Q1011. [Linux] What is an ICMP redirect?

A: A message from a router telling a host that a better route exists for a destination. Often disabled for security (net.ipv4.conf.all.accept_redirects = 0).

Q1012. [Linux] What is pam_limits?

A: A PAM module that enforces resource limits from /etc/security/limits.conf — such as max open files (nofile), max processes (nproc), max memory size, and CPU time per user or group.

Q1013. [Python] What is the shelve module used for?

A: It provides a persistent dictionary-like object backed by a database file (using dbm). Keys must be strings, but values can be any picklable Python object.

Q1014. [Ansible] What is the Community Working Group specifically?

A: A "catch-all" working group that focuses on keeping other working groups running and handles community activities not covered by specialized groups.

Q1015. [Linux] What is /etc/login.defs used for in security?

A: Defines password aging policies (PASS_MAX_DAYS, PASS_MIN_DAYS, PASS_MIN_LEN, PASS_WARN_AGE), UID/GID allocation ranges, and default umask for new users.

Q1016. [Python] What does sys.getdefaultencoding() return in Python 3?

A: 'utf-8'.

Q1017. [Python] What does itertools.filterfalse(predicate, iterable) do?

A: It yields elements for which the predicate returns false — the opposite of the built-in filter().

Q1018. [Ansible] What is ansible_python_interpreter?

A: Specifies the path to Python on the managed node (useful when the default /usr/bin/python is incorrect).

Q1019. [Ansible] What are execution nodes vs hop nodes in automation mesh?

A: Execution nodes run Ansible playbooks. Hop nodes relay traffic between the controller and execution nodes without running playbooks, useful for crossing network boundaries.

Q1020. [Ansible] What does the flatten filter do?

A: Recursively flattens nested lists into a single flat list: {{ [[1,2],[3,[4,5]]] | flatten }} produces [1,2,3,4,5].


Batch 103

Q1021. [Linux] What does the quiet kernel parameter do?

A: Suppresses most kernel boot messages, showing only critical errors. The splash parameter enables a graphical boot screen.

Q1022. [Linux] What does wc do?

A: Word count. -l lines, -w words, -c bytes, -m characters. wc -l file counts lines.

Q1023. [Linux] What is port 443 used for?

A: HTTPS (HTTP Secure) — TLS-encrypted web traffic.

Q1024. [Python] What is the time complexity of list.insert(0, x)?

A: O(n), because all existing elements must be shifted right.

Q1025. [Ansible] What module manages systemd services?

A: systemd (provides more systemd-specific options than the generic service module).

Q1026. [Ansible] What is a group in an Ansible inventory?

A: A named collection of hosts that allows you to target multiple servers with a single reference. Example: [webservers] containing multiple web server hostnames.

Q1027. [Ansible] What does the cron module do?

A: Manages cron jobs on managed nodes.

Q1028. [Ansible] Which tool came first chronologically: Puppet, Chef, Ansible, or Salt?

A: Puppet (2005), Chef (2009), Salt (2011), Ansible (2012).

Q1029. [Python] What does pytest.fixture do?

A: It defines reusable test setup/teardown functions that are injected into test functions by name. Fixtures can have different scopes (function, class, module, session).

Q1030. [Ansible] How many forks does Ansible use by default?

A: 5 (configurable in ansible.cfg or with -f flag).


Batch 104

Q1031. [Ansible] What happens when you use creates or removes with command/shell modules?

A: creates: /path/to/file skips the task if the file already exists. removes: /path/to/file skips the task if the file does NOT exist. Both enable idempotency for command-based tasks.

Q1032. [Python] What is C3 linearization?

A: The algorithm Python uses to determine MRO for multiple inheritance. It preserves local precedence order and monotonicity, ensuring a consistent and predictable method resolution.

Q1033. [Python] What is PYTHONSTARTUP?

A: An environment variable pointing to a Python file that is executed when the interactive interpreter starts. Useful for setting up custom helpers.

Q1034. [Python] What is the __debug__ built-in constant?

A: It is True under normal execution and False when Python runs with the -O flag. assert statements are only executed when __debug__ is True.

Q1035. [Linux] What does findmnt do?

A: Shows mounted filesystems in a tree format. findmnt -t ext4 filters by type. findmnt /boot shows the mount for a specific path. More informative than mount for understanding the mount hierarchy.

Q1036. [Ansible] What does the package module do?

A: A generic OS-independent package manager module that auto-detects the appropriate package manager.

Q1037. [Python] What WSGI toolkit does Flask use under the hood?

A: Werkzeug (German for "tool") for WSGI utilities and request/response handling.

Q1038. [Python] What is Tornado known for?

A: Being one of the first Python async web frameworks (originally from FriendFeed/Facebook, released 2009). It has its own event loop and is designed for long-polling and WebSockets.

Q1039. [Python] What does pandas.DataFrame.merge() do?

A: SQL-style joins between DataFrames on columns or indexes. Supports inner, outer, left, and right join types.

Q1040. [Python] What is multiprocessing.Queue vs queue.Queue?

A: queue.Queue is thread-safe for use between threads. multiprocessing.Queue works across processes using pipes and serialization.


Batch 105

Q1041. [Ansible] What is SSH ControlPersist?

A: An SSH feature that keeps connections open for reuse, reducing connection overhead. Configure in SSH config or ansible.cfg.

Q1042. [Python] What is NotImplemented vs NotImplementedError?

A: NotImplemented is a singleton value returned by rich comparison methods to signal the comparison is not implemented for those types. NotImplementedError is an exception raised to indicate an abstract method needs to be overridden.

Q1043. [Ansible] How many collections are typically included in the Ansible community package?

A: The Ansible community package (e.g., Ansible 9.x, 10.x) bundles approximately 85-100+ collections alongside ansible-core. --- --- ## 2. Installation & Configuration

Q1044. [Python] What is asyncio.to_thread() added in Python 3.9?

A: It runs a synchronous function in a separate thread: await asyncio.to_thread(blocking_io_func). This prevents blocking the event loop.

Q1045. [Python] In dataclasses, what does the field() function's default_factory parameter do?

A: It provides a zero-argument callable that creates the default value for the field. This is necessary for mutable defaults like lists or dicts to avoid the shared mutable default argument problem.

Q1046. [Ansible] What does "ansible" mean etymologically?

A: It is a contraction of "answerable" -- reflecting the device's ability to deliver responses across interstellar distances with no delay.

Q1047. [Python] What is the @typing.dataclass_transform decorator?

A: Added in Python 3.11 (PEP 681), it tells type checkers that a decorator or base class creates dataclass-like classes, enabling proper type checking for ORMs and similar frameworks.

Q1048. [Ansible] What controversy surrounds Ansible Lightspeed and the community?

A: The LLM was trained on community-contributed code, and some contributors felt they wouldn't receive credit despite having built and shared that code publicly. --- --- ## 20. Testing with Molecule & Lint

Q1049. [Ansible] What is the throttle keyword?

A: Limits the number of concurrent hosts for a specific task (not the entire play like serial).

Q1050. [Ansible] What are callback plugins used for?

A: They respond to events during Ansible execution -- controlling output formatting, sending notifications, logging to external systems, or integrating with monitoring tools.


Batch 106

Q1051. [Python] What is collections.abc and how does it differ from collections?

A: collections.abc contains abstract base classes for containers (like Mapping, Sequence, Iterable, MutableSet). These were moved from collections in Python 3.3 and accessing them from collections directly was deprecated in 3.9 and removed in 3.10.

Q1052. [Ansible] How do you run Ansible tasks inside an existing container?

A: Use the container's connection plugin: ansible_connection: containers.podman.podman or ansible_connection: community.docker.docker with the container name/ID as the host.

Q1053. [Linux] What is the ss -s command useful for?

A: Shows socket statistics summary: total, TCP, UDP, RAW, FRAG, and per-state counts (ESTAB, SYN-SENT, TIME-WAIT, etc.). Quick overview of connection health.

Q1054. [Python] What is the per-interpreter GIL in Python 3.12?

A: PEP 684 allows each sub-interpreter to have its own GIL, enabling true parallelism between interpreters without the complexity of free-threading.

Q1055. [Ansible] What are the three main components of an Ansible rulebook?

A: Sources (define event origins like webhooks, Kafka, Alertmanager), Rules (define conditions to match against events), and Actions (specify what happens when conditions are met, like run_playbook).

Q1056. [Python] What is Python's match statement sequence pattern?

A: case [first, *rest]: matches sequences, capturing the first element and remaining elements in a list.

Q1057. [Ansible] What is ansible-test?

A: The testing tool bundled with ansible-core for testing collections. It supports sanity tests (code style, import checks), unit tests (Python unittest), and integration tests (full playbook runs).

Q1058. [Linux] What does "ls" stand for?

A: "LiSt" — lists directory contents.

Q1059. [Python] What does string.ascii_letters contain?

A: All ASCII letters: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.

Q1060. [Python] What is the Python REPL's _ variable?

A: In the interactive interpreter, _ holds the result of the last expression evaluated. For example, after typing 2 + 3, _ equals 5.


Batch 107

Q1061. [Python] What PEPs define structural pattern matching?

A: PEP 634 (specification), PEP 635 (motivation and rationale), and PEP 636 (tutorial).

Q1062. [Python] What does the * separator in function parameters do?

A: Parameters after * are keyword-only: def f(a, *, b): means b must be passed as a keyword argument. Added in Python 3.0.

Q1063. [Python] What is Matplotlib's pyplot interface?

A: A MATLAB-like procedural interface for creating plots, accessed as matplotlib.pyplot (commonly imported as plt).

Q1064. [Linux] How does find -exec work?

A: Executes a command on each match: find /var -name "*.log" -exec gzip {} \;. Using + instead of \; batches files into fewer command invocations: find . -name "*.txt" -exec wc -l {} +.

Q1065. [Python] Who is the current fastest growing Python web framework (as of 2025)?

A: FastAPI, created by Sebastian Ramirez in 2018. It became one of the most starred Python frameworks on GitHub within a few years.

Q1066. [Linux] What is watch?

A: Runs a command repeatedly (default every 2 seconds) and displays the output. watch -n 1 'ss -tlnp' monitors listening ports every second. -d highlights changes.

Q1067. [Ansible] What was Michael DeHaan's job before creating Ansible, and why did he leave?

A: He worked briefly at Puppet Labs and then at another company doing integration work. Neither was a good fit, and he wanted to return to building open-source tooling. His frustration with multi-day setup times for DNS/NTP issues led him to create Ansible.

Q1068. [Ansible] What is idempotency?

A: The property that running the same operation multiple times produces the same result as running it once. No unnecessary changes are made on subsequent runs.

Q1069. [Linux] What is log shipping?

A: Forwarding logs from local systems to a centralized logging server. rsyslog can forward via TCP/UDP. journald can forward to a remote journal-remote. Common in production for compliance and troubleshooting. --- ## 21. Quick-Fire Trivia & Rapid Recall

Q1070. [Linux] What is the difference between journalctl -xe and journalctl -u service?

A: -xe shows the end of the journal with explanatory text for catalog entries. -u service filters by a specific systemd unit. Combine them: journalctl -xeu nginx.service.


Batch 108

Q1071. [Linux] What year did Linux first surpass 50% of the web server market?

A: By the mid-2000s, Linux-based servers (primarily running Apache) held over 60% of the public web server market.

Q1072. [Linux] What is systemd-networkd?

A: systemd's network management daemon for configuring network interfaces via .network, .netdev, and .link files in /etc/systemd/network/. Lightweight alternative to NetworkManager for servers and containers.

Q1073. [Ansible] What is the script module?

A: Transfers a script to the remote host and executes it. The script runs in the remote host's shell.

Q1074. [Ansible] What does the lineinfile module do?

A: Ensures a particular line is present (or absent) in a file. Useful for managing configuration files.

Q1075. [Ansible] What is the difference between lookup and query?

A: lookup returns a comma-separated string by default; query returns a list. query is preferred in modern Ansible for clarity.

Q1076. [Linux] What is the difference between insmod and modprobe?

A: insmod loads a specific module file without resolving dependencies. modprobe is smarter — it resolves and loads dependencies automatically using modules.dep.

Q1077. [Ansible] How can you detect check mode inside a playbook?

A: Use the ansible_check_mode magic variable: when: not ansible_check_mode to skip a task in check mode. ---

Q1078. [Ansible] What happened to with_items, with_dict, with_file, etc.?

A: These are legacy loop constructs. Modern Ansible uses loop: with filters: loop: "{{ my_list }}", loop: "{{ my_dict | dict2items }}", etc.

Q1079. [Python] What does heapq.nlargest(n, iterable) do, and when is it more efficient than sorting?

A: It returns the n largest elements from an iterable. It is more efficient than full sorting when n is small relative to the iterable size, using a min-heap of size n internally.

Q1080. [Ansible] How many levels of variable precedence does Ansible have?

A: 22 levels, from lowest (command line values like -u user) to highest (--extra-vars/-e).


Batch 109

Q1081. [Python] What is the PYTHONPATH environment variable?

A: A colon-separated (semicolon on Windows) list of directories added to sys.path before the default entries.

Q1082. [Linux] Where are systemd unit files stored?

A: /usr/lib/systemd/system/ (package defaults), /etc/systemd/system/ (admin overrides, highest priority), /run/systemd/system/ (runtime generated).

Q1083. [Ansible] What happens if you use a short module name (e.g., "copy") instead of the FQCN in a post-2.10 playbook?

A: Ansible resolves it using the collections keyword search path or falls back to ansible.builtin. It still works for built-in modules, but using short names for collection modules is ambiguous and deprecated behavior. Best practice is always FQCN.

Q1084. [Linux] What does net.core.somaxconn control?

A: The maximum number of queued connection requests for a listening socket (backlog). Default was 128, often increased to 4096+ for high-traffic servers.

Q1085. [Python] What limitation do lookbehinds have in Python's re module?

A: Lookbehinds must be fixed-width — they cannot contain quantifiers like *, +, or {m,n} (variable-length). The regex third-party module removes this limitation.

Q1086. [Ansible] What does state: present mean in a module?

A: Ensures the resource exists (e.g., a package is installed, a user exists).

Q1087. [Linux] What is an overlay filesystem?

A: A union filesystem that layers a read-write upper directory on top of read-only lower directories. Used by Docker/Podman to create container filesystems from stacked image layers. The default is overlay2.

Q1088. [Python] What does str.removeprefix() do, and when was it added?

A: Added in Python 3.9, it removes the specified prefix if the string starts with it, otherwise returns the string unchanged. Similarly removesuffix() for suffixes.

Q1089. [Linux] What is the thundering herd problem?

A: When many sleeping processes/threads are woken simultaneously by a single event (e.g., new connection on a listening socket), but only one can handle it. The others waste CPU waking up and going back to sleep. EPOLLEXCLUSIVE mitigates this.

Q1090. [Python] What is pytest.fixture(scope='session')?

A: A fixture that runs once per test session (all tests). Useful for expensive setup that should be shared across all tests.


Batch 110

Q1091. [Ansible] What is the Ansible Tower rebrand name?

A: Red Hat Ansible Automation Platform (AAP). "Ansible Tower" is the legacy name for the web UI component.

Q1092. [Ansible] What does the combine filter do, and why is it so useful?

A: It merges two or more dictionaries. With recursive=True, it does deep merging. This is essential for combining default values with overrides in complex variable structures. Example: {{ defaults | combine(overrides, recursive=True) }}.

Q1093. [Linux] How do you list all installed packages on Debian/Ubuntu?

A: dpkg -l or apt list --installed.

Q1094. [Python] What does object.__subclasses__() return?

A: A list of all immediate subclasses of the class that are still alive in memory.

Q1095. [Ansible] How do you invoke a lookup plugin in a playbook?

A: Using lookup('plugin_name', 'arg') or the with_<plugin_name> loop syntax, or query('plugin_name', 'arg') which always returns a list.

Q1096. [Linux] What does the env command do?

A: Without arguments, prints all environment variables. With arguments, runs a command in a modified environment: env VAR=value command.

Q1097. [Ansible] Name three enterprise features that Ansible Tower/Controller has that AWX lacks.

A: (1) Red Hat SLA-backed support with guaranteed security vulnerability response; (2) Supported, tested upgrade migration paths between versions; (3) ISV (Independent Software Vendor) compatibility certifications. AWX is community-supported only.

Q1098. [Linux] What is the maximum number of TCP connections a Linux server can handle?

A: Theoretically limited by available file descriptors, memory, and the ephemeral port range. A server can handle millions of connections since it uses one port (e.g., 80) and connections are identified by the 4-tuple (src_ip, src_port, dst_ip, dst_port).

Q1099. [Python] What year did Python first appear on the TIOBE index top 3?

A: Python first reached the #1 spot on TIOBE in October 2021, though it had been in the top 3 since around 2018.

Q1100. [Ansible] Can you apply tags to roles, blocks, and imports?

A: Yes. Tags applied to roles:, import_tasks, import_role, or block are inherited by all tasks within. Tags on include_tasks apply only to the include task itself, NOT to the tasks inside. --- --- ## 15. Plugins Deep Dive


Batch 111

Q1101. [Linux] What is the yes command?

A: Repeatedly outputs a string (default "y") until killed. Used to auto-accept prompts: yes | apt-get install package. Also used for stress testing.

Q1102. [Python] What is math.isclose(a, b) used for?

A: Comparing floating-point numbers for approximate equality, with configurable relative tolerance (rel_tol, default 1e-9) and absolute tolerance (abs_tol, default 0.0).

Q1103. [Ansible] When did Ansible drop Python 2 support on the control node?

A: ansible-core 2.12 dropped Python 2.7 support on the control node (requires Python 3.8+). However, managed nodes could still use Python 2.7 until ansible-core 2.17.

Q1104. [Python] What happens when you run import this in Python?

A: It prints "The Zen of Python" — 19 aphorisms by Tim Peters that capture Python's design philosophy.

Q1105. [Linux] What is port 8080 commonly used for?

A: An alternative HTTP port, often used for web application servers, proxies, and development servers to avoid requiring root for binding to port 80.

Q1106. [Linux] What are the fields in /etc/fstab?

A: Device (UUID/path), mount point, filesystem type, mount options, dump flag (0/1), fsck pass number (0/1/2). Six fields separated by whitespace.

Q1107. [Python] How can you restrict what classes can be unpickled for security?

A: By subclassing pickle.Unpickler and overriding the find_class() method to whitelist allowed modules and classes.

Q1108. [Linux] What does exit code 128+n mean?

A: The process was killed by signal n. For example, 137 = 128+9 (killed by SIGKILL), 143 = 128+15 (killed by SIGTERM).

Q1109. [Ansible] What playbook filename does ansible-pull look for by default?

A: It looks for <hostname>.yml (matching the host's hostname) or local.yml in the repository root.

Q1110. [Ansible] What are "resource modules" in network automation?

A: Modules that manage a specific network resource declaratively (e.g., ios_interfaces, nxos_vlans, eos_bgp_global). They accept a desired state and determine the necessary commands to achieve it, providing true idempotency for network configurations. --- --- ## 22. Windows Automation


Batch 112

Q1111. [Ansible] How do you enable a notification callback plugin?

A: Add it to the callback_whitelist (or callbacks_enabled in newer versions) setting in ansible.cfg. ---

Q1112. [Python] What is the difference between re.match() and re.search()?

A: re.match() only matches at the beginning of the string. re.search() scans through the entire string for the first match anywhere.

Q1113. [Linux] What does vmstat show?

A: System-wide stats: processes (r=running, b=blocked), memory (swap, free, buffer, cache), swap I/O, block I/O, CPU percentages (user, system, idle, iowait, steal). Usage: vmstat 1 5 (every 1 second, 5 times).

Q1114. [Linux] What is the difference between IPv4 and IPv6 address sizes?

A: IPv4: 32-bit addresses (~4.3 billion). IPv6: 128-bit addresses (~3.4 x 10^38). IPv6 addresses are written in hexadecimal groups separated by colons (e.g., 2001:0db8::1).

Q1115. [Python] What is async/await in Python?

A: Syntax for asynchronous programming introduced in Python 3.5 (PEP 492). async def defines a coroutine, and await suspends execution until an awaitable completes.

Q1116. [Ansible] What is ignore_unreachable?

A: A directive that tells Ansible to continue with remaining tasks even when a host becomes unreachable, rather than removing it from the play.

Q1117. [Ansible] What does the apt module do?

A: Manages packages on Debian/Ubuntu systems (install, remove, update).

Q1118. [Linux] What was the original name Linus considered for the kernel before "Linux"?

A: Linus originally wanted to call it "Freax" (a portmanteau of free, freak, and x for Unix). Ari Lemmke, who hosted the FTP upload, named the directory "linux" instead.

Q1119. [Python] What is super() and how does it work?

A: super() returns a proxy object that delegates method calls to a parent or sibling class in the MRO. In Python 3, super() with no arguments works inside methods.

Q1120. [Python] When was pip first released?

A: In 2008, created by Ian Bicking.


Batch 113

Q1121. [Ansible] What is the difference between ansible_play_hosts and ansible_play_hosts_all?

A: ansible_play_hosts contains only hosts still active (not failed). ansible_play_hosts_all contains all hosts originally targeted by the play, regardless of failures.

Q1122. [Ansible] When did Ansible collections replace the monolithic package?

A: Ansible 2.10 (September 2020) split the package into ansible-core (runtime engine) and separate collections. Ansible 2.9 was the last monolithic release.

Q1123. [Linux] What is UsrMerge?

A: The initiative to merge /bin/usr/bin, /sbin/usr/sbin, /lib/usr/lib, /lib64/usr/lib64. The root-level directories become symlinks. Adopted by Fedora, Arch, Debian 12+, Ubuntu 23.04+, and others.

Q1124. [Ansible] What command shows the Ansible version?

A: ansible --version

Q1125. [Ansible] What does the docker_container module do?

A: Manages Docker containers -- create, start, stop, remove containers.

Q1126. [Python] What is exception chaining in Python?

A: When an exception is raised inside an except block, the original exception is stored in __context__. You can explicitly chain with raise NewException() from original which sets __cause__.

Q1127. [Ansible] Can tags be inherited through include_tasks?

A: Tags on include_tasks apply to the include statement itself, not to the tasks inside the included file. Use import_tasks for tag inheritance. ---

Q1128. [Linux] What do the mount options noexec, nosuid, and nodev mean?

A: noexec: prevents execution of binaries. nosuid: ignores setuid/setgid bits. nodev: ignores device files. Commonly applied to /tmp and removable media for security.

Q1129. [Python] What are all 19 aphorisms of The Zen of Python?

A: 1. Beautiful is better than ugly. 2. Explicit is better than implicit. 3. Simple is better than complex. 4. Complex is better than complicated. 5. Flat is better than nested. 6. Sparse is better than dense. 7. Readability counts. 8. Special cases aren't special enough to break the rules. 9. Although practicality beats purity. 10. Errors should never pass silently. 11. Unless explicitly silenced. 12. In the face of ambiguity, refuse the temptation to guess. 13. There should be one -- and preferably only one -- obvious way to do it. 14. Although that way may not be obvious at first unless you're Dutch. 15. Now is better than never. 16. Although never is often better than right now. 17. If the implementation is hard to explain, it's a bad idea. 18. If the implementation is easy to explain, it may be a good idea. 19. Namespaces are one honking great idea -- let's do more of those!

Q1130. [Ansible] Why does Ansible mark all strings returned by modules as "Unsafe"?

A: To prevent Jinja2 template injection attacks. Without this, malicious code embedded in module output could execute on the control node during template rendering.


Batch 114

Q1131. [Ansible] Ansible is sometimes described as "procedural" while Puppet is "declarative." What does this mean in practice?

A: Ansible playbooks execute tasks in the order written (procedural) -- the order matters. Puppet manifests describe the desired end state (declarative) -- Puppet's engine determines the order of operations to converge to that state.

Q1132. [Linux] What is eBPF used for in networking?

A: Traffic control, XDP packet processing, socket filtering, load balancing (Cilium, Katran), network observability, and programmable firewalling. It allows custom network logic without kernel modifications.

Q1133. [Python] What does the __future__ module do?

A: It enables features from future Python versions in the current version. For example, from __future__ import annotations (PEP 563) makes all annotations strings by default (lazy evaluation).

Q1134. [Python] What is ruff?

A: An extremely fast Python linter and code formatter written in Rust, created by Charlie Marsh / Astral. It aims to replace Flake8, isort, pyupgrade, and Black in a single tool.

Q1135. [Linux] What is ELK/EFK stack?

A: ELK: Elasticsearch (storage/search), Logstash (processing), Kibana (visualization). EFK replaces Logstash with Fluentd/Fluent Bit (lighter weight). Used for centralized log aggregation and analysis.

Q1136. [Python] What does the enum.Flag class allow?

A: It supports bitwise operations (|, &, ^, ~) on enum members, allowing them to be combined as bit flags.

Q1137. [Ansible] What module is used to gather system information?

A: setup

Q1138. [Linux] What is RCU (Read-Copy-Update)?

A: A synchronization mechanism optimized for read-heavy workloads. Readers access shared data without locks; writers create a copy, modify it, and atomically replace the pointer. Reclamation of old data waits until all readers complete.

Q1139. [Python] What is typing.Any?

A: A special type that is compatible with every type. Variables annotated with Any are not type-checked. It is the "escape hatch" from the type system.

Q1140. [Python] What did Guido work on at Dropbox?

A: He helped improve Dropbox's Python codebase and was involved with type checking and mypy adoption.


Batch 115

Q1141. [Python] What is a higher-order function?

A: A function that takes another function as an argument or returns a function. map(), filter(), sorted() (with key), and decorators are examples.

Q1142. [Python] What is the ast module used for?

A: It parses Python source code into an Abstract Syntax Tree (AST), which can be inspected, modified, and compiled. Used by linters, code formatters, and metaprogramming tools.

Q1143. [Ansible] Do environment variables override ansible.cfg settings?

A: Yes. Individual ANSIBLE_* environment variables have higher precedence than ansible.cfg entries.

Q1144. [Linux] What is /proc/interrupts?

A: Shows interrupt counts per CPU for each IRQ line, including the interrupt controller, device, and type. Useful for identifying interrupt imbalances and NIC queue distribution.

Q1145. [Python] What does isinstance(True, int) return?

A: True, because bool is a subclass of int.

Q1146. [Ansible] What was "ansible-base" and when did it appear?

A: ansible-base was the name for the stripped-down core engine introduced with the 2.10 release cycle (mid-2020). It contained only the command-line tools, core modules (like copy, file, command, shell), and essential plugins. It was renamed to "ansible-core" starting with version 2.11.

Q1147. [Linux] What does "POSIX" stand for?

A: Portable Operating System Interface — a family of IEEE standards (1003.x) for Unix-like OS compatibility.

Q1148. [Python] What is pathlib.Path.glob() used for?

A: Pattern matching for files within a directory tree: Path('.').glob('**/*.py') finds all Python files recursively.

Q1149. [Ansible] Can you force a specific task to always or never run in check mode?

A: Yes. check_mode: true makes a task always run in check mode even during a normal run. check_mode: false makes a task always execute normally even during a check mode run.

Q1150. [Linux] What is port 25 used for?

A: SMTP (Simple Mail Transfer Protocol) — email delivery between mail servers.


Batch 116

Q1151. [Linux] What does ${#var} do?

A: Returns the length (number of characters) of the value of $var.

Q1152. [Python] What method on a namedtuple creates a new instance with some fields replaced?

A: ._replace(**kwargs). It returns a new instance since namedtuples are immutable.

Q1153. [Python] What is Python's match statement OR pattern?

A: Use | to match multiple patterns: case 200 | 201 | 202: matches any of those status codes.

Q1154. [Python] What are first-class functions?

A: In Python, functions are objects — they can be assigned to variables, passed as arguments, returned from other functions, and stored in data structures.

Q1155. [Python] What is seaborn?

A: A statistical data visualization library built on top of Matplotlib that provides a higher-level interface for creating attractive statistical graphics.

Q1156. [Ansible] How do you implement zero-downtime deployments?

A: Rolling updates with serial, drain servers from load balancer before update, health checks after deployment, block/rescue for rollback capability.

Q1157. [Ansible] What is a play in Ansible?

A: A section within a playbook that maps a group of hosts to a set of tasks. A playbook can contain multiple plays.

Q1158. [Ansible] What is the precedence difference between roles/x/defaults/main.yml and roles/x/vars/main.yml?

A: Role defaults are level 2 (lowest, easily overridden). Role vars are level 15 (quite high, hard to override except with set_fact, include_vars, role parameters, include parameters, or extra-vars).

Q1159. [Ansible] What is the listen keyword in handlers?

A: Allows multiple handlers to respond to a generic topic name, enabling grouped handler execution from a single notify.

Q1160. [Python] What is a lambda function?

A: An anonymous inline function limited to a single expression: lambda x, y: x + y. It cannot contain statements or annotations.


Batch 117

Q1161. [Python] What is python -m this?

A: It prints The Zen of Python, same as import this.

Q1162. [Linux] What is a core dump?

A: A file containing the memory image of a process at the time it crashed. Generated by signals like SIGSEGV, SIGABRT. Analyzed with gdb for debugging. Controlled by ulimit -c and /proc/sys/kernel/core_pattern.

Q1163. [Ansible] What is the standard directory structure of an Ansible role?

A: tasks/, handlers/, defaults/, vars/, files/, templates/, meta/, library/, module_utils/, lookup_plugins/, and optionally tests/.

Q1164. [Python] What is name mangling in Python?

A: Attributes starting with __ (double underscore) but not ending with __ are name-mangled: __attr in class MyClass becomes _MyClass__attr. This provides a limited form of name privacy to avoid accidental name clashes in subclasses.

Q1165. [Ansible] What does the ping module do?

A: Tests connectivity between the control node and managed nodes. It verifies SSH connection, authentication, and Python availability. Returns "pong" on success.

Q1166. [Linux] What is the difference between enable and start?

A: start immediately begins the service. enable creates symlinks so the service starts automatically at boot. Use both: systemctl enable --now <service>.

Q1167. [Linux] What is the syscall number for write on x86-64 Linux?

A: Syscall number 1. read is 0, open is 2, close is 3, exit is 60, fork is 57.

Q1168. [Python] What is the @property deleter?

A: The third component of a property: @attr.deleter defines what happens when del obj.attr is called. All three (getter, setter, deleter) are optional.

Q1169. [Python] What are the three generations in CPython's garbage collector?

A: Generation 0 (youngest, collected most frequently), generation 1 (middle), and generation 2 (oldest, collected least frequently). New objects start in generation 0.

Q1170. [Python] What is the profile module vs cProfile?

A: Both are deterministic profilers with the same API. cProfile is a C extension (faster, recommended). profile is pure Python (can be extended more easily).


Batch 118

Q1171. [Python] What is the time complexity of list.append()?

A: Amortized O(1). Lists over-allocate memory, so most appends are O(1), with occasional O(n) resizes.

Q1172. [Ansible] What does "agentless" mean in the context of Ansible?

A: No software agents need to be installed on managed nodes. Ansible connects via SSH (Linux) or WinRM (Windows) directly from the control node.

Q1173. [Ansible] What is the default verifier in Molecule 6+?

A: Ansible itself (using assert/debug tasks). Testinfra (Python-based) was the previous default and is now optional. ---

Q1174. [Ansible] What protocol does Ansible use to manage Windows hosts?

A: WinRM (Windows Remote Management), a SOAP-based protocol over HTTP/HTTPS. Ansible can use it through the psrp or winrm connection plugins.

Q1175. [Ansible] What is the host_pinned strategy?

A: Similar to free, but it pins each host to a dedicated worker, ensuring one host doesn't monopolize workers. This is useful for debugging or when tasks have varying execution times.

Q1176. [Ansible] What is the ansible_connection variable set to for network devices?

A: Typically ansible.netcommon.network_cli, ansible.netcommon.netconf, or ansible.netcommon.httpapi, depending on the platform and API type.

Q1177. [Linux] What is the nmap command?

A: Network exploration and security auditing tool. nmap -sT host performs a TCP connect scan. nmap -sV host detects service versions. nmap -O host attempts OS detection.

Q1178. [Linux] What is the difference between a hard link and a soft (symbolic) link?

A: A hard link is another directory entry pointing to the same inode — same file, same data. A soft link is a special file containing a path to the target. Hard links can't cross filesystems or link to directories; soft links can do both.

Q1179. [Python] What is object.__new__?

A: The static method that actually allocates memory for a new instance. All classes inherit it from object. It is called before __init__.

Q1180. [Python] What is collections.abc.Iterator vs collections.abc.Iterable?

A: Iterable defines __iter__(). Iterator defines both __iter__() and __next__(). All iterators are iterable, but not all iterables are iterators (e.g., lists are iterable but not iterators).


Batch 119

Q1181. [Python] What module lets you pack and unpack binary data in C struct format?

A: The struct module. It uses format strings like '<I' (little-endian unsigned int) to pack/unpack bytes.

Q1182. [Python] What does math.lcm() compute, and when was it added?

A: The least common multiple. Added in Python 3.9, it accepts multiple arguments: math.lcm(4, 6, 10) returns 60.

Q1183. [Ansible] What is ansible-vault encrypt_string used for?

A: It encrypts a single string value (rather than an entire file) for embedding directly in a YAML file as an inline encrypted variable. This lets you mix encrypted and plain-text variables in the same file.

Q1184. [Ansible] What are Ansible facts?

A: System information automatically collected from managed nodes at the beginning of each play (OS, IP, CPU, memory, disk, etc.). Accessed via ansible_facts dictionary.

Q1185. [Linux] What is chroot?

A: Changes the apparent root directory for a process and its children. Provides basic isolation but is NOT a security boundary (root can escape a chroot). Used for system repair and build environments.

Q1186. [Linux] What happens when you run :(){ :|:& };: in a shell?

A: This is a fork bomb — a function named : that calls itself twice, piping to itself, backgrounded. It exponentially spawns processes until the system is overwhelmed. Mitigated by ulimit or cgroup PID limits.

Q1187. [Python] What is marshal and how does it differ from pickle?

A: marshal is used internally by Python to read/write .pyc files. It is faster than pickle but only supports basic Python types, is not meant for general serialization, and its format can change between Python versions.

Q1188. [Python] What is the safer way to use subprocess?

A: Use subprocess.run(['cmd', 'arg1', 'arg2']) with a list of arguments instead of a shell string. This avoids shell injection vulnerabilities.

Q1189. [Ansible] What is the local_action keyword?

A: Runs a task on the control node instead of the remote host. Equivalent to delegate_to: localhost.

Q1190. [Ansible] How do you install a collection?

A: ansible-galaxy collection install namespace.collection_name


Batch 120

Q1191. [Linux] What is the ZFS licensing controversy?

A: ZFS is licensed under the CDDL (Common Development and Distribution License), which the FSF considers incompatible with GPLv2. This prevents ZFS from being distributed as part of the Linux kernel. Ubuntu includes it via DKMS; others use OpenZFS as a loadable module.

Q1192. [Linux] What was the Tanenbaum-Torvalds debate about?

A: In January 1992, Andrew Tanenbaum posted "LINUX is obsolete" on comp.os.minix, arguing that a monolithic kernel was a step backward and that microkernels were the future. Torvalds defended Linux's pragmatic monolithic design.

Q1193. [Python] What is __spec__ in a module?

A: A ModuleSpec object (added in Python 3.4) containing metadata about how the module was loaded, including its name, loader, and origin.

Q1194. [Linux] How many privilege rings does x86 architecture define, and which does Linux use?

A: x86 defines 4 rings (0-3). Linux uses only ring 0 (kernel) and ring 3 (user space). Rings 1 and 2 are unused.

Q1195. [Ansible] What does module_defaults do at the play or block level?

A: Sets default parameter values for specific modules across multiple tasks. Example: setting become: true for all yum module calls without repeating it per task.

Q1196. [Linux] What is the rescue.target in systemd?

A: Equivalent to single-user mode. Starts a minimal system with basic services and a root shell. The root filesystem is mounted read-write. Access with systemd.unit=rescue.target. --- ## 4. Process Management

Q1197. [Ansible] What is order at the play level?

A: Controls host execution order: inventory (default), reverse_inventory, sorted, reverse_sorted, shuffle. ---

Q1198. [Ansible] What is ansible-vault encrypt_string?

A: A command that encrypts a single string value inline, which can be embedded directly in a YAML file alongside unencrypted variables.

Q1199. [Ansible] How do you set the strategy for a play?

A: With the strategy: keyword at the play level: strategy: free.

Q1200. [Python] What module provides arbitrary-precision decimal arithmetic?

A: The decimal module with its Decimal class. It avoids the floating-point representation issues of float.


Batch 121

Q1201. [Linux] What is the difference between kill -l and trap -l?

A: Both list available signals. kill -l lists signal names (may include numbers). trap -l also lists signals. Both show the same signals; kill -l 9 returns "KILL".

Q1202. [Linux] What is /proc/sys/?

A: A directory tree of tunable kernel parameters. Values can be read and written at runtime. Changes are temporary unless persisted via sysctl.conf.

Q1203. [Ansible] What is ansible_check_mode?

A: A magic variable that is true when the playbook is running in check mode (--check).

Q1204. [Linux] What does grep -r do?

A: Recursively searches through directories. -R follows symbolic links; -r does not.

Q1205. [Linux] What is LC_ALL?

A: Overrides ALL locale variables (LANG, LC_TIME, LC_NUMERIC, etc.) unconditionally. Setting LC_ALL=C forces the POSIX locale for consistent behavior in scripts.

Q1206. [Python] What is a Python wheel's tag format?

A: {python tag}-{abi tag}-{platform tag}. For example, cp311-cp311-manylinux_2_17_x86_64 means CPython 3.11, CPython 3.11 ABI, 64-bit Linux.

Q1207. [Linux] What is the column -t command useful for?

A: Formats whitespace-delimited input into aligned columns. cat /etc/fstab | column -t produces a neatly formatted table.

Q1208. [Ansible] What module manages firewall rules?

A: firewalld (for firewalld) or iptables (for iptables).

Q1209. [Ansible] How are Steering Committee members selected?

A: Based on their active contribution to the Ansible project and community. New members are nominated and voted on by existing committee members.

Q1210. [Linux] What does tee do?

A: Reads stdin, writes to both stdout and one or more files: command | tee output.log displays output and saves it. -a appends instead of overwriting.


Batch 122

Q1211. [Ansible] What is the latest ansible-core Python requirement (as of 2.20)?

A: Python 3.12+ on the control node.

Q1212. [Ansible] Who created Ansible, and in what year was it first released?

A: Michael DeHaan created Ansible and released it as an open-source project in February 2012.

Q1213. [Ansible] What is the security risk of using shell or command modules with user-supplied variables?

A: Command injection. If variables are interpolated into command strings without proper quoting/validation, an attacker could inject arbitrary commands. Prefer purpose-built modules over shell/command when possible.

Q1214. [Python] What new generic syntax was introduced in Python 3.12?

A: PEP 695 introduced def func[T](x: T) -> T: and class MyClass[T]: syntax, replacing the verbose TypeVar pattern with inline generic parameters.

Q1215. [Python] What is memoryview used for?

A: It creates a view of the memory of a bytes-like object without copying. Useful for zero-copy slicing of large binary data like bytes, bytearray, or array.array.

Q1216. [Ansible] What does the ansible-config command do?

A: Displays, dumps, or validates Ansible configuration settings.

Q1217. [Python] What is the reprlib module used for?

A: It provides a version of repr() that limits output length for large or recursive data structures. reprlib.repr([1]*1000) gives a truncated representation.

Q1218. [Python] What does f'{value=}' do, introduced in Python 3.8?

A: The = specifier in f-strings shows both the expression text and its value. For example, x=42; f'{x=}' produces "x=42". It is useful for debugging.

Q1219. [Ansible] What is the difference between a Decision Environment and an Execution Environment in Event-Driven Ansible?

A: A Decision Environment handles event logic -- listening for events, filtering, and evaluating conditions in rulebooks. An Execution Environment runs the actual Ansible playbooks triggered when a condition is matched. ---

Q1220. [Linux] What filesystem does Debian/Ubuntu use by default?

A: ext4 — the most widely deployed Linux filesystem, known for backward compatibility, reliability, and mature tooling.


Batch 123

Q1221. [Linux] What is the difference between /etc/environment and shell profile files?

A: /etc/environment is read by PAM (not a shell script — just KEY=VALUE lines) and sets variables for all login sessions regardless of shell. Profile files (.bashrc, .profile) are shell-specific and support scripting.

Q1222. [Python] What does textwrap.fill() do?

A: It wraps a single paragraph of text to a given width and returns a single string with newlines inserted. textwrap.wrap() returns a list of lines instead.

Q1223. [Python] What is a Jupyter kernel?

A: The computation engine that executes code in a notebook. Each kernel runs a specific language (IPython for Python). Multiple kernels can be installed for different languages or environments.

Q1224. [Ansible] What AI model powers Ansible Lightspeed?

A: IBM watsonx Code Assistant, trained on Ansible community content and code patterns.

Q1225. [Python] What are the three string formatting approaches in Python?

A: %-formatting ('%s' % val), str.format() ('{}'.format(val)), and f-strings (f'{val}'). F-strings (Python 3.6+) are generally preferred for readability and performance.

Q1226. [Ansible] What is configuration drift?

A: Changes on a host that cause it to differ from the desired/synced state, often from ad-hoc manual modifications. Ansible combats drift through idempotent playbook runs.

Q1227. [Linux] What is the advantage of SELinux's label-based approach?

A: Labels follow the object (file, process) regardless of path. If a file is moved or hard-linked, the security context stays correct. Path-based systems (AppArmor) can be bypassed by accessing the same file through a different path.

Q1228. [Linux] What is the command to start a service?

A: systemctl start <service>.

Q1229. [Linux] What is the maximum filename length in most Linux filesystems?

A: 255 bytes (characters in UTF-8 may use multiple bytes).

Q1230. [Python] What does re.escape(string) do?

A: It escapes all non-alphanumeric characters in the string, making it safe to use as a literal pattern in a regex.


Batch 124

Q1231. [Ansible] What is the forks setting?

A: Controls how many parallel processes Ansible uses to execute tasks across hosts. Default is 5.

Q1232. [Linux] What signal number is SIGTERM?

A: 15. The default signal sent by kill. It asks a process to terminate gracefully and can be caught for cleanup.

Q1233. [Ansible] What happens if you reference an undefined variable?

A: Ansible raises a fatal error and stops execution, unless you use the default filter: {{ var | default('fallback') }}

Q1234. [Linux] Who is Greg Kroah-Hartman?

A: The stable kernel maintainer and one of the most prolific Linux kernel contributors. He manages the stable release process and maintains the driver core, staging tree, and USB subsystem.

Q1235. [Ansible] How does include_vars compare to vars_files in precedence?

A: include_vars (level 18) has higher precedence than vars_files (level 14). ---

Q1236. [Linux] What does "rsync" stand for?

A: "Remote Sync" — an efficient file transfer tool that only copies differences (delta encoding). rsync -avz source/ dest/ is the most common invocation.

Q1237. [Ansible] What are Ansible Working Groups?

A: Self-organized teams of community members focused on specific topics -- often centered around particular collections (e.g., AWS, Windows, Network) or cross-cutting concerns (documentation, testing, security).

Q1238. [Ansible] What is delegate_to?

A: Runs a task on a different host than the current play target. Useful for orchestration like removing a host from a load balancer before updating it.

Q1239. [Python] What is the Django admin?

A: An automatically generated web-based admin interface for managing data. It introspects your models and creates CRUD pages with minimal configuration. --- ## 17. Data Science Stack

Q1240. [Python] What is the graphlib module?

A: Added in Python 3.9, it provides TopologicalSorter for topological sorting of directed acyclic graphs. Useful for dependency resolution.


Batch 125

Q1241. [Linux] What is ip netns?

A: Manages network namespaces. ip netns add ns1 creates a namespace. ip netns exec ns1 bash runs commands inside it. Used by containers and for network testing/isolation.

Q1242. [Ansible] What does the idempotence step verify?

A: It runs the converge playbook a second time and checks that no tasks report "changed." This validates that the role is idempotent.

Q1243. [Linux] What command shows the process tree?

A: pstree shows processes in a tree hierarchy. ps auxf also shows a forest view.

Q1244. [Linux] What does netcat (nc) do?

A: A versatile networking tool for reading/writing TCP and UDP connections. Used for port scanning (nc -zv host 1-1000), file transfer, banner grabbing, and creating simple client-server connections.

Q1245. [Linux] What is virsh?

A: The libvirt command-line interface. virsh list --all shows VMs. virsh start/shutdown/destroy vm manages lifecycle. virsh console vm attaches to the serial console.

Q1246. [Linux] What is the nmcli command?

A: NetworkManager's CLI tool. nmcli device status shows interfaces. nmcli connection show lists connections. nmcli connection modify eth0 ipv4.addresses 10.0.0.5/24 sets a static IP.

Q1247. [Python] What is the mutable default argument gotcha?

A: Default arguments are evaluated once at function definition time, not each call. So def f(x=[]): shares the same list across all calls. Use None and create the list inside the function instead.

Q1248. [Python] What does the secrets module provide that random does not?

A: Cryptographically secure random numbers suitable for passwords, tokens, and security-sensitive operations. The random module uses a Mersenne Twister PRNG that is predictable and not suitable for security.

Q1249. [Ansible] What is the environment keyword used for?

A: Sets environment variables for task execution on the remote host.

Q1250. [Linux] What is /etc/login.defs?

A: Configuration file defining default settings for user account creation: UID/GID ranges, password aging defaults, umask, home directory creation, and encryption method.


Batch 126

Q1251. [Linux] What are the six fields of crontab -l output?

A: Minute, hour, day of month, month, day of week, and command. Unlike /etc/crontab, per-user crontabs do NOT have a username field.

Q1252. [Ansible] What verifiers does Molecule support?

A: Ansible (default, using assert/stat/command tasks in a verify.yml playbook), testinfra (Python-based infrastructure testing), and third-party plugins like InSpec.

Q1253. [Linux] What is SSH ProxyJump?

A: A feature (ssh -J jump_host target_host or ProxyJump in ssh_config) that connects to a target through an intermediate bastion/jump host without needing a shell on the jump host.

Q1254. [Ansible] How do you decrypt a file?

A: ansible-vault decrypt secrets.yml

Q1255. [Python] What Python library has become the standard for data validation and settings management?

A: Pydantic, which uses Python type annotations for runtime data validation, serialization, and deserialization.

Q1256. [Python] What is the email module?

A: It provides tools for parsing, creating, and sending email messages, including MIME multipart messages with attachments.

Q1257. [Ansible] What are Execution Environments?

A: Container images that package Ansible with all required dependencies (Python packages, collections, system libraries). Used with ansible-navigator.

Q1258. [Linux] How does systemd integrate with cgroups?

A: Each systemd service runs in its own cgroup, allowing resource accounting and limits. Use CPUQuota=, MemoryMax=, IOWeight= in unit files. systemd-cgtop shows per-service resource usage.

Q1259. [Python] What does any(generator_expression) short-circuit?

A: Yes. any() stops iterating as soon as it finds a truthy value, and all() stops at the first falsy value. This makes them efficient for large iterables.

Q1260. [Linux] What does strace do?

A: Traces system calls made by a process: strace -p <PID> attaches to a running process. strace command traces from start. -e trace=network filters to network syscalls. -c provides a summary of syscall counts and times.


Batch 127

Q1261. [Ansible] What are the three main things to investigate for a slow playbook on 500 hosts?

A: 1) Enable SSH pipelining, 2) increase forks for more parallelism, 3) configure fact caching to avoid re-gathering facts. ---

Q1262. [Ansible] What does the template module do?

A: Processes a Jinja2 template file and deploys the rendered result to managed nodes.

Q1263. [Ansible] How do you loop over a list of items?

A: Use the loop keyword: loop: [httpd, git, curl] and reference {{ item }} in the task.

Q1264. [Ansible] What are dynamic inventory plugins for cloud providers?

A: Plugins that query cloud infrastructure (AWS, Azure, GCP) to dynamically populate Ansible inventory without manual host list maintenance.

Q1265. [Linux] What is the turbostat command?

A: Reports CPU frequency, C-states, power consumption, and temperature per core. Useful for verifying CPU power management, frequency scaling, and thermal throttling.

Q1266. [Ansible] What is the loop_control directive?

A: Controls loop behavior: loop_var (rename loop variable), index_var (expose loop index), label (customize output display), pause (delay between iterations), extended (expose extended loop info).

Q1267. [Linux] What is the w command?

A: Shows who is currently logged in and what they are doing (current command). More informative than who, includes idle time, login time, and load averages.

Q1268. [Ansible] How do you set up a jump host (bastion) in Ansible?

A: Configure ProxyJump in SSH config, or use ansible_ssh_common_args: '-o ProxyJump=jump_host' in inventory/playbooks.

Q1269. [Ansible] What is the Red Hat Certified Specialist in Ansible Automation exam called?

A: EX374 -- Red Hat Certified Specialist in Developing Automation with Ansible Automation Platform. There is also EX467 for older Tower-specific content.

Q1270. [Python] What is sys.modules?

A: A dictionary mapping module names to already-loaded module objects. It serves as a cache to prevent re-importing modules.


Batch 128

Q1271. [Linux] What is SSH key-based authentication?

A: The user generates a key pair (public/private). The public key is placed in ~/.ssh/authorized_keys on the server. During login, the client proves possession of the private key via a challenge-response protocol without transmitting the key.

Q1272. [Linux] What are ausearch and aureport?

A: ausearch searches audit logs with filters (e.g., ausearch -k mykey -ts today). aureport generates summary reports from audit logs (logins, file access, syscalls, etc.).

Q1273. [Ansible] What does the file module do?

A: Manages files and directories -- create, delete, set permissions, ownership, and symlinks.

Q1274. [Linux] What does logrotate postrotate/endscript do?

A: Runs a script after log rotation. Commonly used to send SIGHUP to a daemon so it reopens log files: postrotate /usr/bin/systemctl reload rsyslog endscript.

Q1275. [Ansible] How do you backup router configurations with Ansible?

A: Use ios_config module with backup: yes parameter. Backup files are stored in a backup directory. ---

Q1276. [Python] What does the traceback module provide?

A: Functions for extracting, formatting, and printing stack traces. Useful for logging exceptions without re-raising them.

Q1277. [Linux] What is eBPF?

A: Extended Berkeley Packet Filter — a technology allowing sandboxed programs to run inside the Linux kernel without modifying kernel source or loading modules. Used for networking, observability, security, and tracing. Programs are verified for safety before execution.

Q1278. [Ansible] What is diff: true at the task level?

A: Shows a unified diff of changes made by the task (for modules that support it, like copy, template, lineinfile).

Q1279. [Linux] What is load average?

A: The average number of processes in the run queue (running + waiting for CPU + uninterruptible I/O) over 1, 5, and 15 minutes. Displayed by uptime, top, and in /proc/loadavg.

Q1280. [Python] What does calendar.isleap(year) check?

A: Whether the given year is a leap year according to the Gregorian calendar.


Batch 129

Q1281. [Ansible] What does --tags untagged mean?

A: Run only tasks that have NO tags. Tasks with the always tag still run.

Q1282. [Ansible] What is Ansible Lightspeed?

A: An AI-powered automation content creation tool from Red Hat, integrated into VS Code and Ansible Automation Platform, that generates Ansible task code from natural language descriptions.

Q1283. [Linux] What does /proc/cpuinfo contain?

A: CPU details per logical core: vendor, model name, frequency, cache size, core/thread IDs, flags (sse, avx, vmx, etc.), and bugs (spectre, meltdown mitigations).

Q1284. [Linux] What is OpenRC?

A: A dependency-based init system used by Gentoo and Alpine Linux. Compatible with SysVinit scripts but adds dependency tracking, parallel startup, and a service supervision framework. Lighter than systemd.

Q1285. [Python] When you set a value on a ChainMap, which underlying dict is modified?

A: Only the first (frontmost) mapping in the chain. Lookups search all maps, but mutations only affect maps[0].

Q1286. [Ansible] What is a pre_task and post_task?

A: pre_tasks run before roles; post_tasks run after roles and tasks. Useful for load balancer manipulation.

Q1287. [Python] What is the __weakref__ attribute?

A: A slot that allows weak references to an object. Objects with __slots__ need to explicitly include __weakref__ to support weak references.

Q1288. [Python] What is pytest's key advantage over unittest?

A: Simpler syntax — tests are plain functions with assert statements instead of requiring classes and self.assertEqual() methods. It also has a powerful fixture system and plugin ecosystem.

Q1289. [Python] Why does all([]) return True?

A: It follows the mathematical convention of vacuous truth — the statement "all elements satisfy the condition" is trivially true when there are no elements.

Q1290. [Ansible] How does changed_when work?

A: It overrides when a task reports "changed" status. Example: changed_when: false to suppress change reporting, or changed_when: "'Created' in result.stdout".


Batch 130

Q1291. [Python] What is urllib.parse.urlencode() used for?

A: Converting a dictionary to a URL-encoded query string: urlencode({'q': 'python', 'page': '1'}) returns 'q=python&page=1'.

Q1292. [Ansible] How do you pass variables from the command line?

A: ansible-playbook playbook.yml -e "var1=value1 var2=value2" or --extra-vars '{"var1": "value1"}'

Q1293. [Linux] What does grep -o do?

A: Prints only the matched portion of the line, not the entire line.

Q1294. [Python] What is sys.flags?

A: A named tuple containing the settings of command-line flags like -O, -B, -v, etc.

Q1295. [Python] What is the csv module?

A: Reading and writing CSV files with csv.reader(), csv.writer(), csv.DictReader(), and csv.DictWriter(). It handles quoting, escaping, and different dialects.

Q1296. [Linux] What does pidstat show?

A: Per-process resource statistics: CPU, memory, I/O, context switches. pidstat -d 1 shows disk I/O per process every second.

Q1297. [Python] Name three Python static type checkers besides mypy.

A: Pyright (Microsoft, used by Pylance in VS Code), pytype (Google), and Pyre (Facebook/Meta).

Q1298. [Ansible] What Jinja2 filter returns a default value when a variable is undefined?

A: default() or d() -- e.g., {{ var | default('fallback') }}.

Q1299. [Ansible] Name three event source plugins in the ansible.eda collection.

A: ansible.eda.webhook, ansible.eda.kafka, ansible.eda.alertmanager.

Q1300. [Python] What improvement did Python 3.11 make to error messages?

A: Much more precise error locations. Tracebacks now point to the exact expression that caused the error, not just the line. For example, in a['x']['y']['z'], the traceback highlights which dictionary access failed. --- ## 8. Standard Library Deep Cuts


Batch 131

Q1301. [Linux] What are the Linux kernel version numbering conventions?

A: Since 2004 (2.6.x era), the kernel uses major.minor.patch. After 3.0 (2011), Linus resets the minor version at his discretion. Version 6.x started in October 2022. Odd/even minor numbering for dev/stable was abandoned after 2.6.

Q1302. [Ansible] What did Ansible 2.5 introduce that changed how network automation worked?

A: Ansible 2.5 introduced the network_cli, httpapi, and netconf connection plugins, fundamentally changing how Ansible connected to network devices by using persistent connections instead of spawning a new connection per task.

Q1303. [Linux] What is /proc/loadavg?

A: Contains load averages (1, 5, 15 minutes), the count of runnable/total kernel scheduling entities, and the PID of the most recently created process.

Q1304. [Ansible] What does ansible-inventory --list do?

A: Outputs the complete inventory as JSON, including all groups, hosts, and variables.

Q1305. [Ansible] How do you write a conditional in Jinja2?

A: {% if condition %} ... {% elif condition %} ... {% else %} ... {% endif %}

Q1306. [Ansible] Name five ansible-lint rules.

A: (1) yaml[truthy] -- flags bare yes/no booleans; (2) no-changed-when -- flags command/shell tasks without changed_when; (3) name[missing] -- flags tasks without names; (4) fqcn[action-core] -- flags non-FQCN module names; (5) deprecated-module -- flags usage of deprecated modules.

Q1307. [Linux] What Linux kernel parameter enables IPv6?

A: net.ipv6.conf.all.disable_ipv6 = 0 (0 enables, 1 disables). Can be set per-interface with net.ipv6.conf.<iface>.disable_ipv6.

Q1308. [Linux] What are Linux capabilities?

A: Fine-grained privileges that decompose root's power into distinct units. Instead of running as root, a process can have only the capabilities it needs. Viewed with getpcaps <PID> or getcap <file>.

Q1309. [Python] Why does the GIL exist?

A: To protect CPython's reference counting from race conditions. Without the GIL, every reference count update would need its own lock, adding significant overhead.

Q1310. [Python] What is reference counting in CPython?

A: The primary memory management mechanism. Each object tracks how many references point to it. When the count reaches zero, the memory is freed immediately. The cyclic garbage collector handles reference cycles.


Batch 132

Q1311. [Ansible] What is Puppet Bolt, and how is it similar to Ansible?

A: Puppet Bolt is an agentless task-running tool from Puppet that connects via SSH/WinRM to execute tasks without requiring the Puppet agent. It is conceptually similar to Ansible ad-hoc commands and playbooks.

Q1312. [Ansible] What is include_role vs import_role?

A: Same distinction: import_role is static (parsed at load time), include_role is dynamic (loaded at runtime). import_role tasks show up in --list-tasks; include_role tasks do not until runtime. --- --- ## 6. Variables, Facts & Data

Q1313. [Linux] What is the ESP?

A: The EFI System Partition — a FAT32-formatted partition (typically 100-550MB) at the beginning of the disk containing UEFI boot loaders. Mounted at /boot/efi on Linux.

Q1314. [Linux] What is ionice?

A: Sets the I/O scheduling class and priority of a process. Classes: 1=realtime, 2=best-effort (default), 3=idle. Priorities range from 0 (highest) to 7 (lowest) within classes 1 and 2.

Q1315. [Python] What is sys.stdin, sys.stdout, sys.stderr?

A: File objects corresponding to the interpreter's standard input, output, and error streams. They can be redirected.

Q1316. [Ansible] What is the "naked variable" gotcha in Ansible YAML?

A: If a variable reference is the entire value (e.g., var: {{ some_var }}), YAML may parse it as a dictionary if the value looks like a mapping. The fix is to always quote full-line Jinja2 expressions: var: "{{ some_var }}".

Q1317. [Linux] What is logrotate?

A: A utility that rotates, compresses, and removes old log files. Configuration in /etc/logrotate.conf and /etc/logrotate.d/. Options include rotation frequency (daily, weekly), compression, max age, and post-rotation scripts.

Q1318. [Python] What is typing.Literal used for?

A: Introduced in Python 3.8, it restricts values to specific literal values: def set_mode(mode: Literal['r', 'w', 'a']) -> None.

Q1319. [Ansible] How do you install a package using an ad-hoc command?

A: ansible webservers -m apt -a "name=nginx state=present" --become

Q1320. [Linux] What is the subnet mask 255.255.255.0 in CIDR notation?

A: /24 — meaning 24 bits for network, 8 bits for hosts, allowing 254 usable addresses.


Batch 133

Q1321. [Python] What Enum subclass was introduced in Python 3.11 to ensure members are valid strings?

A: enum.StrEnum. Its members are also strings and can be used wherever strings are expected.

Q1322. [Linux] What is PSI (Pressure Stall Information)?

A: Kernel metrics (since 5.2) in /proc/pressure/{cpu,memory,io} showing the percentage of time tasks are stalled waiting for resources. Provides a unified view of resource contention without needing to interpret multiple metrics.

Q1323. [Python] What are __lt__, __le__, __gt__, __ge__?

A: Rich comparison methods: less-than, less-or-equal, greater-than, greater-or-equal. They enable custom comparison logic and are used by sorted() and comparison operators.

Q1324. [Ansible] How do you list all available modules with ansible-doc?

A: ansible-doc --list or ansible-doc -l. You can filter by collection: ansible-doc -l -t module community.general.

Q1325. [Python] What does functools.partialmethod do?

A: Like partial but for methods in a class. It creates a partial version of a method that can be used as a descriptor.

Q1326. [Linux] How does chmod symbolic notation work?

A: Format: [ugoa][+-=][rwxXsStT]. Examples: chmod u+x file adds execute for owner. chmod go-w file removes write for group and others. chmod a=r file sets read-only for all.

Q1327. [Python] What is os.walk() used for?

A: It generates (dirpath, dirnames, filenames) tuples for each directory in a tree, enabling recursive directory traversal.

Q1328. [Python] What is zipimport?

A: A built-in importer that allows importing Python modules directly from ZIP files. It is used by python -m zipapp and is how Ansible's Ansiballz module transfer works.

Q1329. [Linux] What does net.ipv4.ip_forward control?

A: Enables/disables IP packet forwarding between interfaces. Must be set to 1 for the system to act as a router, NAT gateway, or for container networking to work.

Q1330. [Linux] What is process substitution?

A: <(command) creates a temporary file descriptor containing the command's output. Useful for comparing outputs: diff <(sort file1) <(sort file2).


Batch 134

Q1331. [Linux] What is the difference between BRE, ERE, and PCRE?

A: BRE (Basic Regular Expressions): grep default, requires \ for (), {}, +, ?. ERE (Extended): grep -E/egrep, no backslash needed. PCRE (Perl-Compatible): grep -P, adds \d, \w, lookaround, non-greedy quantifiers.

Q1332. [Python] What happens if you create a defaultdict with no argument (i.e., defaultdict())?

A: Accessing a missing key raises a KeyError, just like a regular dict, because the default_factory is None.

Q1333. [Python] What is the Easter egg hidden in the source code of the this module?

A: The Zen text is stored as a ROT13-encoded string and decoded at import time. The module itself is a playful example of obfuscated code — contradicting the very principles it espouses.

Q1334. [Linux] What is the difference between iptables INPUT and FORWARD chains?

A: INPUT applies to packets destined for the local machine. FORWARD applies to packets being routed through the machine to another destination. A machine must have ip_forward=1 to process FORWARD rules.

Q1335. [Python] What does [1, 2, 3][::-1] return?

A: [3, 2, 1] — a reversed copy of the list. The [::-1] slice reverses any sequence.

Q1336. [Linux] What is /dev/urandom?

A: A pseudo-random number generator that never blocks. Uses the kernel's CSPRNG (cryptographically secure PRNG). Suitable for most purposes including cryptographic key generation on modern kernels.

Q1337. [Python] What is the GIL's full name?

A: Global Interpreter Lock.

Q1338. [Linux] What does Persistent=true do in a systemd timer?

A: If the timer was missed (machine was off), it triggers the service immediately at next boot. Similar to anacron behavior.

Q1339. [Ansible] Why was ansible-base renamed to ansible-core?

A: The name change from ansible-base to ansible-core (starting with version 2.11) was made to better reflect that this package is the core engine of the Ansible automation framework, not just a "base" layer.

Q1340. [Linux] What does uniq do?

A: Filters adjacent duplicate lines. Usually paired with sort first: sort file | uniq. -c counts occurrences, -d shows only duplicates, -u shows only unique lines.


Batch 135

Q1341. [Python] What is threading.Lock used for?

A: A primitive lock for mutual exclusion. Only one thread can hold the lock at a time. Use with lock: for safe acquisition and release.

Q1342. [Ansible] What year was Ansible first released?

A: 2012.

Q1343. [Python] What is collections.ChainMap used for?

A: It groups multiple dicts into a single mapping view. Lookups search the underlying maps in order. It is commonly used for managing nested scopes like configuration layers.

Q1344. [Python] What is itertools.pairwise() and when was it added?

A: Added in Python 3.10, it yields consecutive overlapping pairs from an iterable. pairwise('ABCD') yields ('A','B'), ('B','C'), ('C','D').

Q1345. [Linux] What is the purpose of /srv?

A: Data served by the system — e.g., web server files (/srv/www), FTP files (/srv/ftp). Less commonly used; many distros use /var/www instead.

Q1346. [Linux] What is the relationship between firewalld, iptables, and nftables?

A: firewalld is a frontend/management layer. On RHEL 7, it used iptables as backend. RHEL 8+ uses nftables as backend. Direct iptables/nftables rules and firewalld rules can coexist but may conflict.

Q1347. [Python] What is pytest.approx() used for?

A: Comparing floating-point numbers in assertions: assert 0.1 + 0.2 == pytest.approx(0.3). It handles floating-point imprecision.

Q1348. [Linux] What is the difference between SIGTERM and SIGKILL?

A: SIGTERM (15) is a polite request that the process can catch and handle for graceful shutdown. SIGKILL (9) forces immediate termination at the kernel level with no cleanup opportunity.

Q1349. [Linux] What does $@ contain?

A: All positional parameters. When double-quoted ("$@"), each parameter is a separate word, preserving whitespace within arguments.

Q1350. [Python] What is the GIL's impact on I/O-bound vs CPU-bound threading?

A: I/O-bound threading works well because the GIL is released during I/O operations (network, file). CPU-bound threading is ineffective because only one thread can execute Python bytecode at a time.


Batch 136

Q1351. [Ansible] Where does the name "Ansible" come from?

A: The name comes from science fiction -- specifically a faster-than-light communication device. The term was first coined by Ursula K. Le Guin in her 1966 novel "Rocannon's World" and later popularized by Orson Scott Card in "Ender's Game" (1985), where the ansible is used to command a fleet of distant ships instantaneously.

Q1352. [Python] What is sys.getrefcount(obj)?

A: Returns the reference count for an object. The count is always at least 1 higher than expected because the function argument itself creates a temporary reference.

Q1353. [Linux] What does "cat" stand for?

A: ConCATenate — originally designed to concatenate files, though commonly used to display single files.

Q1354. [Python] What does @functools.wraps(func) actually copy from func to the wrapper?

A: It copies __module__, __name__, __qualname__, __annotations__, __doc__, and updates __dict__. It also sets __wrapped__ to point to the original function. --- ## 5. OOP & Classes

Q1355. [Python] What module provides functions to maintain a list in sorted order without having to sort the list after each insertion?

A: The bisect module. It uses binary search via bisect.insort() and bisect.bisect() to efficiently insert into and search sorted lists.

Q1356. [Ansible] What is the fundamental difference between import_* and include_*?

A: import_* is static -- processed at playbook parse time. include_* is dynamic -- processed at runtime when the task is encountered. This affects tag inheritance, when evaluation, and loop behavior.

Q1357. [Python] What does str.casefold() do differently from str.lower()?

A: casefold() is more aggressive for case-insensitive comparisons. For example, the German 'SS'.casefold() gives 'ss', which correctly matches the lowercase form of 'ß'.

Q1358. [Ansible] What does the default filter do?

A: Provides a fallback value if the variable is undefined: {{ var | default('fallback_value') }}

Q1359. [Python] What does re.sub(pattern, repl, string) do?

A: It replaces all occurrences of the pattern in the string with repl. repl can be a string (with backreferences like \1) or a callable that receives the match object.

Q1360. [Ansible] What do async and poll do together in a task?

A: async sets the maximum runtime (seconds) for the task. poll sets how often (seconds) to check if the task is done. If poll: 0, the task fires and forgets -- Ansible moves on immediately without waiting.


Batch 137

Q1361. [Linux] What is udevadm monitor?

A: Watches udev events in real time — shows kernel uevents and udev rule processing. Useful for debugging device detection. --- ## 20. Logging

Q1362. [Python] What is inspect.signature() used for?

A: It returns a Signature object describing the parameters of a callable, including their names, default values, annotations, and kinds.

Q1363. [Ansible] How do you disable automatic fact gathering?

A: Set gather_facts: false at the play level.

Q1364. [Python] Who created Matplotlib and why?

A: John D. Hunter created it in 2003 to emulate MATLAB's plotting capabilities in Python, so he could do his epilepsy research without a MATLAB license.

Q1365. [Ansible] You deploy configuration but servers show inconsistent settings. How do you detect and fix it?

A: Use check_mode to detect changes, --diff to show differences, re-run playbooks to enforce idempotency, implement scheduled cron-based ansible-pull for continuous compliance.

Q1366. [Python] What does sys.platform return on Linux, macOS, and Windows?

A: 'linux', 'darwin', and 'win32' respectively. --- ## 12. Concurrency & Async

Q1367. [Ansible] How do you start a playbook at a specific task?

A: ansible-playbook playbook.yml --start-at-task "Install Nginx"

Q1368. [Linux] What is the difference between kmalloc and vmalloc?

A: kmalloc allocates physically contiguous memory from the slab allocator (fast, limited size). vmalloc allocates virtually contiguous but potentially physically non-contiguous memory (slower due to page table setup, can allocate larger regions).

Q1369. [Python] What is the @functools.lru_cache memory leak risk?

A: If the cached function receives large objects as arguments, those objects are kept alive by the cache even if no other references exist. Use maxsize to limit cache size.

Q1370. [Python] What does python -m venv myenv do?

A: Creates a virtual environment in the myenv directory with its own Python binary and isolated site-packages.


Batch 138

Q1371. [Linux] What are syslog priorities (severities)?

A: 0=emerg, 1=alert, 2=crit, 3=err, 4=warning, 5=notice, 6=info, 7=debug. In rsyslog rules, *.err matches all facilities at error level and above.

Q1372. [Linux] What does journalctl --disk-usage show?

A: The total disk space used by the journal. Control maximum size with SystemMaxUse= in /etc/systemd/journald.conf.

Q1373. [Python] What is operator.attrgetter() used for?

A: Similar to itemgetter but for attributes: attrgetter('name') is equivalent to lambda x: x.name. Supports dotted names for nested attributes.

Q1374. [Ansible] How do you implement canary deployments with Ansible?

A: Route traffic gradually to new version hosts, monitor health metrics, and roll back quickly if issues arise using serial: 1 and load balancer manipulation.

Q1375. [Linux] What are the 8 types of Linux namespaces?

A: Mount (mnt), UTS (hostname), IPC (inter-process communication), Network (net), PID, User (UID/GID mapping), Cgroup, and Time (clock offsets, added in kernel 5.6).

Q1376. [Linux] What does getconf _NPROCESSORS_ONLN return?

A: The number of online processors, similar to nproc. A POSIX-compliant way to query CPU count.

Q1377. [Python] What is __doc__?

A: The docstring attribute of a function, class, or module. It is set from the first string literal in the body.

Q1378. [Ansible] How do you generate a password hash suitable for /etc/shadow in Ansible?

A: Use the password_hash filter: {{ 'mypassword' | password_hash('sha512', 'mysalt') }}. Supported algorithms include sha256, sha512, and blowfish. --- --- ## 8. Conditionals, Loops & Flow Control

Q1379. [Ansible] What does the async keyword do?

A: Sets the maximum time (in seconds) an asynchronous task is allowed to run before Ansible terminates it.

Q1380. [Ansible] What does delegate_to do?

A: Runs a task on a different host than the current target, while still using the original host's variables and facts.


Batch 139

Q1381. [Ansible] What is the difference between ignore_errors: true and using a rescue block?

A: ignore_errors marks a failed task as "ok" and continues unconditionally. rescue provides structured error handling -- you can run specific recovery tasks, log failures, or take corrective action.

Q1382. [Linux] What is a bonding vs teaming?

A: Bonding (kernel module) and teaming (userspace, NetworkManager) both aggregate network interfaces for redundancy/performance. Teaming is the newer approach with better integration into NetworkManager and JSON-based configuration.

Q1383. [Linux] What does $0 contain?

A: The name of the script or shell. In an interactive shell, it's the shell name (e.g., -bash for login shell).

Q1384. [Linux] What was the Heartbleed vulnerability?

A: CVE-2014-0160 — a buffer over-read bug in OpenSSL's TLS heartbeat extension that allowed attackers to read up to 64KB of server memory per request, potentially exposing private keys, passwords, and session data.

Q1385. [Ansible] How do you check a playbook's syntax without running it?

A: ansible-playbook --syntax-check playbook.yml

Q1386. [Python] What does itertools.chain(*iterables) do?

A: It chains multiple iterables together into a single lazy iterator, yielding all elements from the first iterable, then the second, and so on.

Q1387. [Ansible] What is collections keyword in a playbook?

A: Specifies which collections to search for modules/plugins, eliminating the need for FQCNs in tasks.

Q1388. [Ansible] What does ANSIBLE_NOCOWS do?

A: Disables the cowsay output formatting that Ansible uses when cowsay is installed.

Q1389. [Ansible] What science fiction novel first coined the word "ansible," and who wrote it?

A: Ursula K. Le Guin coined the term in her 1966 novel Rocannon's World. It referred to a device enabling instantaneous faster-than-light communication.

Q1390. [Ansible] What is the ANSIBLE_STDOUT_CALLBACK environment variable?

A: Selects which stdout callback plugin to use (e.g., yaml, json, minimal, debug). Equivalent to stdout_callback in ansible.cfg.


Batch 140

Q1391. [Linux] What is the difference between cron and systemd timers?

A: Cron: simple syntax, single config file, minimal logging, no dependency awareness, per-user crontabs. Timers: full systemd integration, journal logging, dependencies, resource control, persistent timers, calendar and monotonic scheduling, can be monitored with systemctl.

Q1392. [Python] What does str.zfill(width) do?

A: It pads the string with leading zeros to the specified width. It handles a leading sign correctly: '-42'.zfill(5) gives '-0042'.

Q1393. [Linux] What is virtual memory?

A: An abstraction where each process sees a contiguous, private address space. The kernel and MMU translate virtual addresses to physical addresses via page tables, allowing memory isolation, overcommit, and swapping.

Q1394. [Ansible] What does meta: reset_connection do?

A: Forces Ansible to close and re-establish the connection to the current host. Useful after making changes that affect the connection (e.g., changing the SSH key or restarting sshd).

Q1395. [Python] What does reversed() require?

A: Either a sequence (with __len__ and __getitem__) or an object with a __reversed__ method. It returns a reverse iterator.

Q1396. [Ansible] How do you optimize Ansible performance for large inventories?

A: Increase forks, enable SSH pipelining, use fact caching, disable fact gathering when not needed, use async tasks for long operations, and use ControlPersist for SSH.

Q1397. [Ansible] What module manages cron jobs?

A: cron

Q1398. [Linux] Why is the ip command preferred over ifconfig?

A: ifconfig, route, netstat, and arp are from the deprecated net-tools package. The ip command (from iproute2) supports newer features like network namespaces, multiple routing tables, and policy routing.

Q1399. [Linux] What is the paste command?

A: Merges lines from multiple files side by side: paste file1 file2 outputs corresponding lines tab-separated. paste -s file joins all lines of a single file into one line.

Q1400. [Linux] What signal number is SIGINT?

A: 2. Sent when the user presses Ctrl-C. Default action is to terminate the process.


Batch 141

Q1401. [Python] What does list.extend() do vs list.append()?

A: append(x) adds x as a single element. extend(iterable) adds each element of the iterable individually. lst.append([1,2]) adds one list element; lst.extend([1,2]) adds two integer elements.

Q1402. [Python] What is a negative lookbehind?

A: (?<!...) asserts that what precedes does NOT match. For example, (?<!un)happy matches happy but not unhappy.

Q1403. [Python] What is the output of round(0.5) and round(1.5) in Python 3?

A: round(0.5) gives 0 and round(1.5) gives 2. Python 3 uses "banker's rounding" (round half to even).

Q1404. [Python] What is mypyc?

A: A compiler that uses mypy type annotations to compile Python modules to C extensions. It powers mypy's own speedup.

Q1405. [Linux] What is QEMU?

A: Quick EMUlator — a software-based machine emulator and virtualizer. When paired with KVM, it provides hardware-accelerated virtual machines. QEMU handles device emulation while KVM handles CPU virtualization.

Q1406. [Python] What is the experimental JIT compiler in Python 3.13?

A: A copy-and-patch JIT compiler that generates machine code for hot Python bytecode. It is an early-stage feature that lays groundwork for future performance improvements. --- ## 22. Quick-Fire Trivia & Rapid Recall

Q1407. [Linux] What is the numactl command?

A: Controls NUMA policy for processes. numactl --cpunodebind=0 --membind=0 command pins both CPU and memory to NUMA node 0. numactl --hardware shows NUMA topology.

Q1408. [Python] What is the exception hierarchy's root in Python?

A: BaseException. It has four direct subclasses: SystemExit, KeyboardInterrupt, GeneratorExit, and Exception. User code should generally catch/subclass Exception, not BaseException.

Q1409. [Ansible] What command lists all hosts in an inventory?

A: ansible-inventory --list

Q1410. [Ansible] What base class do lookup plugins inherit from?

A: LookupBase from ansible.plugins.lookup.


Batch 142

Q1411. [Linux] What kernel configuration file controls module parameters at load time?

A: /etc/modprobe.d/*.conf files contain options and aliases for kernel modules.

Q1412. [Ansible] What Ansible module is used to create scheduled tasks on Windows?

A: win_scheduled_task (now ansible.windows.win_scheduled_task).

Q1413. [Linux] What does 0 2 * * 1-5 mean in cron?

A: Run at 2:00 AM Monday through Friday.

Q1414. [Python] What is scipy.optimize.minimize()?

A: A function for finding the minimum of a scalar function, supporting multiple algorithms (Nelder-Mead, BFGS, L-BFGS-B, etc.).

Q1415. [Ansible] What configuration file does ansible-navigator use?

A: ansible-navigator.yml (or .ansible-navigator.yml), placed in the project directory or home directory. It can also read from ANSIBLE_NAVIGATOR_CONFIG environment variable.

Q1416. [Ansible] How does Ansible communicate with Linux hosts?

A: Via SSH (Secure Shell). It pushes modules to the managed node, executes them, and retrieves results as JSON.

Q1417. [Ansible] What is the difference between ansible-dev-tools and ansible-core?

A: ansible-core is the automation engine itself. ansible-dev-tools is a meta-package bundling development and testing tools: ansible-lint, molecule, ansible-navigator, ansible-builder, ansible-creator, and more.

Q1418. [Ansible] What is a Workflow Job Template?

A: A template that chains multiple job templates together with conditional logic (on success, on failure, always), enabling complex multi-step automation pipelines.

Q1419. [Ansible] Which tools are push-based vs. pull-based by default?

A: Ansible: push-based (pull available via ansible-pull). Salt: push-based (pull available). Puppet: pull-based (push via bolt). Chef: pull-based (push via knife/chef-push-jobs).

Q1420. [Python] What is the platform module?

A: It provides portable access to platform-identifying data: platform.system() returns 'Linux', 'Darwin', or 'Windows'. Also platform.python_version(), platform.machine(), etc.


Batch 143

Q1421. [Linux] What is the difference between a process and a thread in terms of memory?

A: Processes have separate virtual address spaces (isolated memory). Threads within the same process share the same address space, heap, and global variables, but each has its own stack.

Q1422. [Ansible] How do you run a playbook in verbose mode?

A: Add -v (basic), -vv (more detail), -vvv (connection debugging), or -vvvv (maximum verbosity).

Q1423. [Ansible] What is Ansible Automation Hub, and how does it differ from Ansible Galaxy?

A: Automation Hub is Red Hat's curated repository of certified and validated Ansible collections for AAP subscribers. Galaxy is the free community repository. Hub content is tested, supported, and signed by Red Hat; Galaxy content is community-maintained with no support guarantees.

Q1424. [Python] What is the significance of antigravity in Python?

A: import antigravity opens the classic XKCD comic #353 about Python in a web browser.

Q1425. [Linux] What is iftop?

A: Displays real-time bandwidth usage per connection on a network interface. Shows source, destination, and transfer rates. Requires root/capabilities.

Q1426. [Linux] How do you list active systemd timers?

A: systemctl list-timers --all shows all timers, their next/last trigger times, and associated units. --- ## 16. /proc and /sys Filesystems

Q1427. [Python] What did Python 2.2 introduce?

A: New-style classes (unifying types and classes), iterators, generators (PEP 255), and the __future__ mechanism. It was one of the most significant Python 2.x releases.

Q1428. [Ansible] What is a collection namespace?

A: A unique name prefix that organizes collections and prevents naming conflicts between different authors. ---

Q1429. [Python] What is the lru_cache maximum size by default?

A: 128 entries.

Q1430. [Python] What is the nonlocal keyword used for?

A: It declares that a variable in an inner function refers to a variable in the enclosing (non-global) scope, allowing it to be modified. Without nonlocal, the inner function would create a new local variable.


Batch 144

Q1431. [Linux] What is inode exhaustion?

A: Running out of inodes before running out of disk space, preventing creation of new files. Common with filesystems storing millions of tiny files. Check with df -i.

Q1432. [Linux] What is oom_score_adj?

A: A per-process tunable (-1000 to 1000) in /proc/PID/oom_score_adj that biases the OOM killer. -1000 disables OOM killing for that process; 1000 makes it the first victim.

Q1433. [Python] What does __all__ in __init__.py control?

A: What is exported when from package import * is used. It also serves as documentation of the package's public API.

Q1434. [Ansible] Is Ansible open-source?

A: Yes, Ansible Core is open-source (GPL v3). Red Hat Ansible Automation Platform is the commercial enterprise product.

Q1435. [Ansible] What is the ansible_become_exe variable?

A: Specifies the path to the privilege escalation binary. Default: /usr/bin/sudo. Useful when sudo is installed in a non-standard location.

Q1436. [Python] What is asyncio.Semaphore used for?

A: Limiting the number of concurrent coroutines accessing a shared resource — for example, limiting concurrent HTTP connections to avoid overwhelming a server. --- ## 13. Type System & Type Hints

Q1437. [Python] What does contextlib.redirect_stdout() do?

A: It temporarily redirects sys.stdout to another file-like object within a with block. There is also redirect_stderr() for standard error.

Q1438. [Linux] When was Rust support officially added to the Linux kernel?

A: Linux 6.1 (December 2022) was the first release with initial Rust infrastructure merged into the mainline kernel.

Q1439. [Python] What happens if you type from __future__ import braces in Python?

A: You get SyntaxError: not a chance — a humorous rejection of curly-brace syntax.

Q1440. [Python] What is the NotImplemented singleton used for?

A: Rich comparison methods return NotImplemented to indicate they don't support comparison with the given type, allowing Python to try the reflected operation on the other operand. It is NOT the same as NotImplementedError.


Batch 145

Q1441. [Linux] What does /proc/meminfo contain?

A: Detailed memory statistics: MemTotal, MemFree, MemAvailable, Buffers, Cached, SwapTotal, SwapFree, Active, Inactive, Dirty, Slab, PageTables, HugePages_*, and more.

Q1442. [Python] What does OrderedDict.move_to_end(key, last=True) do?

A: It moves an existing key to either end of the ordered dict. With last=True (default) it moves to the right end; with last=False to the beginning.

Q1443. [Ansible] What are the available gather_subset categories?

A: all, min (always gathered), network, hardware, virtual, ohai, facter, env (environment variables), and several more depending on the platform.

Q1444. [Ansible] What is ignore_errors?

A: Setting ignore_errors: yes allows a playbook to continue execution even if the task fails.

Q1445. [Linux] What is the difference between ip addr and ip link?

A: ip addr shows/manages IP addresses on interfaces. ip link shows/manages link-layer properties (up/down state, MTU, MAC address). Use ip link set eth0 up to bring an interface up.

Q1446. [Ansible] What special group exists in every Ansible inventory?

A: The all group, which contains every host. Also, ungrouped contains hosts not assigned to any other group.

Q1447. [Python] What is the dis module?

A: The disassembler module that converts Python bytecode into human-readable form. Useful for understanding CPython internals.

Q1448. [Python] What is the weakref module used for?

A: It creates weak references to objects that don't prevent garbage collection. Useful for caches and observer patterns where you don't want to keep objects alive.

Q1449. [Linux] What is NFS?

A: Network File System — a distributed filesystem protocol allowing clients to access files over a network as if they were local. NFSv4 uses TCP port 2049 and supports Kerberos authentication.

Q1450. [Ansible] What does no_log: true do?

A: Suppresses task input/output from being logged, preventing sensitive data from appearing in logs.


Batch 146

Q1451. [Python] Is there a limit to integer size in Python 3?

A: No. Python 3 integers have arbitrary precision — they can be as large as your memory allows. There is no overflow.

Q1452. [Python] What is the wheel filename convention?

A: {name}-{version}(-{build})?-{python}-{abi}-{platform}.whl. For example: numpy-1.24.0-cp311-cp311-manylinux_2_17_x86_64.whl.

Q1453. [Python] What does python -m json.tool do?

A: It reads JSON from stdin and pretty-prints it. Useful as a command-line JSON formatter.

Q1454. [Ansible] What module checks the status of a previously fired async task?

A: async_status, using the jid (job ID) from the registered result of the original task.

Q1455. [Ansible] What is the Ansible control node?

A: The machine where Ansible is installed and from which playbooks and commands are executed. It must run Linux or macOS (not Windows natively).

Q1456. [Python] What is the calendar module?

A: It provides calendar-related functions: printing calendars, determining leap years, and iterating over months and weeks.

Q1457. [Ansible] What is the become_method setting and what values does it support?

A: Controls how Ansible escalates privileges. Values: sudo (default), su, pbrun, pfexec, doas, dzdo, ksu, runas (Windows), machinectl, enable (network devices).

Q1458. [Ansible] What does the command module do?

A: Executes commands directly without shell processing. Safer than shell but doesn't support pipes or redirects.

Q1459. [Ansible] What does state: latest mean in package modules?

A: Ensures the package is installed AND updated to the latest available version. ---

Q1460. [Ansible] What is the uri module?

A: Makes HTTP/HTTPS requests from the control node (or remote host if delegated). Used for API calls, health checks, and webhook triggers.


Batch 147

Q1461. [Python] When was Python 0.9.0 first released publicly?

A: February 20, 1991, posted to the alt.sources Usenet newsgroup.

Q1462. [Ansible] What is run_once?

A: Ensures a task executes only once across all hosts, even in a multi-host play. Often combined with delegate_to.

Q1463. [Linux] What command shows the routing table?

A: ip route show (or ip r). The route -n command is deprecated but still commonly used.

Q1464. [Python] What are pytest marks?

A: Decorators that categorize tests: @pytest.mark.slow, @pytest.mark.skip, @pytest.mark.xfail. Custom marks allow running subsets of tests with -m.

Q1465. [Linux] What does grep -i do?

A: Case-insensitive matching.

Q1466. [Ansible] How do you use a script to provide vault passwords?

A: Pass an executable script as the password source: --vault-id label@/path/to/script.py. The script must output the password to stdout. ---

Q1467. [Ansible] What is gather_subset?

A: Controls which subset of facts to gather (e.g., network, hardware, virtual, min). Reduces fact-gathering time.

Q1468. [Python] Which Zen aphorism is the "Dutch" one a reference to?

A: "Although that way may not be obvious at first unless you're Dutch" — a reference to Guido van Rossum being Dutch.

Q1469. [Ansible] What is the difference between dot notation and array notation for variables?

A: Dot notation ({{ user.name }}) is for simple, readable access. Array notation ({{ user['first name'] }}) is required for keys with special characters, spaces, or dynamic variable names. ---

Q1470. [Linux] What are well-known ports 110, 143, 993, and 995?

A: 110 = POP3 (email retrieval), 143 = IMAP (email access), 993 = IMAPS (IMAP over TLS), 995 = POP3S (POP3 over TLS).


Batch 148

Q1471. [Python] What is typing.cast() used for?

A: Telling the type checker to treat a value as a specific type without any runtime effect: cast(int, some_value). It is purely a hint for static analysis.

Q1472. [Linux] What is LVM thin provisioning?

A: A feature allowing LVs to be larger than the actual available storage, with physical space allocated only when data is written. Enables overcommitment and more flexible storage management.

Q1473. [Linux] What does systemctl list-units --type=service --state=failed show?

A: All service units currently in a failed state. Useful for troubleshooting boot or runtime failures.

Q1474. [Ansible] What module creates directories?

A: file (with state: directory)

Q1475. [Ansible] What is the "cow" in Ansible output?

A: Ansible can display output using cowsay (ASCII art cow). If cowsay is installed, Ansible uses it by default for playbook output. It can be disabled with ANSIBLE_NOCOWS=1 or nocows = 1 in ansible.cfg.

Q1476. [Python] What is __slots__ inheritance behavior?

A: __slots__ in a subclass only adds the slots defined in that class — it does not replace parent slots. If any class in the hierarchy lacks __slots__, instances will still have __dict__.

Q1477. [Ansible] Who is Jeff Geerling and why is he significant to the Ansible community?

A: Jeff Geerling is one of the most prolific Ansible community contributors, author of "Ansible for DevOps" (the most popular Ansible book), maintainer of dozens of the most-downloaded Galaxy roles (geerlingguy.docker, geerlingguy.mysql, geerlingguy.java, etc.), and a frequent speaker at AnsibleFest.

Q1478. [Python] What were the main breaking changes in Python 3.0?

A: print became a function, / does true division by default, all strings are Unicode, range() returns an iterator, dict.keys()/values()/items() return views, and many functions return iterators instead of lists.

Q1479. [Python] What does python -m calendar do?

A: It prints a calendar for the current year (or a specified year/month) to the terminal.

Q1480. [Linux] What does sysctl net.core.rmem_max control?

A: Maximum receive socket buffer size in bytes. Increase for high-throughput applications. Often tuned alongside net.core.wmem_max (send buffer) and the TCP-specific net.ipv4.tcp_rmem/net.ipv4.tcp_wmem.


Batch 149

Q1481. [Linux] What is slabtop?

A: Displays kernel slab allocator statistics in real-time — showing object caches, their sizes, and utilization. Useful for diagnosing kernel memory issues and identifying which subsystems consume the most kernel memory.

Q1482. [Ansible] What command runs a rulebook?

A: ansible-rulebook --inventory inventory.yml --rulebook rulebook.yml

Q1483. [Ansible] What is the difference between inventory_hostname and ansible_hostname?

A: inventory_hostname is the name of the host as defined in the inventory file (set before any connection to the host). ansible_hostname is the actual hostname discovered from the remote machine via fact gathering (it comes from the OS).

Q1484. [Python] What does PyPI stand for?

A: Python Package Index — the official repository for third-party Python packages, hosted at pypi.org.

Q1485. [Linux] What is the format of /etc/group?

A: group_name:password:GID:member_list. The member_list is a comma-separated list of usernames who are supplementary members of the group.

Q1486. [Ansible] What is the ansible.cfg [inventory] section's enable_plugins setting?

A: Controls which inventory plugins are loaded. By default, only host_list, script, auto, yaml, ini, and toml are enabled. Cloud inventory plugins (aws_ec2, gcp_compute) must be explicitly enabled.

Q1487. [Ansible] What is order in a play?

A: Controls the order in which hosts are processed: inventory (default), reverse_inventory, sorted, reverse_sorted, shuffle.

Q1488. [Python] What is the default value returned by a defaultdict(list) for a missing key?

A: An empty list []. The argument to defaultdict is a factory function called with no arguments to produce default values.

Q1489. [Python] What does the re.VERBOSE (or re.X) flag do?

A: It allows you to write multi-line regexes with comments and whitespace for readability. Unescaped whitespace and # comments are ignored in the pattern.

Q1490. [Ansible] What was the original company name behind Ansible before it became "Ansible, Inc."?

A: AnsibleWorks, Inc., founded in 2013 by Michael DeHaan, Timothy Gerla, and Said Ziouani.


Batch 150

Q1491. [Python] What is typing.get_type_hints() used for?

A: It resolves string annotations to actual types, handling forward references and from __future__ import annotations. More reliable than accessing __annotations__ directly.

Q1492. [Python] What is os.environ?

A: A mapping object representing the environment variables. Changes to it affect the current process and any child processes.

Q1493. [Python] What are the standard logging levels in Python, from lowest to highest?

A: DEBUG (10), INFO (20), WARNING (30), ERROR (40), CRITICAL (50). The default level is WARNING.

Q1494. [Python] What is Django's migration system?

A: An automated system that tracks database schema changes. makemigrations detects model changes and creates migration files. migrate applies them to the database.

Q1495. [Linux] What is BIOS?

A: Basic Input/Output System — legacy firmware stored in ROM that initializes hardware and loads the first 512-byte sector (MBR) from the boot device. Limited to 16-bit real mode, 1MB address space, and MBR partition tables (max 2TB disks).

Q1496. [Linux] How do you delete lines with sed?

A: sed '/pattern/d' file deletes lines matching the pattern. sed '5d' file deletes line 5. sed '3,7d' file deletes lines 3-7.

Q1497. [Ansible] What are variables in Ansible?

A: Named values that store data for use in playbooks, templates, and tasks. They make automation flexible and dynamic.

Q1498. [Ansible] What is an Ansible Collection?

A: A distribution format that packages roles, modules, plugins, playbooks, and documentation together. More comprehensive than individual roles.

Q1499. [Linux] How does Debian name its releases?

A: Debian releases are named after characters from the Pixar movie Toy Story. Examples: Buzz, Rex, Woody, Sarge, Etch, Lenny, Squeeze, Wheezy, Jessie, Stretch, Buster, Bullseye, Bookworm, Trixie. The unstable branch is always called "Sid" (the destructive kid).

Q1500. [Python] What is math.inf vs sys.float_info.max?

A: math.inf is positive infinity (a special IEEE 754 value). sys.float_info.max is the largest finite representable float (approximately 1.8e+308).


Batch 151

Q1501. [Linux] What is systemd?

A: The default init system and service manager on most modern Linux distributions. Created by Lennart Poettering and Kay Sievers. It manages services, logging, device events, mount points, timers, and more.

Q1502. [Ansible] What does the always tag do?

A: Tasks tagged with always run no matter what tags are specified with --tags, UNLESS you explicitly skip them with --skip-tags always.

Q1503. [Python] What does any([]) return?

A: False. any of an empty iterable is False. all([]) returns True (vacuous truth).

Q1504. [Ansible] Can a handler notify another handler?

A: Yes, since Ansible 2.2. Handlers can chain notifications to other handlers, creating cascading restart sequences.

Q1505. [Ansible] What Python versions does Ansible 2.9 support on the control node?

A: Python 2.7 or Python 3.5+.

Q1506. [Ansible] What connection plugin is used for network devices?

A: network_cli for CLI-based devices, netconf for NETCONF-enabled devices, httpapi for API-based devices.

Q1507. [Python] What is "EAFP" in Python?

A: "Easier to Ask Forgiveness than Permission" — a coding style that tries an operation and handles exceptions rather than checking preconditions. Contrasted with "LBYL" (Look Before You Leap).

Q1508. [Ansible] What happens if a task exceeds its async timeout?

A: The process on the remote node is terminated.

Q1509. [Python] What is io.StringIO used for?

A: An in-memory text stream that behaves like a file object. Useful for testing or capturing output: buf = StringIO(); print('hello', file=buf); buf.getvalue().

Q1510. [Ansible] What is the difference between free and host_pinned?

A: free allows Ansible to interleave tasks across hosts (start task 3 on host A while host B is on task 1). host_pinned runs all tasks for a single host consecutively without interruption before moving to another host.


Batch 152

Q1511. [Linux] How do you view only error-level journal entries?

A: journalctl -p err or journalctl -p 3. Use -p 0..3 to show emerg through err.

Q1512. [Linux] What are ports 2049 and 111 used for?

A: 2049 = NFS (Network File System). 111 = rpcbind/portmapper (maps RPC services to ports, used by NFSv3). NFSv4 only needs port 2049.

Q1513. [Linux] What is the difference between less and more?

A: more can only scroll forward; less can scroll both forward and backward, search, and supports many navigation commands. "Less is more" — less is the superior pager.

Q1514. [Ansible] What Python packages are required on the control node for WinRM?

A: pywinrm (for the winrm connection plugin) or pypsrp (for the psrp connection plugin).

Q1515. [Ansible] When would you use the free strategy?

A: When hosts are independent and don't need to synchronize between tasks. Each host runs through the playbook as fast as it can without waiting for others. Useful when tasks on different hosts have varying execution times.

Q1516. [Linux] What is dmidecode?

A: Dumps BIOS/UEFI DMI (SMBIOS) table data: hardware model, serial number, BIOS version, RAM slots, CPU sockets. Requires root: dmidecode -t memory shows memory modules.

Q1517. [Ansible] What does the production lint profile add on top of shared?

A: Rules for inclusion in Ansible Automation Platform as validated or certified content, including fqcn (require fully qualified collection names) and sanity.

Q1518. [Linux] What is the purpose of the /etc/hosts file?

A: Static hostname-to-IP mapping that is consulted before DNS (by default). Format: IP_address hostname [aliases]. Commonly used for local overrides and development.

Q1519. [Linux] What are the three timestamps on a Linux file?

A: atime (last access), mtime (last content modification), ctime (last metadata change — permissions, ownership, link count). Some filesystems also support btime/crtime (birth/creation time).

Q1520. [Ansible] What is a Decision Environment?

A: A containerized runtime that runs EDA rulebook logic, handling event listening and filtering before passing decisions to Execution Environments.


Batch 153

Q1521. [Linux] When would you choose ext4?

A: For general-purpose use, boot partitions, and environments requiring maximum stability and tooling maturity. Best choice when you need online shrinking capability.

Q1522. [Ansible] What is inventory_hostname?

A: The name of the current host as defined in the inventory file.

Q1523. [Python] What is the zoneinfo module?

A: Added in Python 3.9, it provides IANA timezone support: ZoneInfo('America/New_York'). It replaced the need for the third-party pytz library.

Q1524. [Linux] What is a systemd timer?

A: A replacement for cron jobs. Timer units (.timer) activate associated service units on a schedule. Support calendar events (OnCalendar=), monotonic timers (OnBootSec=, OnUnitActiveSec=), and persistent timers that catch up on missed runs.

Q1525. [Ansible] How do you specify a custom inventory file?

A: Use the -i flag: ansible-playbook -i /path/to/inventory playbook.yml

Q1526. [Python] What is Rich?

A: A Python library for rich text and formatting in the terminal. It provides syntax highlighting, tables, progress bars, tracebacks, markdown rendering, and more.

Q1527. [Python] What does python -m py_compile script.py do?

A: It compiles a Python source file to bytecode (.pyc), useful for syntax checking without executing the code.

Q1528. [Python] What is the difference between *args and **kwargs?

A: *args collects extra positional arguments into a tuple. **kwargs collects extra keyword arguments into a dictionary. Together they allow functions to accept any combination of arguments.

Q1529. [Linux] What is PAM?

A: Pluggable Authentication Modules — a framework that separates authentication logic from applications. Configuration files in /etc/pam.d/ define stacks of modules (auth, account, password, session) for each service.

Q1530. [Python] What language was Python's direct predecessor at CWI Amsterdam?

A: ABC — Guido worked on the ABC language at CWI and Python was partly inspired by it, borrowing ideas like indentation-based syntax, high-level data types, and interactive use.


Batch 154

Q1531. [Linux] What is localectl?

A: Manages system locale and keyboard layout on systemd systems. localectl set-locale LANG=en_US.UTF-8. localectl set-keymap us.

Q1532. [Python] What was Python 1.5 notable for?

A: Released in 1998, it was the version that really established Python's popularity and was the standard for many years. It introduced the re module replacing the older regex module.

Q1533. [Ansible] What does the shell module do?

A: Executes commands through the shell (/bin/sh), supporting pipes, redirects, and environment variable expansion.

Q1534. [Ansible] What environment variable disables Ansible's cowsay output?

A: ANSIBLE_NOCOWS=1

Q1535. [Ansible] What is the naming convention for Ansible environment variable overrides?

A: The pattern is ANSIBLE_ + the uppercase setting name. For settings in specific sections, the section name is included. For example, ssh_args in [ssh_connection] becomes ANSIBLE_SSH_ARGS.

Q1536. [Ansible] What is cli_command vs platform-specific modules (e.g., ios_command)?

A: cli_command is a generic module that works across any network_cli-connected device. Platform-specific modules (ios_command, nxos_command) add platform awareness, resource modules (declarative state management), and better idempotency.

Q1537. [Python] Where was PyCon US first held?

A: Washington, D.C. in 2003.

Q1538. [Python] What is the time complexity of Python's dict lookup?

A: Average O(1), worst case O(n) due to hash collisions. Python uses open addressing with random probing for collision resolution.

Q1539. [Linux] What is the TCP TIME_WAIT state?

A: After sending the final ACK in connection teardown, the initiating side enters TIME_WAIT for 2×MSL (typically 60 seconds). This ensures late duplicate packets are handled and the remote end can retransmit its FIN if the ACK was lost.

Q1540. [Python] What is Litestar (formerly Starlite)?

A: A high-performance ASGI framework with an emphasis on being opinionated, having built-in dependency injection, and supporting multiple serialization libraries beyond Pydantic.


Batch 155

Q1541. [Python] What is typing.TypedDict used for?

A: Defining the expected structure of a dictionary with specific keys and their types: class Movie(TypedDict): title: str; year: int. Added in Python 3.8.

Q1542. [Linux] What is Linus's Law?

A: "Given enough eyeballs, all bugs are shallow" — coined by Eric Raymond in "The Cathedral and the Bazaar," attributed to Linus. It means with many code reviewers, bugs are found quickly.

Q1543. [Linux] What does &> do?

A: Bash shorthand for redirecting both stdout and stderr to a file: command &> file is equivalent to command > file 2>&1.

Q1544. [Python] How do you check for None in Python?

A: Always use is None or is not None, never == None. The is operator checks identity, which is correct since None is a singleton. --- ## 3. Data Structures

Q1545. [Ansible] What is the timeout connection parameter?

A: Sets the SSH connection timeout in seconds. Configurable per host or globally.

Q1546. [Ansible] What does the uri module do?

A: Makes HTTP/HTTPS requests -- useful for interacting with REST APIs.

Q1547. [Linux] What is the difference between a login shell and a non-login shell?

A: A login shell is started for user authentication (SSH, console login, su -). A non-login shell is started otherwise (opening a terminal emulator, running bash). They source different startup files.

Q1548. [Linux] What embedded operating system is used in most consumer routers and is based on Linux?

A: OpenWrt (formerly also DD-WRT) is the most popular Linux-based router firmware.

Q1549. [Python] What design pattern does Django follow?

A: Model-Template-View (MTV), which is Django's variation of MVC. Models define data, Templates handle presentation, and Views contain business logic.

Q1550. [Ansible] What are the two types of inventory?

A: Static inventory (manually defined in INI or YAML files) and dynamic inventory (generated at runtime using scripts or plugins from external sources like cloud providers).


Batch 156

Q1551. [Ansible] What is the listen directive on handlers?

A: Allows a handler to respond to a generic notification topic rather than being called by exact name. Multiple handlers can listen to the same topic. Example: all handlers with listen: "restart web stack" run when any task notifies "restart web stack".

Q1552. [Python] What is pdb and how do you invoke it?

A: The Python debugger. Invoke it with python -m pdb script.py, or insert breakpoint() (Python 3.7+) or import pdb; pdb.set_trace() in code.

Q1553. [Ansible] What key inventory object methods are used in plugin development?

A: self.inventory.add_group(), self.inventory.add_host(), self.inventory.add_child(), self.inventory.set_variable().

Q1554. [Python] What does itertools.compress(data, selectors) do?

A: It filters data by returning only the elements where the corresponding selector is truthy. For example, compress('ABCDEF', [1,0,1,0,1,1]) yields A, C, E, F.

Q1555. [Ansible] What happens after a rulebook condition matches an event?

A: The specified action executes -- typically run_playbook, which launches an Ansible playbook with the event data available as extra variables.

Q1556. [Python] Can you use built-in types as generics since Python 3.9?

A: Yes. PEP 585 (Python 3.9) allows list[int], dict[str, int], tuple[int, ...] directly, making typing.List, typing.Dict, etc. redundant.

Q1557. [Ansible] What are the two categories of Ansible modules?

A: Core modules (maintained by the Ansible team) and community/extras modules (maintained by the community). Both are fully usable.

Q1558. [Python] What is doctest?

A: A module that tests code examples embedded in docstrings by running them and comparing output. It serves double duty as documentation and tests.

Q1559. [Linux] What is a loopback device?

A: A pseudo-device (/dev/loopN) that makes a regular file accessible as a block device. Used to mount disk images (ISOs, filesystem images): mount -o loop image.iso /mnt.

Q1560. [Linux] What does getent do?

A: Queries Name Service Switch databases: getent passwd username looks up a user (local or LDAP/NIS), getent hosts hostname resolves a hostname, getent group groupname queries groups. Works with any NSS source.


Batch 157

Q1561. [Ansible] How would you design a reusable playbook for multiple environments?

A: Use separate inventory files per environment, environment-specific group_vars, roles for modularity, parameterized configurations, and conditional logic based on environment variables.

Q1562. [Linux] What is the VFS (Virtual Filesystem Switch)?

A: An abstraction layer that provides a uniform interface for all filesystems. It defines common objects (superblock, inode, dentry, file) so that open(), read(), write() work identically regardless of the underlying filesystem.

Q1563. [Linux] What is a loadable kernel module (LKM)?

A: Code that can be loaded into a running kernel to extend functionality (e.g., device drivers, filesystems) without rebooting. Managed with insmod, rmmod, modprobe, and lsmod.

Q1564. [Linux] What is a link-local address in IPv6?

A: An auto-configured address in the fe80::/10 range, used for communication on the local network segment. Every IPv6-enabled interface has one. Not routable beyond the local link.

Q1565. [Python] What is a bytearray and how does it differ from bytes?

A: bytearray is a mutable sequence of bytes, while bytes is immutable. bytearray supports in-place modification.

Q1566. [Ansible] How are module arguments passed to the remote module under Ansiballz?

A: The JSON arguments are included in the wrapper script. Before importing the module, the wrapper monkey-patches _ANSIBLE_ARGS in basic.py, which the module reads during initialization.

Q1567. [Python] What is collections.UserDict for?

A: It is a wrapper around a regular dict (stored as .data) designed to be subclassed. It is easier to subclass than dict because you only need to override the methods you want without worrying about internal C optimizations.

Q1568. [Python] What is sys.setprofile() used for?

A: It registers a profiling function called on function calls and returns. Less granular than settrace() but lower overhead.

Q1569. [Linux] How does GPG key verification work for packages?

A: Repositories sign packages with GPG keys. The package manager verifies signatures against trusted keys. On RHEL: rpm --import <key-url>. On Debian: apt-key add <key> (deprecated) or keys in /etc/apt/trusted.gpg.d/.

Q1570. [Linux] What is the USER variable?

A: The current user's login name. Set by the login process.


Batch 158

Q1571. [Linux] Where does the name "sed" come from?

A: "Stream EDitor."

Q1572. [Ansible] What is the omit variable in Ansible?

A: A special variable used to conditionally exclude a module parameter entirely. Example: mode: "{{ file_mode | default(omit) }}" -- if file_mode is undefined, the mode parameter is not passed to the module at all (as if it wasn't written).

Q1573. [Linux] What does xargs do?

A: Builds and executes commands from stdin. find . -name "*.log" | xargs rm. Use -0 with find -print0 for filenames with spaces. -I {} sets a placeholder: echo file | xargs -I {} cp {} backup/.

Q1574. [Python] What is the LBYL coding style?

A: "Look Before You Leap" — checking preconditions before an operation (e.g., if key in dict: dict[key]). Python generally prefers EAFP, but LBYL is sometimes clearer for non-exceptional conditions.

Q1575. [Linux] What is AppArmor?

A: A Linux security module (alternative to SELinux) using path-based Mandatory Access Control. Used by Ubuntu, Debian, and SUSE. Profiles restrict what files, capabilities, and network access an application can use.

Q1576. [Python] What is the difference between concurrency and parallelism in Python?

A: Concurrency (doing multiple things by switching between them) is achieved with asyncio or threading. Parallelism (doing multiple things simultaneously) requires multiprocessing due to the GIL.

Q1577. [Python] What is a non-capturing group in regex?

A: (?:...) groups the pattern for alternation or quantification but does not capture the matched text. It is more efficient when you don't need the captured group.

Q1578. [Python] What is string interning?

A: A technique where identical strings share the same object in memory. CPython automatically interns strings that look like identifiers. You can manually intern with sys.intern().

Q1579. [Ansible] What is Molecule?

A: A testing framework for Ansible roles that tests in isolated environments (Docker, Vagrant, etc.). It handles creation, convergence, idempotence, verification, and destruction.

Q1580. [Linux] Where are yum/dnf repository definitions stored?

A: /etc/yum.repos.d/*.repo files.


Batch 159

Q1581. [Python] How does someone become a Python core developer?

A: By sustained contributions to CPython, typically over months or years. An existing core developer nominates them, and the Steering Council votes. Core developers get commit access to the CPython repository.

Q1582. [Ansible] What does the wait_for module do?

A: Waits for a specific condition (port open, file exists, string in file) before continuing. Supports customizable timeouts.

Q1583. [Ansible] If you set a fact with set_fact and also define the same variable as a role parameter, which wins?

A: Role parameters (level 20) win over set_facts (level 19).

Q1584. [Linux] What is the purpose of the /boot partition?

A: Stores the kernel (vmlinuz), initramfs, and GRUB files. Often a separate partition to ensure the bootloader can access it regardless of the root filesystem type or encryption. Typically 500MB-1GB, formatted as ext4 or xfs.

Q1585. [Ansible] What is the default become method?

A: sudo

Q1586. [Ansible] What callback plugin would you use to profile task execution times?

A: profile_tasks -- shows execution time for each task. Also profile_roles for per-role timing and timer for total playbook time.

Q1587. [Linux] What is a system call (syscall)?

A: The programmatic interface by which user-space processes request services from the kernel (e.g., file I/O, process creation, networking). On x86-64, the syscall instruction transfers control to the kernel. There are roughly 450+ syscalls.

Q1588. [Linux] What is RAID 5?

A: Distributed parity — data and parity are striped across 3+ disks. Survives one disk failure. Usable capacity = (N-1) disks. Write penalty due to parity calculation.

Q1589. [Linux] What is UEFI?

A: Unified Extensible Firmware Interface — the modern replacement for BIOS. It supports GPT partitions, 64-bit mode, Secure Boot, network booting, and a shell environment. Boot loaders are stored as EFI executables on the ESP (EFI System Partition).

Q1590. [Ansible] What is Infrastructure as Code (IaC) and how does Ansible align with it?

A: IaC manages infrastructure through version-controlled code rather than manual processes. Ansible aligns by using YAML playbooks to define infrastructure tasks in a readable, code-like format, ensuring repeatability and idempotency. ---


Batch 160

Q1591. [Ansible] What is the auto interpreter discovery in Ansible?

A: Starting in Ansible 2.8, when ansible_python_interpreter is not set, Ansible uses a platform-specific discovery table to find the correct Python interpreter, preferring /usr/bin/python3.

Q1592. [Python] What is selectors module?

A: A higher-level I/O multiplexing library (Python 3.4+) that wraps select, providing a simpler API and automatically choosing the best available implementation.

Q1593. [Linux] What is the difference between HTTP/1.1, HTTP/2, and HTTP/3?

A: HTTP/1.1: text-based, one request per connection (or pipelining). HTTP/2: binary framing, multiplexing multiple streams over one TCP connection, header compression. HTTP/3: uses QUIC (UDP-based) instead of TCP, reducing connection setup latency.

Q1594. [Ansible] How do you run ansible-navigator without an Execution Environment (in local mode)?

A: Set execution-environment.enabled: false in ansible-navigator.yml or pass --execution-environment false on the command line.

Q1595. [Python] What does itertools.count(start=0, step=1) do?

A: It creates an infinite iterator that yields evenly spaced values starting from start. For example, count(10, 2) yields 10, 12, 14, 16, ....

Q1596. [Linux] What is the difference between Docker and Podman?

A: Docker uses a client-server architecture with a root daemon (dockerd). Podman is daemonless, runs rootless by default, is OCI-compliant, and generates systemd unit files. Podman is CLI-compatible with Docker.

Q1597. [Python] What is collections.abc.Hashable?

A: An abstract base class for objects that support hash(). You can check isinstance(obj, Hashable) to test if an object is hashable.

Q1598. [Ansible] What does ansible_search_path contain?

A: The current search path for file lookups, templates, and other file-based operations. It includes the playbook directory, role directories, and any paths added via the roles_path configuration.

Q1599. [Linux] What is the difference between ss and netstat?

A: ss (socket statistics) is faster, uses kernel netlink sockets directly, and is the modern replacement for netstat (deprecated, from net-tools). Common usage: ss -tlnp shows listening TCP sockets with process info.

Q1600. [Ansible] What does meta: flush_handlers do?

A: Forces all pending handlers to execute at that point in the play, instead of waiting until the end of the play. Useful when subsequent tasks depend on services being restarted.


Batch 161

Q1601. [Ansible] When is ansible-pull preferred over the normal push model?

A: Auto-scaling environments (new instances configure themselves), edge deployments, large fleets where a central control node would be a bottleneck, and environments where nodes can't be reached from a central point (firewalled, NAT'd).

Q1602. [Python] What is the except* syntax?

A: Introduced in Python 3.11, it handles exception groups. except* ValueError as eg: catches all ValueError instances from an exception group while letting other exceptions propagate.

Q1603. [Linux] What is stress-ng?

A: A stress testing tool that exercises various system resources (CPU, memory, I/O, network). Used for stability testing, benchmarking, and validating resource limits. More comprehensive than the older stress tool.

Q1604. [Linux] What is the container networking model?

A: Each container gets its own network namespace with a virtual Ethernet pair (veth). One end is in the container, the other connects to a bridge (docker0). NAT rules (via iptables/nftables) enable outbound connectivity.

Q1605. [Ansible] How do you install a specific version of a collection?

A: ansible-galaxy collection install community.general:==5.0.0 or use a requirements.yml file with version pinning.

Q1606. [Ansible] What tasks cannot be delegated?

A: include, add_host, and debug tasks.

Q1607. [Ansible] How do you reference a variable in a playbook?

A: Using Jinja2 double-curly-brace syntax: {{ variable_name }}

Q1608. [Ansible] What happens with port: 22 vs port: "22" in Ansible YAML?

A: port: 22 creates an integer. port: "22" creates a string. Most Ansible modules handle this transparently, but some modules or Jinja2 operations are type-sensitive and may behave differently.

Q1609. [Linux] What is the difference between /var/log/messages and /var/log/syslog?

A: RHEL/CentOS uses /var/log/messages. Debian/Ubuntu uses /var/log/syslog. Both serve the same purpose — general system log messages. The name is a distribution convention.

Q1610. [Linux] How do you interpret load average?

A: Divide by the number of CPU cores. A load of 4.0 on a 4-core system means 100% utilization. Above the core count indicates processes are waiting. Consistently high 15-minute averages suggest sustained overload.


Batch 162

Q1611. [Python] What is pytest.mark.parametrize used for?

A: Running the same test with multiple sets of inputs: @pytest.mark.parametrize("input,expected", [(1,2), (3,4)]) runs the test twice with different arguments.

Q1612. [Linux] What is mkfs a frontend for?

A: mkfs is a wrapper that calls filesystem-specific tools: mkfs.ext4, mkfs.xfs, mkfs.btrfs, etc. Usage: mkfs -t ext4 /dev/sda1 or mkfs.ext4 /dev/sda1.

Q1613. [Python] What is Cython?

A: A superset of Python that compiles to C for performance. It allows adding C type declarations to Python code for dramatic speedups.

Q1614. [Python] What is the difference between itertools.chain() and itertools.chain.from_iterable()?

A: chain() takes multiple iterables as separate arguments: chain([1,2], [3,4]). chain.from_iterable() takes a single iterable of iterables: chain.from_iterable([[1,2], [3,4]]). The latter is useful when you have a generator of iterables.

Q1615. [Linux] What is the ethtool command?

A: Queries and controls network driver and hardware settings: speed, duplex, auto-negotiation, ring buffer size, offload features, and driver info. ethtool eth0 shows link status and speed.

Q1616. [Ansible] What is set_fact?

A: A module that sets host-level variables dynamically during playbook execution. Values persist for the rest of the play.

Q1617. [Ansible] What is the ansible-galaxy collection verify command?

A: It verifies that installed collection files match the Galaxy server's signatures and checksums, detecting tampering or corruption.

Q1618. [Linux] What is the difference between hard and soft limits in ulimit?

A: Soft limits are the effective current limits that processes observe. Hard limits are the ceiling that soft limits cannot exceed. Non-root users can lower hard limits but cannot raise them. Root can set both freely.

Q1619. [Python] What is "duck typing"?

A: "If it walks like a duck and quacks like a duck, it's a duck." Python checks behavior (methods/attributes) rather than explicit type, enabling polymorphism without inheritance.

Q1620. [Ansible] How do you run only specific tasks using tags?

A: ansible-playbook playbook.yml --tags "install,configure" or skip tags with --skip-tags "debug".


Batch 163

Q1621. [Linux] What is switch_root?

A: A command executed at the end of initramfs processing that atomically pivots from the temporary root filesystem to the real root. It deletes everything in the initramfs, mounts the real root at /, and exec's the real init process.

Q1622. [Python] What is unittest.TestCase.setUp() vs setUpClass()?

A: setUp() runs before every test method. setUpClass() (a classmethod) runs once before all tests in the class — useful for expensive setup like database connections.

Q1623. [Python] What did Python 3.7 add?

A: dataclasses, breakpoint(), asyncio.run(), contextvars, postponed evaluation of annotations (PEP 563 as __future__), and dict ordering became a language guarantee.

Q1624. [Linux] Who founded Red Hat?

A: Bob Young and Marc Ewing founded Red Hat in 1994. The name comes from Ewing's red Cornell lacrosse cap.

Q1625. [Linux] What is the difference between su and su -?

A: su switches user but keeps the current environment (PATH, HOME may not change). su - (or su -l) simulates a full login shell, setting the target user's complete environment.

Q1626. [Python] What is the small integer cache in CPython?

A: CPython pre-allocates integers from -5 to 256 as singleton objects. Any code that creates an integer in this range gets a reference to the same object, saving memory and time.

Q1627. [Ansible] What configuration file does ansible-lint use?

A: .ansible-lint (YAML format) in the project root directory. ---

Q1628. [Python] What is json.JSONDecodeError?

A: The exception raised when json.loads() or json.load() encounters invalid JSON. It is a subclass of ValueError.

Q1629. [Python] What is the result of {} == set()?

A: False. {} creates an empty dict, not an empty set. To create an empty set, you must use set().

Q1630. [Ansible] How do you set the PATH or environment variables for a task?

A: Use the environment keyword: environment: PATH: "{{ ansible_env.PATH }}:/new/path"


Batch 164

Q1631. [Linux] Is the Linux kernel monolithic or microkernel?

A: Monolithic — the entire OS runs in kernel space as a single binary image. However, it supports loadable kernel modules (LKMs) that can be inserted and removed at runtime, giving it some microkernel flexibility.

Q1632. [Ansible] What does --diff do?

A: It shows before-and-after comparisons for tasks that modify files (template, copy, lineinfile, etc.). Very useful for reviewing what a playbook will change.

Q1633. [Linux] What are the "dotfiles"?

A: Configuration files in the home directory starting with a dot (hidden by default). Examples: .bashrc, .vimrc, .ssh/, .gitconfig. Often version-controlled for portability.

Q1634. [Ansible] What does --check (check mode / dry run) do?

A: Ansible simulates the playbook execution without making changes. Modules that support check mode report what would have changed.

Q1635. [Linux] What is the basic sudoers syntax?

A: user HOST=(RUNAS) COMMANDS. Example: alice ALL=(ALL) ALL allows alice to run any command as any user on any host. %wheel ALL=(ALL) ALL allows the wheel group.

Q1636. [Ansible] What YAML multiline syntax options does Ansible support, and what are the key differences?

A: (1) Literal block scalar (|) -- preserves newlines exactly as written. (2) Folded block scalar (>) -- folds newlines into spaces (paragraph-style). Both support + (keep trailing newline) and - (strip trailing newline) modifiers.

Q1637. [Ansible] What is the raw module?

A: Executes a low-level command via SSH without requiring Python on the remote host. Useful for bootstrapping Python.

Q1638. [Python] What is the logging module's hierarchy?

A: Loggers form a hierarchy based on dot-separated names (e.g., app.database is a child of app). Messages propagate up to parent loggers. The root logger is the ancestor of all loggers.

Q1639. [Linux] What is an orphan process?

A: A process whose parent has terminated. Orphans are automatically adopted by PID 1 (init/systemd), which will eventually reap their exit status.

Q1640. [Python] What is aiofiles?

A: A third-party library providing async file I/O for asyncio, since the standard library's file operations are all synchronous and would block the event loop.


Batch 165

Q1641. [Ansible] If a rescue section succeeds, does Ansible consider the play failed?

A: No. If the rescue task succeeds, Ansible reverts the failed status and continues the play as if the original task succeeded.

Q1642. [Python] What is the concurrent.futures.as_completed() function?

A: It yields Future objects as they complete, regardless of submission order. Useful for processing results as they become available.

Q1643. [Python] What is the result of [] is []?

A: False. Each [] creates a new list object with a different identity.

Q1644. [Ansible] What is a "tombstone" entry in Ansible's collection routing?

A: When a module has been deprecated and then fully removed, a tombstone entry is placed in the routing config. Instead of the module code, users see a message directing them to the replacement module or collection.

Q1645. [Linux] What was the famous opening line of Linus Torvalds' Usenet post announcing Linux?

A: "Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones." Posted on comp.os.minix on August 25, 1991.

Q1646. [Linux] What is the purpose of /tmp?

A: Temporary files. Often a tmpfs (RAM-backed). Files may be deleted on reboot or by systemd-tmpfiles. World-writable with the sticky bit set.

Q1647. [Ansible] What is the major limitation of check mode?

A: It's a simulation. Tasks that use registered variables from prior tasks may not work correctly because those prior tasks didn't actually run. Conditional logic depending on real execution results will be unreliable.

Q1648. [Ansible] What is check mode (dry run)?

A: Running ansible-playbook --check playbook.yml shows what changes would occur without actually applying them. Not all modules support check mode.

Q1649. [Ansible] What is the difference between roles/x/defaults/ and roles/x/vars/?

A: Defaults have the lowest variable precedence (easily overridden). Vars have much higher precedence and are difficult to override without extra-vars or set_fact.

Q1650. [Python] Why is True + True == 2?

A: Because bool is a subclass of int, True equals 1, so True + True evaluates to 1 + 1 = 2.


Batch 166

Q1651. [Ansible] What does {{ list | map('extract', dict) }} do?

A: It uses each item in list as a key to look up values in dict, returning the corresponding values. This is a powerful pattern for transforming lists of keys into lists of values.

Q1652. [Python] What is the MRO in Python?

A: Method Resolution Order — the order in which base classes are searched when looking up a method. Python uses the C3 linearization algorithm. You can see it with ClassName.__mro__ or ClassName.mro().

Q1653. [Linux] What is the difference between a hub, switch, and router?

A: Hub: Layer 1, broadcasts all traffic to all ports. Switch: Layer 2, forwards frames based on MAC addresses. Router: Layer 3, forwards packets between networks based on IP addresses.

Q1654. [Python] What does sys.settrace() do?

A: It registers a trace function called for each line of Python execution. Used by debuggers and profilers. Replaced by the lower-overhead sys.monitoring in Python 3.12.

Q1655. [Ansible] What is the Module Replacer framework?

A: The older (legacy) module packaging mechanism, primarily used for PowerShell modules. It performs string substitution, replacing patterns like from ansible.module_utils.MOD_LIB_NAME import * with actual file contents.

Q1656. [Linux] What does "sudo" stand for?

A: "Superuser do" — though it also works to run commands as other non-root users.

Q1657. [Python] What is the array module used for?

A: It provides space-efficient arrays of uniform C-style types (like 'i' for int, 'f' for float). More memory-efficient than lists for large homogeneous numeric data, but less flexible.

Q1658. [Linux] What does grep -v do?

A: Inverts the match — shows lines that do NOT match the pattern.

Q1659. [Ansible] What module manages services?

A: service or systemd

Q1660. [Ansible] What is max_fail_percentage?

A: A play-level setting that stops a rolling update if the failure rate exceeds the specified percentage. ---


Batch 167

Q1661. [Ansible] What is ansible.cfg?

A: The central configuration file that controls how Ansible behaves -- connection settings, defaults, module paths, plugin paths, etc.

Q1662. [Ansible] How does Ansible communicate with Windows hosts?

A: Via WinRM (Windows Remote Management) with PowerShell modules.

Q1663. [Python] What is a decorator in Python?

A: Syntactic sugar for wrapping a function or class: @decorator above a definition is equivalent to func = decorator(func). Decorators can add behavior, modify, or replace the decorated object.

Q1664. [Ansible] What happens if two collections provide a module with the same short name?

A: Ansible uses the collections keyword search order to resolve ambiguity. If no collections keyword is set, it falls back to ansible.builtin. This is exactly why FQCNs are recommended -- they eliminate ambiguity entirely.

Q1665. [Python] What does itertools.cycle(iterable) do?

A: It creates an infinite iterator that cycles through the elements of the iterable. For example, cycle('ABC') yields A, B, C, A, B, C, A, ....

Q1666. [Python] What is multiprocessing.Pool used for?

A: It creates a pool of worker processes for parallel execution, with methods like map(), apply_async(), and starmap() to distribute work across CPU cores.

Q1667. [Ansible] What is ansible_local?

A: Facts defined in local .fact files placed in /etc/ansible/facts.d/ on the managed host. These are custom facts that persist on the target machine and are gathered automatically. --- --- ## 7. Jinja2 Templating & Filters

Q1668. [Python] What are context variables (contextvars)?

A: Introduced in Python 3.7, the contextvars module provides context-local variables similar to thread-local storage but works correctly with asyncio tasks. Used for things like request-scoped state.

Q1669. [Ansible] What is the "Norway Problem" in YAML, and how does it affect Ansible?

A: In YAML 1.1 (which Ansible uses), the string "NO" is interpreted as boolean false. This means the country code for Norway becomes false if unquoted. Similarly, "YES" becomes true and "OFF" becomes false. The fix is to always quote strings that could be misinterpreted as booleans.

Q1670. [Ansible] What does ansible-inventory --graph do?

A: Displays the inventory as a tree graph showing groups and hosts hierarchically.


Batch 168

Q1671. [Linux] What is the difference between static and dynamic linking?

A: Static linking embeds library code into the executable at compile time (larger binary, no runtime dependencies). Dynamic linking loads shared libraries (.so files) at runtime (smaller binary, requires libraries present at runtime).

Q1672. [Linux] What is the difference between block and character devices?

A: Block devices (b): provide random access to fixed-size blocks with buffering (disks, partitions). Character devices (c): provide sequential unbuffered access byte-by-byte (terminals, serial ports, /dev/null).

Q1673. [Linux] What are huge pages?

A: Memory pages larger than the default 4KB — typically 2MB or 1GB on x86-64. They reduce TLB misses for large working sets. Configured via hugetlbfs (static) or Transparent Huge Pages (THP, dynamic).

Q1674. [Ansible] How do you limit playbook execution to specific hosts?

A: ansible-playbook playbook.yml --limit "webserver1" or --limit "webservers".

Q1675. [Linux] What are the iptables tables and their purposes?

A: filter (default): packet filtering (INPUT, FORWARD, OUTPUT). nat: network address translation (PREROUTING, OUTPUT, POSTROUTING). mangle: packet alteration. raw: exemption from connection tracking. security: SELinux MAC rules.

Q1676. [Ansible] What is the retry_until pattern in Ansible?

A: Using until, retries, and delay to retry a task until a condition is met or max retries is reached.

Q1677. [Linux] What is sysfs?

A: A virtual filesystem mounted at /sys that exports information about kernel objects (devices, drivers, buses, modules) as a structured directory tree with attributes as files.

Q1678. [Ansible] What does the --ask-vault-pass flag do?

A: Prompts the user to enter the Vault password at runtime instead of storing it in a file. More secure for interactive use.

Q1679. [Ansible] What are the key phases in a Molecule test sequence?

A: dependency, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy. This is the default sequence; it can be customized.

Q1680. [Python] What is the truthiness rule in Python?

A: Objects are truthy by default. The following are falsy: None, False, zero of any numeric type (0, 0.0, 0j, Decimal(0), Fraction(0, 1)), empty sequences/mappings ('', (), [], {}, set(), range(0)), and objects whose __bool__ returns False or __len__ returns 0.


Batch 169

Q1681. [Linux] What is a network bridge?

A: A software device that connects two or more network segments at Layer 2 (data link). Commonly used in virtualization to connect VMs to the physical network.

Q1682. [Linux] What does systemd-analyze show?

A: Boot time analysis. systemd-analyze shows total boot time (firmware, loader, kernel, userspace). systemd-analyze blame shows per-unit startup times. systemd-analyze critical-chain shows the critical path.

Q1683. [Python] How many items does itertools.permutations('ABC', 2) yield?

A: 6 items: ('A','B'), ('A','C'), ('B','A'), ('B','C'), ('C','A'), ('C','B') — all ordered arrangements of 2 elements from 3. The formula is P(3,2) = 3!/(3-2)! = 6.

Q1684. [Linux] What is a container volume?

A: A mechanism for persistent storage that outlives the container. Bind mounts map host directories into containers. Named volumes are managed by the container runtime. tmpfs mounts exist only in memory.

Q1685. [Python] What does @property do under the hood?

A: It creates a data descriptor with __get__, __set__, and __delete__ methods. The getter is passed to property(), and setter/deleter are added via .setter and .deleter decorators.

Q1686. [Ansible] What does the hash filter do?

A: Generates a hash of a string: {{ 'password' | hash('sha512') }}. Useful with password_hash for generating system password hashes.

Q1687. [Linux] What is a udev rule?

A: A line matching device attributes and performing actions. Example: SUBSYSTEM=="net", ATTR{address}=="00:11:22:33:44:55", NAME="lan0" renames a NIC based on MAC address. Match keys use ==, assignment keys use =.

Q1688. [Ansible] How do you specify role dependencies?

A: In meta/main.yml under the dependencies key, listing other roles that must execute first.

Q1689. [Linux] What does traceroute do?

A: Shows the path packets take to reach a destination by sending probes with incrementing TTL values. Each hop's router responds with ICMP Time Exceeded. traceroute -n skips DNS resolution for faster output.

Q1690. [Ansible] What was the first commit to the Ansible GitHub repository, and approximately when?

A: Michael DeHaan made the first commit to the ansible/ansible GitHub repository in February 2012.


Batch 170

Q1691. [Python] What does python -c "expr" do?

A: Executes the given Python expression directly from the command line.

Q1692. [Ansible] How do you include roles in a playbook?

A: Using the roles: keyword in a play, or dynamically with include_role or import_role. ---

Q1693. [Python] What does textwrap.dedent() do?

A: It removes common leading whitespace from all lines in a multi-line string, useful for writing indented string literals that should not have leading whitespace in the output.

Q1694. [Python] What is sqlite3 in the standard library?

A: A built-in interface to SQLite databases. It requires no separate server and stores the entire database in a single file. Included since Python 2.5.

Q1695. [Ansible] What is inventory_dir?

A: The directory path of the inventory source (the folder containing the inventory file).

Q1696. [Ansible] What year did Red Hat acquire Ansible?

A: 2015.

Q1697. [Linux] What is the logrotate copytruncate directive?

A: Instead of renaming the log file and creating a new one (which requires the application to reopen), copytruncate copies the file then truncates the original. Useful for apps that don't handle SIGHUP for log reopening.

Q1698. [Linux] Describe the TCP three-way handshake.

A: Client sends SYN (seq=x). Server responds with SYN-ACK (seq=y, ack=x+1). Client sends ACK (seq=x+1, ack=y+1). Connection is now ESTABLISHED.

Q1699. [Ansible] What is the httpapi connection plugin?

A: A plugin for communicating with devices that expose HTTP(S) APIs. It uses HTTPAPI plugins as adapters for specific vendor APIs (e.g., Arista EOS eAPI, F5 BIG-IP REST). Useful for devices where SSH-based management is limited.

Q1700. [Ansible] What does the hostvars magic variable contain?

A: A dictionary of all variables for every host in the inventory, keyed by hostname. You can access another host's variables with hostvars['other_host']['variable_name'], even from a different play or role.


Batch 171

Q1701. [Python] What is pytest's tmp_path fixture?

A: A built-in fixture that provides a temporary directory unique to each test invocation. It returns a pathlib.Path object.

Q1702. [Linux] What is dbus (D-Bus)?

A: A message bus system for inter-process communication. systemd uses it extensively for service management. dbus-monitor watches messages. Two buses: system bus (root services) and session bus (user applications).

Q1703. [Python] What is the cProfile module?

A: A deterministic profiler that records how many times each function is called and how long each call takes. Invoke with python -m cProfile script.py.

Q1704. [Linux] What is tshark?

A: The command-line version of Wireshark for packet capture and analysis. Supports all Wireshark dissectors and display filters. Useful for scripted packet analysis.

Q1705. [Ansible] What is automation mesh?

A: A scalable overlay network in AAP that distributes automation execution across multiple nodes, including hop nodes (relays) and execution nodes, enabling automation across network boundaries.

Q1706. [Ansible] What is the INTERPRETER_PYTHON configuration, and why was auto mode added?

A: Controls which Python interpreter Ansible uses on managed nodes. The auto mode (default since 2.8) uses a lookup table to find the correct Python path per platform, avoiding the /usr/bin/python vs /usr/bin/python3 headache.

Q1707. [Linux] What is the purpose of /run?

A: Runtime data since last boot — tmpfs mounted early in boot. Contains PID files, sockets, and other transient data. Replaced /var/run.

Q1708. [Python] What method on an lru_cache-decorated function shows cache performance?

A: .cache_info() returns a named tuple with hits, misses, maxsize, and currsize. You can also call .cache_clear() to reset the cache.

Q1709. [Ansible] What is the ask_pass setting?

A: Controls whether Ansible prompts for an SSH password by default. Default is no (assumes SSH keys).

Q1710. [Linux] What does exit code 130 mean?

A: Process terminated by Ctrl-C (128 + 2 for SIGINT).


Batch 172

Q1711. [Python] What is the time module's perf_counter() vs time()?

A: perf_counter() returns a high-resolution monotonic timer for measuring short durations. time() returns wall-clock time (epoch seconds) which can jump due to NTP adjustments.

Q1712. [Linux] What does /proc/PID/smaps show?

A: Detailed memory information for each virtual memory area of a process: size, RSS, PSS (proportional set size), shared/private clean/dirty pages, referenced, anonymous, swap. More detailed than /proc/PID/maps.

Q1713. [Linux] What is the difference between TCP Nagle's algorithm and TCP_NODELAY?

A: Nagle's algorithm buffers small packets to reduce network overhead by combining them. Setting TCP_NODELAY disables Nagle's, sending packets immediately. Low-latency applications (games, trading) use TCP_NODELAY.

Q1714. [Linux] What is irqbalance?

A: A daemon that distributes hardware interrupts across CPUs for better performance. Prevents all interrupts from being handled by CPU 0. Can be tuned to ban certain CPUs from handling specific interrupts.

Q1715. [Ansible] Under what namespace are custom local facts accessible?

A: ansible_local -- e.g., ansible_local.custom_fact_name.key.

Q1716. [Ansible] What is role_path?

A: A magic variable available inside roles that contains the absolute path to the currently executing role's directory. Useful for referencing files relative to the role.

Q1717. [Linux] What is /proc/self?

A: A symbolic link to the /proc/PID directory of the current process. Useful for a process to introspect without knowing its own PID.

Q1718. [Ansible] What does regex_replace do?

A: Performs regex substitution: {{ 'hello-world' | regex_replace('-', '_') }} produces hello_world.

Q1719. [Linux] What is the maximum path length in Linux?

A: 4096 bytes (PATH_MAX), defined in the kernel.

Q1720. [Python] What is pipx?

A: A tool for installing Python CLI applications in isolated environments. Each application gets its own virtualenv, preventing dependency conflicts between tools.


Batch 173

Q1721. [Python] What is NumPy's dtype?

A: The data type of array elements: np.float64, np.int32, np.bool_, etc. It determines storage size and behavior.

Q1722. [Ansible] How do selectattr and rejectattr work?

A: They filter a list of objects based on an attribute's value: {{ users | selectattr('active', 'equalto', true) | list }} returns only users where active is true.

Q1723. [Python] What did Python 3.12 do with the GIL?

A: Python 3.12 began the work for per-interpreter GIL (PEP 684), allowing each sub-interpreter to have its own GIL.

Q1724. [Linux] What are the 7 layers of the OSI model?

A: From bottom to top: Physical (1), Data Link (2), Network (3), Transport (4), Session (5), Presentation (6), Application (7). Mnemonic: "Please Do Not Throw Sausage Pizza Away."

Q1725. [Linux] What is sysdig?

A: A system-level exploration and troubleshooting tool combining the functionality of strace, tcpdump, lsof, and more. Uses a scripting language called "chisels" for analysis. The commercial version (Sysdig Secure) is popular in Kubernetes environments.

Q1726. [Python] What is the socket module?

A: Low-level networking: creating TCP/UDP sockets, binding, listening, connecting, sending, and receiving data.

Q1727. [Python] What encoding does Python 3 use for source files by default?

A: UTF-8 (since Python 3.0). Python 2 defaulted to ASCII.

Q1728. [Ansible] What is the meta module used for?

A: Executing Ansible internal operations: flush_handlers, refresh_inventory, noop, clear_facts, clear_host_errors, end_play, end_host, end_batch, reset_connection.

Q1729. [Linux] What is the at command?

A: Schedules a one-time command execution: echo "backup.sh" | at 2:00 AM tomorrow. Managed with atq (list queue), atrm (remove job), batch (run when load is low).

Q1730. [Ansible] How do you loop over hosts in a group inside a template?

A: {% for host in groups['db_servers'] %} {{ host }} {% endfor %}


Batch 174

Q1731. [Ansible] How does Ansible interact with Kubernetes?

A: Using the kubernetes.core collection modules to deploy workloads, manage resources, apply manifests, and bootstrap clusters.

Q1732. [Python] What are Python "lightning talks"?

A: Very short (typically 5-minute) presentations given at Python conferences, often humorous or covering niche topics.

Q1733. [Linux] What is IFS?

A: Internal Field Separator — controls word splitting in Bash. Default is space, tab, newline. Changing IFS affects how the shell splits unquoted variables and command substitution output. --- ## 19. Device Management

Q1734. [Python] What does @functools.total_ordering do?

A: It is a class decorator that, given __eq__ and one of __lt__, __le__, __gt__, or __ge__, automatically generates the remaining comparison methods.

Q1735. [Ansible] What is the difference between role defaults and role vars in terms of precedence?

A: Role defaults (defaults/main.yml) are level 2 -- the second-lowest precedence, designed to be easily overridden. Role vars (vars/main.yml) are level 15 -- much higher precedence, intended for values that should NOT be easily overridden by inventory or group/host vars.

Q1736. [Python] What does list.sort() vs sorted() return?

A: list.sort() sorts in-place and returns None. sorted() returns a new sorted list and works on any iterable. --- ## 4. Functions & Closures

Q1737. [Python] How do you create a context manager from a generator function using contextlib?

A: Use the @contextlib.contextmanager decorator on a generator function that yields exactly once. Code before the yield is the setup (__enter__), and code after is the teardown (__exit__).

Q1738. [Linux] What is the socat command?

A: "SOcket CAT" — a multipurpose relay tool that establishes two bidirectional byte streams and transfers data. More powerful than netcat, supporting Unix sockets, SSL, proxy protocols, and file descriptors.

Q1739. [Python] What is a data descriptor vs a non-data descriptor?

A: A data descriptor defines both __get__ and __set__ (or __delete__). A non-data descriptor defines only __get__. Data descriptors take priority over instance __dict__, while non-data descriptors do not.

Q1740. [Linux] What happens when you ping ::1?

A: Sends ICMPv6 echo requests to the IPv6 loopback address. Equivalent to ping 127.0.0.1 for IPv6 connectivity testing.


Batch 175

Q1741. [Ansible] What does become do?

A: Enables privilege escalation (like sudo) to run tasks with elevated permissions.

Q1742. [Python] What is the subprocess.run() function?

A: The recommended way to run external commands (Python 3.5+). It returns a CompletedProcess with returncode, stdout, and stderr. Use check=True to raise on non-zero exit codes.

Q1743. [Ansible] What is group_names?

A: A list of all groups the current host is a member of.

Q1744. [Linux] What is the tune2fs command?

A: Adjusts tunable parameters on ext2/ext3/ext4 filesystems, such as mount count, check intervals, reserved block percentage, and enabling/disabling features like journaling.

Q1745. [Linux] What is the difference between screen and tmux?

A: Both are terminal multiplexers. tmux is more modern with a client-server architecture, better scripting support, and easier keybindings. screen is older but still widely available. Both allow sessions to persist after disconnection.

Q1746. [Python] What is __slots__ effect on __dict__?

A: When __slots__ is defined, instances do not have a __dict__ attribute. This saves memory but means you cannot add arbitrary attributes to instances. --- ## 21. Version-Specific Features

Q1747. [Python] What is the difference between __cause__ and __context__ on exceptions?

A: __cause__ is set explicitly via raise X from Y (explicit chaining). __context__ is set automatically when an exception is raised during exception handling (implicit chaining).

Q1748. [Ansible] What are the four built-in strategy plugins in Ansible?

A: (1) linear -- the default; runs each task on all hosts before moving to the next task; (2) free -- lets each host run through tasks independently as fast as possible; (3) host_pinned -- like free, but does not interrupt execution on a host to start another; (4) debug -- interactive debugging on task failure.

Q1749. [Python] What is the dataclasses.field() metadata parameter for?

A: It is a mapping that stores arbitrary user-defined data on the field. It is not used by dataclasses itself but can be consumed by third-party libraries or custom processing.

Q1750. [Ansible] What does the ANSIBLE_KEEP_REMOTE_FILES setting do?

A: When set to True, Ansible does NOT delete the temporary module files it copies to the remote host after execution. Extremely useful for debugging module behavior -- you can SSH to the target and inspect/run the module code manually.


Batch 176

Q1751. [Ansible] What encryption algorithm does Ansible Vault use?

A: AES-256 in CTR mode with HMAC-SHA256 authentication.

Q1752. [Linux] What are AppArmor's two modes?

A: enforce: violations are blocked and logged. complain: violations are logged but allowed (equivalent to SELinux permissive).

Q1753. [Ansible] What is the difference between command and shell modules?

A: command runs commands directly without shell processing (no pipes, redirects, or variable expansion). shell executes through a shell, allowing all shell features. command is more secure; shell is more flexible.

Q1754. [Linux] What is the USE Method for performance analysis?

A: Utilization, Saturation, Errors — check all resources (CPU, memory, network, disk) for these three metrics. Created by Brendan Gregg as a systematic approach to performance troubleshooting.

Q1755. [Ansible] How do you reboot a host and wait for it to come back?

A: Use the reboot module which handles both rebooting and waiting for reconnection automatically.

Q1756. [Linux] What is RAID 1?

A: Mirroring — data is duplicated on two or more disks. Provides redundancy (survives disk failure) but usable capacity is only half. Read speed improves, write speed does not.

Q1757. [Linux] What is the difference between block and character devices?

A: Block devices handle data in blocks with buffering (disks, partitions). Character devices transfer data character by character without buffering (terminals, serial ports, /dev/null). --- ## 6. Users, Groups & Permissions

Q1758. [Ansible] How does pipelining change module execution?

A: With pipelining enabled, Ansible pipes the module directly into the remote Python interpreter via stdin instead of writing it to a temporary file. This improves security (no file on disk with arguments) and performance (fewer SSH operations). ---

Q1759. [Linux] What is arp -a replaced by?

A: ip neigh show — displays the ARP/neighbor cache on modern Linux systems.

Q1760. [Ansible] What does throttle do?

A: Limits the number of concurrent workers for a specific task or block, independent of forks and serial. Cannot exceed the forks setting.


Batch 177

Q1761. [Python] What is typing.Callable used for?

A: Annotating callable objects: Callable[[int, str], bool] describes a function taking an int and str and returning bool.

Q1762. [Linux] What is the AUR?

A: Arch User Repository — a community-driven repository of build scripts (PKGBUILDs) for Arch Linux. Packages are built from source by the user. Helpers like yay or paru automate the process.

Q1763. [Ansible] What are inventory plugins?

A: Generate dynamic inventory from external sources. Examples: aws_ec2, azure_rm, gcp_compute, vmware_vm_inventory.

Q1764. [Python] What NumPy function creates an array of zeros?

A: np.zeros(shape) creates an array filled with zeros. np.ones(shape) for ones, np.empty(shape) for uninitialized memory.

Q1765. [Ansible] What does ansible-doc do?

A: Displays documentation for modules, plugins, and other Ansible components from the command line.

Q1766. [Ansible] What are best practices for Ansible role organization?

A: Follow naming conventions, modularize functionality, document roles thoroughly, use version control, implement testing with Molecule, minimize dependencies, and reuse community roles when appropriate.

Q1767. [Linux] What is the FHS?

A: The Filesystem Hierarchy Standard — a specification defining the directory structure and contents of Unix-like systems. Maintained by the Linux Foundation.

Q1768. [Ansible] What is the difference between network_cli and httpapi for network devices?

A: network_cli uses SSH to interact with the device's CLI (like a human at a terminal). httpapi uses REST API calls over HTTP(S). The choice depends on which interface the device exposes and which provides better functionality.

Q1769. [Linux] What kernel parameter forces a root password reset?

A: On RHEL: append rd.break to interrupt in initramfs, then mount -o remount,rw /sysroot && chroot /sysroot && passwd root. On systems with SELinux: touch /.autorelabel before rebooting.

Q1770. [Python] What is string.Template and when would you use it?

A: string.Template uses $-based substitution ($name or ${name}). It is simpler and safer for user-provided templates because it doesn't allow arbitrary expression evaluation.


Batch 178

Q1771. [Linux] What are the main systemd unit types?

A: service (daemons), socket (IPC/network sockets), timer (cron replacement), mount (mount points), device (udev devices), target (groups of units), path (file monitoring), slice (cgroup resource management), scope (externally created processes).

Q1772. [Linux] What is RAID 10?

A: A nested RAID: mirrors (RAID 1) that are then striped (RAID 0). Requires at least 4 disks. Provides both redundancy and performance. Usable capacity is 50%.

Q1773. [Linux] What is a daemon?

A: A background process that runs without a controlling terminal, typically started at boot. Conventionally named with a trailing 'd' (sshd, httpd, crond).

Q1774. [Python] What is the result of True + True?

A: 2. In Python, bool is a subclass of int, where True is 1 and False is 0.

Q1775. [Python] What is the difference between __import__() and importlib.import_module()?

A: Both import modules by name, but importlib.import_module() is the recommended approach. __import__() is the low-level function called by the import statement.

Q1776. [Linux] What is the principle of least privilege?

A: Users and processes should have only the minimum permissions needed to perform their tasks. Implemented via capabilities, SELinux/AppArmor, sudoers restrictions, and file permissions.

Q1777. [Linux] What are systemd targets, and how do they map to SysVinit runlevels?

A: Targets are systemd unit files grouping services. poweroff.target=runlevel 0, rescue.target=1, multi-user.target=3, graphical.target=5, reboot.target=6.

Q1778. [Ansible] When was Ansible Lightspeed generally available?

A: November 2023.

Q1779. [Python] What is the del statement?

A: It unbinds a name from an object: del x removes x from the local namespace. For lists, del lst[i] removes an element. del does not directly free memory — it just decrements the reference count.

Q1780. [Linux] What is TCP slow start?

A: A congestion control mechanism where the sender starts with a small congestion window and doubles it each RTT until reaching the slow start threshold, then switches to congestion avoidance (linear growth).


Batch 179

Q1781. [Linux] What is the setgid bit?

A: Octal 2000 (chmod g+s). On executables: process runs with the file's group effective GID. On directories: new files inherit the directory's group rather than the creator's primary group.

Q1782. [Linux] What is blkid?

A: Displays block device attributes: UUID, filesystem type, label, and partition type GUID. Used to find UUIDs for fstab entries.

Q1783. [Linux] What is a thread in Linux?

A: A lightweight process sharing the same address space, file descriptors, and signal handlers with other threads in the same thread group. Created via clone() with CLONE_VM, CLONE_FILES, CLONE_SIGHAND flags.

Q1784. [Linux] What is the purpose of /sbin?

A: Essential system administration binaries (fsck, fdisk, init, iptables). With UsrMerge, /sbin symlinks to /usr/sbin.

Q1785. [Linux] What is the cron syntax format?

A: Five fields: minute (0-59) hour (0-23) day-of-month (1-31) month (1-12) day-of-week (0-7, where 0 and 7 are Sunday). Followed by the command.

Q1786. [Linux] What is the sticky bit shown as in ls -l?

A: A lowercase t in the others' execute position: drwxrwxrwt (e.g., /tmp). If execute is not set, it shows as uppercase T.

Q1787. [Linux] What is /etc/shells?

A: Lists valid login shells. chsh only allows shells listed here. FTP servers check this file to allow/deny user access.

Q1788. [Ansible] What language is Ansible written in? What about Puppet, Chef, and SaltStack?

A: Ansible: Python. Puppet: Ruby (with its own Puppet DSL). Chef: Ruby (with Ruby DSL for recipes). SaltStack: Python.

Q1789. [Python] What is the result of "hello" * 3?

A: 'hellohellohello'. String (and sequence) multiplication repeats the sequence.

Q1790. [Ansible] What does ANSIBLE_PIPELINING control?

A: When true, reduces the number of SSH operations by piping the module to the remote Python interpreter's stdin instead of using temporary files. Requires requiretty to be disabled in sudoers.


Batch 180

Q1791. [Linux] What is the lscpu command?

A: Displays CPU architecture information: model name, cores, threads, sockets, NUMA nodes, cache sizes, flags, and virtualization capabilities. Reads from /proc/cpuinfo and sysfs.

Q1792. [Ansible] What year did Ansible Galaxy launch?

A: Ansible Galaxy launched in 2013, as a community hub for sharing Ansible roles.

Q1793. [Linux] What is $$?

A: The PID of the current shell/script.

Q1794. [Ansible] What is a Vault ID, and why would you use multiple?

A: A Vault ID labels an encrypted value with a name (e.g., "dev", "prod"), allowing different passwords for different environments. You can then pass multiple --vault-id arguments to decrypt values from different vaults in a single playbook run.

Q1795. [Ansible] What Molecule command runs only the verify step without re-converging?

A: molecule verify

Q1796. [Ansible] What are Ansible test plugins?

A: Jinja2 test functions used in when conditionals: is defined, is undefined, is match, is search, is regex, is file, is directory, is link, etc.

Q1797. [Linux] Compare ext4 vs XFS vs Btrfs.

A: ext4: most stable, mature, can shrink and grow, max 1EB volume. XFS: best for large files and parallel I/O, can only grow (not shrink), used by RHEL. Btrfs: modern COW filesystem with snapshots, checksumming, compression, and built-in RAID, but RAID 5/6 is still experimental.

Q1798. [Python] What is Sanic?

A: An async Python web framework designed for speed, similar to Flask's API but fully async.

Q1799. [Python] What is the difference between __str__ and __repr__?

A: __repr__ should return an unambiguous string representation (ideally valid Python to recreate the object). __str__ should return a readable, user-friendly string. __repr__ is used in the REPL; __str__ is used by print().

Q1800. [Ansible] What callback plugin profiles memory usage of Ansible tasks?

A: cgroup_memory_recap -- uses cgroups to measure maximum memory usage per task and overall. --- --- ## 16. Ansible Tower / AWX / Automation Controller


Batch 181

Q1801. [Ansible] What is the ansible_connection variable?

A: Specifies the connection type for a host: ssh, winrm, local, docker, network_cli, etc.

Q1802. [Ansible] What is the "routing" configuration in the context of collections migration?

A: Routing configuration (meta/routing.yml) in a collection defines redirects and tombstones for modules/plugins that have moved or been removed. It helps Ansible resolve old short names to new FQCNs and displays deprecation/removal warnings.

Q1803. [Linux] What is NUMA?

A: Non-Uniform Memory Access — a memory architecture where each CPU socket has "local" memory with faster access and "remote" memory on other sockets with higher latency. The kernel's NUMA-aware allocator tries to place memory close to the CPU that uses it.

Q1804. [Linux] What is NetworkManager?

A: A daemon managing network connections on Linux desktops and servers. Configured via nmcli (CLI), nmtui (TUI), or GUI. Handles Wi-Fi, Ethernet, VPN, bonding, VLAN, and bridging. Default on RHEL, Fedora, Ubuntu desktop.

Q1805. [Python] What PEP number is "The Zen of Python"?

A: PEP 20.

Q1806. [Ansible] What valid type values can be used in argument_spec?

A: str, list, dict, bool, int, float, path, raw, jsonarg, json, bytes, bits.

Q1807. [Python] What is the abc.ABCMeta metaclass?

A: The metaclass used by ABC. It enables register() for virtual subclasses and tracks which abstract methods need implementation.

Q1808. [Linux] What is the tuna command?

A: A tool for tuning system performance: adjusting IRQ affinity, CPU affinity, process priorities, and isolating CPUs. Provides both CLI and GUI. Common in RHEL for real-time tuning.

Q1809. [Linux] What is initramfs?

A: Initial RAM Filesystem — a compressed cpio archive loaded into memory by the bootloader alongside the kernel. It contains essential drivers, scripts, and tools needed to mount the real root filesystem (e.g., LVM, RAID, encryption, network drivers).

Q1810. [Python] What is the contextlib.asynccontextmanager decorator for?

A: It is the async equivalent of @contextmanager, allowing you to create async context managers from async generator functions that yield once.


Batch 182

Q1811. [Python] What does timedelta represent?

A: A duration — the difference between two dates or datetimes. It stores days, seconds, and microseconds internally.

Q1812. [Linux] What is the emergency.target in systemd?

A: A minimal target that provides a root shell with only the root filesystem mounted read-only. Fewer services than rescue.target. Access with systemd.unit=emergency.target on the kernel command line.

Q1813. [Linux] What is live migration?

A: Moving a running VM from one physical host to another with minimal downtime. KVM/libvirt supports live migration over shared storage or with storage migration. The VM's memory is iteratively copied while it runs.

Q1814. [Python] What is typing.Final used for?

A: Declaring that a variable should not be reassigned: MAX_SIZE: Final = 100. A type checker will flag any subsequent reassignment.

Q1815. [Python] What is Bottle's claim to fame?

A: It is a single-file micro web framework with no dependencies outside the standard library — the entire framework is one Python file.

Q1816. [Python] What is EuroPython?

A: The largest Python conference in Europe, held annually since 2002. It rotates between European cities.

Q1817. [Ansible] How do you provision AWS EC2 instances with Ansible?

A: Use the amazon.aws.ec2_instance module with appropriate parameters (image_id, instance_type, key_name, security groups, etc.). ---

Q1818. [Python] What is the type of {}?

A: dict. This is a common gotcha — empty curly braces create a dict, not a set.

Q1819. [Linux] What does grub2-install do?

A: Installs the GRUB bootloader to a device's MBR or EFI partition. On BIOS: grub2-install /dev/sda. On UEFI: installs to the ESP. Must be run after disk replacement or MBR corruption.

Q1820. [Ansible] What internal arguments does Ansible automatically inject into every module call?

A: _ansible_no_log, _ansible_debug, _ansible_diff, _ansible_verbosity, _ansible_selinux_special_fs, _ansible_syslog_facility, _ansible_version, _ansible_module_name, _ansible_keep_remote_files, _ansible_socket, _ansible_shell_executable, _ansible_tmpdir, _ansible_remote_tmp.


Batch 183

Q1821. [Python] What is configparser used for?

A: Reading and writing INI-style configuration files with sections, keys, and values. Similar to Windows .ini files.

Q1822. [Linux] What is an SELinux security context?

A: A label in the format user:role:type:level (e.g., system_u:object_r:httpd_sys_content_t:s0). The type field is most important for policy enforcement (type enforcement).

Q1823. [Ansible] What is ansible_network_os, and why is it critical for network automation?

A: It identifies the network operating system (e.g., ios, nxos, eos, junos) so Ansible loads the correct Terminal, cliconf, and httpapi plugins for that platform. Without it, network modules cannot function.

Q1824. [Ansible] How do you manage secrets across multiple environments?

A: Separate vault files per environment, use Vault IDs for different passwords, integrate with external secret managers (HashiCorp Vault, AWS Secrets Manager), rotate secrets regularly.

Q1825. [Ansible] What is the "include_role with conditionals" anti-pattern?

A: Putting when on include_role only evaluates the condition once (at include time). If you need per-task conditions inside the role, use variables instead. This is a common source of bugs.

Q1826. [Ansible] What symbol starts a list item in YAML?

A: A dash followed by a space (-).

Q1827. [Linux] What is the purpose of /var?

A: Variable data — files that change during operation: logs (/var/log), mail (/var/mail), spool (/var/spool), caches (/var/cache), temporary persistent files (/var/tmp), runtime data (/var/run/run).

Q1828. [Linux] What is /sys/class/?

A: Contains symbolic links organized by device class (net, block, tty, input, etc.). For example, /sys/class/net/eth0/ contains attributes for the eth0 network interface.

Q1829. [Linux] What is perf?

A: A powerful Linux profiling tool that leverages hardware performance counters, tracepoints, kprobes, and uprobes. It can profile CPU cycles, cache misses, branch mispredictions, and more with minimal overhead.

Q1830. [Ansible] What speedup can Mitogen provide?

A: 1.25x to 7x speedup and at least 2x CPU usage reduction. One real-world example showed playbook runtime dropping from 45 minutes to under 3 minutes.


Batch 184

Q1831. [Linux] What is tmpfs?

A: A filesystem that keeps all files in virtual memory (RAM + swap). Files are not persisted to disk. Used for /tmp, /run, and /dev/shm. Size is dynamic up to a configurable limit.

Q1832. [Linux] What is the difference between iptables and nftables?

A: iptables: legacy packet filter using separate tools for IPv4/IPv6/ARP/bridge. nftables: modern replacement with unified syntax, atomic rule updates, maps/sets, better performance, and simplified architecture. nftables is the default in Debian 10+, RHEL 8+.

Q1833. [Linux] What is the well-known port for SSH?

A: 22/tcp.

Q1834. [Ansible] How do you create a new role skeleton?

A: ansible-galaxy init role_name creates the standard directory structure.

Q1835. [Ansible] What file format does Ansible use for its return data from modules?

A: JSON. Every Ansible module returns a JSON dictionary to stdout, which the controller parses. This is why modules can be written in any language -- they just need to output valid JSON.

Q1836. [Ansible] What Python version does ansible-core 2.14 require on the control node?

A: Python 3.9+.

Q1837. [Python] What is classmethod vs staticmethod when used with inheritance?

A: classmethod receives the actual subclass as cls, enabling factory methods that return the correct subclass type. staticmethod has no access to the class, so it behaves identically regardless of which class calls it.

Q1838. [Python] What is the struct module's byte order prefixes?

A: > for big-endian, < for little-endian, = for native, ! for network (big-endian), @ for native with native size.

Q1839. [Ansible] What does the synchronize module do?

A: A wrapper around rsync for efficient file transfer between control node and managed nodes.

Q1840. [Ansible] What is the exact search order for ansible.cfg files (highest to lowest priority)?

A: (1) ANSIBLE_CONFIG environment variable (pointing to a specific file); (2) ansible.cfg in the current working directory; (3) ~/.ansible.cfg in the user's home directory; (4) /etc/ansible/ansible.cfg.


Batch 185

Q1841. [Linux] Where are apt repository definitions stored?

A: /etc/apt/sources.list and files in /etc/apt/sources.list.d/.

Q1842. [Linux] What are awk's key built-in variables?

A: NR = current record/line number, NF = number of fields in current record, FS = field separator (default whitespace), OFS = output field separator, RS = record separator, ORS = output record separator, FILENAME = current filename.

Q1843. [Python] What is Ansible's Ansiballz?

A: The mechanism Ansible uses to transfer Python modules to remote hosts. It packages the module and its dependencies into a ZIP file that is executed via zipimport.

Q1844. [Python] What is __format__ used for?

A: It is called by format() and f-strings to customize how an object is formatted. For example, datetime objects use it to support format codes like f'{dt:%Y-%m-%d}'.

Q1845. [Linux] What does type do in Bash?

A: Shows how a command name would be interpreted — whether it's an alias, function, builtin, or external command with path.

Q1846. [Ansible] What is ansible_facts vs top-level fact variables?

A: ansible_facts is a dictionary namespace containing all gathered facts. When INJECT_FACTS_AS_VARS is true (default), facts are also available as top-level variables prefixed with ansible_.

Q1847. [Linux] What does ${var:+alternate} do?

A: Returns alternate if $var is set and non-null, otherwise returns nothing.

Q1848. [Ansible] What was the old-style dynamic inventory approach before inventory plugins?

A: Executable inventory scripts (e.g., ec2.py). These scripts output JSON to stdout when called with --list or --host <hostname>. This approach is now deprecated in favor of inventory plugins.

Q1849. [Python] What is the walrus operator officially called?

A: Assignment expression.

Q1850. [Linux] What character is forbidden in Linux filenames?

A: The forward slash / (directory separator) and the null byte \0. Everything else is technically valid, though many characters cause practical issues.


Batch 186

Q1851. [Ansible] How do you run tasks asynchronously?

A: Use async: <seconds> to set max runtime and poll: <seconds> to set check interval. poll: 0 means fire-and-forget.

Q1852. [Linux] What is the EDITOR and VISUAL variable?

A: EDITOR specifies the default text editor for line-based editing. VISUAL specifies the full-screen editor. Programs check VISUAL first, falling back to EDITOR.

Q1853. [Linux] How do you temporarily change SELinux mode?

A: setenforce 0 (permissive) or setenforce 1 (enforcing). Permanent changes require editing /etc/selinux/config.

Q1854. [Ansible] What is Ansible Vault?

A: A feature for encrypting sensitive data (passwords, API keys, certificates) within Ansible files and variables, using AES256 encryption.

Q1855. [Linux] What data structure does CFS use internally?

A: A red-black tree (self-balancing binary search tree) ordered by each task's virtual runtime (vruntime). The leftmost node (smallest vruntime) is the next task to run.

Q1856. [Python] What is the locale module?

A: It provides access to locale-specific formatting for numbers, currency, and dates. locale.setlocale() changes the locale for the current process.

Q1857. [Ansible] What collection provides Podman modules and connection plugins?

A: containers.podman

Q1858. [Ansible] List all the string values that YAML 1.1 interprets as boolean false.

A: false, False, FALSE, no, No, NO, off, Off, OFF.

Q1859. [Ansible] What is the syntax of an ad-hoc command?

A: ansible [host-pattern] -m [module] -a "[module arguments]"

Q1860. [Ansible] What was the major architectural change in Ansible 2.0?

A: A complete rewrite of the core engine with a new execution framework, improved variable handling, and better error reporting.


Batch 187

Q1861. [Linux] What is the tc command?

A: Traffic Control — configures the kernel's packet scheduler for QoS, rate limiting, traffic shaping, and simulation of network conditions (latency, loss). Example: tc qdisc add dev eth0 root netem delay 100ms.

Q1862. [Linux] What is the newgrp command?

A: Temporarily changes the user's primary group for the current shell session. Useful for creating files with a different group ownership. --- ## 7. Networking

Q1863. [Python] What is Python Fire?

A: A Google library that automatically generates CLI interfaces from any Python object (function, class, module, dict).

Q1864. [Linux] What does journalctl -b -1 show?

A: Logs from the previous boot. -b 0 is the current boot, -b -2 is two boots ago. Requires persistent journal storage.

Q1865. [Linux] What are the two main package management families?

A: Debian-based (.deb packages, dpkg/apt) and Red Hat-based (.rpm packages, rpm/yum/dnf).

Q1866. [Ansible] How do you enable a callback plugin?

A: Configure in ansible.cfg under [defaults]: callback_whitelist = profile_tasks, timer ---

Q1867. [Ansible] What module adds or modifies lines in files?

A: lineinfile (for single lines) or blockinfile (for blocks of text).

Q1868. [Python] What is Click?

A: A Python package by the Pallets Project (same team as Flask) for creating command-line interfaces using decorators.

Q1869. [Linux] What are the key columns in top?

A: PID, USER, PR (priority), NI (nice), VIRT (virtual memory), RES (resident physical memory), SHR (shared memory), S (state), %CPU, %MEM, TIME+, COMMAND.

Q1870. [Python] What is pytest.raises?

A: A context manager that asserts an exception is raised: with pytest.raises(ValueError):. It also allows inspecting the exception via excinfo.value. --- ## 16. Web Frameworks


Batch 188

Q1871. [Linux] What is an inode, and what does it store?

A: An index node storing file metadata: file type, permissions, owner UID/GID, size, timestamps (atime, mtime, ctime), hard link count, and pointers to data blocks. It does NOT contain the filename — that's stored in the directory entry.

Q1872. [Linux] What was the first commercial Linux distribution?

A: Yggdrasil Linux, released in December 1992, was the first commercial Linux distribution to be sold. SLS and MCC were earlier but free.

Q1873. [Linux] What is RFC 5737?

A: Defines documentation IP address ranges: 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2), 203.0.113.0/24 (TEST-NET-3). Should be used in documentation and examples instead of real addresses.

Q1874. [Ansible] How do you encrypt a single string variable?

A: ansible-vault encrypt_string 'secret_value' --name 'variable_name'

Q1875. [Linux] What is ipvlan?

A: Similar to macvlan but all virtual interfaces share the parent's MAC address and use different IPs. Avoids MAC address table overflow on switches. Supports L2 and L3 modes.

Q1876. [Ansible] Where was Ansible, Inc. originally based before the Red Hat acquisition?

A: The company was based out of Durham, N.C., though some sources also reference Santa Barbara, California as an early location.

Q1877. [Python] What module allows exact arithmetic with fractions?

A: The fractions module with its Fraction class. For example, Fraction(1, 3) + Fraction(1, 6) gives Fraction(1, 2).

Q1878. [Ansible] What is ansible_connection and where can it be set?

A: It specifies which connection plugin to use for a host. It can be set in inventory (per host or group), playbook vars, or command line. Examples: ssh, local, docker, network_cli, winrm. ---

Q1879. [Python] What are the different comprehension types in Python?

A: List [x for x in items], set {x for x in items}, dict {k: v for k, v in pairs}, and generator expression (x for x in items).

Q1880. [Python] Which Zen aphorism is often cited to argue against Java-style getter/setter methods in Python?

A: "Simple is better than complex" and "There should be one -- and preferably only one -- obvious way to do it."


Batch 189

Q1881. [Python] What does the re.DOTALL (or re.S) flag do?

A: It makes the . metacharacter match any character including newlines. Without it, . matches everything except \n.

Q1882. [Linux] What is the OCI specification?

A: Open Container Initiative — defines standards for container images (image-spec) and runtimes (runtime-spec). Ensures interoperability between Docker, Podman, containerd, CRI-O, and other container tools.

Q1883. [Python] What does the gc module do?

A: It provides an interface to Python's garbage collector. You can trigger collection with gc.collect(), get referrers with gc.get_referrers(), and tune collection thresholds.

Q1884. [Linux] What is NAT?

A: Network Address Translation — remaps IP addresses in packet headers, allowing multiple devices to share a single public IP. Types: SNAT (source NAT/masquerade), DNAT (destination NAT/port forwarding).

Q1885. [Ansible] What are custom facts (local facts) and where do they live?

A: Custom facts are files placed in /etc/ansible/facts.d/ on managed hosts. They can be INI, JSON, or executable files returning JSON. They appear under ansible_local in gathered facts.

Q1886. [Ansible] What is the relationship between ansible-core and the ansible package?

A: ansible-core contains the runtime engine, CLI tools, and built-in plugins/modules. The ansible package is a meta-package that installs ansible-core plus a curated set of community collections.

Q1887. [Ansible] Name three strategies to keep playbooks DRY.

A: Use roles for reusable components, use includes/imports for shared task files, and use variables/defaults to eliminate hardcoded values.

Q1888. [Linux] How do you set the default systemd target?

A: systemctl set-default multi-user.target (creates a symlink at /etc/systemd/system/default.target).

Q1889. [Python] What is the default recursion limit?

A: 1000 (check with sys.getrecursionlimit(), change with sys.setrecursionlimit()).

Q1890. [Python] What does str.format_map() do?

A: Like str.format(**mapping) but takes a mapping directly without unpacking. Useful with defaultdict to handle missing keys gracefully.


Batch 190

Q1891. [Linux] What are the main kernel memory zones on x86-64?

A: ZONE_DMA (first 16MB for legacy DMA), ZONE_DMA32 (first 4GB for 32-bit DMA), ZONE_NORMAL (rest of physical memory). There is no ZONE_HIGHMEM on 64-bit because all physical memory is directly mappable. --- ## 3. Boot Process

Q1892. [Linux] What is nproc?

A: Prints the number of available processing units (CPU cores/threads). Commonly used in build scripts: make -j$(nproc).

Q1893. [Python] What does the % operator do with strings in Python?

A: It performs old-style C-like string formatting: 'Hello %s, you are %d' % ('Alice', 30).

Q1894. [Python] What PEP established the Steering Council governance model?

A: PEP 13, "Python Language Governance," adopted in late 2018.

Q1895. [Ansible] What is the synchronize module?

A: An Ansible wrapper around rsync. Requires rsync on both source and destination. Key gotchas: must use delegate_to to change source, and full paths are needed when using sudo.

Q1896. [Linux] What is fail2ban?

A: An intrusion prevention daemon that monitors log files and bans IP addresses showing malicious behavior (repeated failed logins, etc.) by adding firewall rules. Configurable jails define services to protect.

Q1897. [Linux] What is cloud-init?

A: An industry standard for initializing cloud instances on first boot. Handles SSH keys, hostname, network, user creation, package installation, and custom scripts. Reads metadata from the cloud provider.

Q1898. [Linux] How do you define a Bash array?

A: arr=(one two three). Access: ${arr[0]}. All elements: ${arr[@]}. Length: ${#arr[@]}.

Q1899. [Ansible] What are the key parts of an EDA rulebook?

A: Sources (provide events), rules (check conditions), and actions (trigger automation). Together they form "if this, then that" logic.

Q1900. [Ansible] What are custom/local facts?

A: Facts defined by files placed in /etc/ansible/facts.d/ on managed hosts. Files must end in .fact and can be JSON, INI, or executables that output JSON.


Batch 191

Q1901. [Ansible] What Python class must every custom Ansible module import?

A: AnsibleModule from ansible.module_utils.basic.

Q1902. [Linux] What is a bzImage?

A: "Big zImage" — the compressed Linux kernel image format used on x86. Created by make bzImage. Despite the name, it uses gzip (or other) compression, not bzip2.

Q1903. [Linux] How do you find which package provides a file on Debian?

A: dpkg -S /path/to/file for installed packages. apt-file search /path/to/file for all available packages (requires apt-file).

Q1904. [Ansible] What Python library does the netconf connection plugin use under the hood?

A: The ncclient Python library, which provides a NETCONF client implementation for initiating NETCONF sessions over SSH.

Q1905. [Python] What are historically the most downloaded packages on PyPI?

A: boto3, urllib3, botocore, requests, setuptools, certifi, charset-normalizer, idna, pip, and python-dateutil are consistently among the top.

Q1906. [Ansible] What happens when run_once is combined with serial?

A: The task runs once per serial batch, not once for the entire play.

Q1907. [Linux] What is mktemp?

A: Creates a temporary file or directory with a unique name. mktemp /tmp/myapp.XXXXXX creates something like /tmp/myapp.a3b4c5. Prevents race conditions in temp file creation.

Q1908. [Python] What is the contextlib.nullcontext() used for?

A: It is a no-op context manager, useful as a stand-in when a context manager is expected but none is needed. Added in Python 3.7.

Q1909. [Python] What is a Python namespace?

A: A mapping from names to objects. Examples: the set of built-in names, global names in a module, and local names in a function. Namespaces are implemented as dictionaries.

Q1910. [Ansible] What is pipelining?

A: An SSH optimization that reduces the number of SSH connections needed by executing multiple operations over a single connection. Set pipelining = True in ansible.cfg.


Batch 192

Q1911. [Ansible] What collection provides Docker modules and connection plugins?

A: community.docker

Q1912. [Linux] What are the cron special strings?

A: @reboot (on startup), @yearly/@annually (Jan 1 midnight), @monthly (1st midnight), @weekly (Sunday midnight), @daily/@midnight, @hourly.

Q1913. [Ansible] What module manages users?

A: user

Q1914. [Ansible] What is delegate_facts: true?

A: When used with delegate_to, it assigns any gathered facts to the delegated host rather than the original target host. Without it, facts from the delegated task go to the inventory host being processed.

Q1915. [Python] What is ParamSpec used for?

A: Introduced in Python 3.10 (PEP 612), it captures the parameter types of a callable, enabling accurate typing of decorators that preserve the wrapped function's signature.

Q1916. [Linux] What happens when you delete a hard link?

A: The inode's link count decreases by one. The file data is only freed when the link count reaches zero AND no process has the file open.

Q1917. [Linux] What is a VLAN?

A: Virtual LAN — a Layer 2 network segmentation technique using 802.1Q tagging. In Linux, created with ip link add link eth0 name eth0.100 type vlan id 100.

Q1918. [Linux] What is proxy ARP?

A: When a router answers ARP requests on behalf of another network, making hosts on different subnets appear to be on the same LAN. Controlled via net.ipv4.conf.all.proxy_arp.

Q1919. [Linux] What is the purpose of /mnt and /media?

A: /mnt is for temporarily mounting filesystems (admin use). /media is for auto-mounted removable media (USB drives, CDs). Desktop environments use /media/username/.

Q1920. [Python] What does sys.getsizeof() return?

A: The size of an object in bytes, including the garbage collector overhead but not the size of objects it references (it is shallow, not deep).


Batch 193

Q1921. [Python] What is the difference between enum.Enum and enum.IntEnum?

A: IntEnum members are also integers and can be compared with plain ints and used anywhere an int is expected. Enum members are not comparable with ints — they can only be compared with other members of the same enum.

Q1922. [Python] What is CWI?

A: Centrum Wiskunde & Informatica (Center for Mathematics and Computer Science) in Amsterdam, the Netherlands. This is where Guido created Python.

Q1923. [Linux] What does printenv do?

A: Prints environment variables. printenv HOME prints just the HOME variable. Unlike env, it doesn't run commands.

Q1924. [Python] What new REPL was introduced in Python 3.13?

A: A new interactive REPL with multi-line editing, color support, and better paste handling, replacing the basic readline-based REPL.

Q1925. [Python] What is asyncio.wait_for() used for?

A: Wrapping a coroutine with a timeout: await asyncio.wait_for(coro, timeout=5.0) raises asyncio.TimeoutError if the coroutine does not complete in time.

Q1926. [Python] What is the difference between functools.lru_cache and functools.cache?

A: functools.cache (added in Python 3.9) is equivalent to lru_cache(maxsize=None) — an unbounded cache with no LRU eviction. It is simpler and slightly faster when you don't need size limits.

Q1927. [Linux] What is the iperf3 tool?

A: A network bandwidth measurement tool. Run iperf3 -s on the server and iperf3 -c server_ip on the client to measure TCP/UDP throughput between two endpoints.

Q1928. [Linux] What is udev?

A: The device manager for the Linux kernel. It dynamically creates/removes device nodes in /dev, handles device events, and applies rules to set permissions, ownership, and create symlinks.

Q1929. [Ansible] What is an ad-hoc command in Ansible?

A: A quick, one-line command executed directly from the CLI without writing a playbook. Used for simple, one-off tasks.

Q1930. [Ansible] How do you implement blue-green deployments with Ansible?

A: Maintain two identical environments (blue/green), deploy to the inactive environment, run health checks, then switch traffic at the load balancer.


Batch 194

Q1931. [Ansible] What timeout does the reboot module use by default?

A: 600 seconds (10 minutes) for the host to become reachable again after reboot.

Q1932. [Linux] What does $$ contain?

A: The process ID (PID) of the current shell. In a script, it's the PID of the script's shell process.

Q1933. [Ansible] What are Ansible Validated Content collections for cloud?

A: Pre-tested, Red Hat-supported collections with curated roles and playbooks that encapsulate industry best practices for cloud automation (e.g., cloud.gcp_ops for Google Cloud). ---

Q1934. [Linux] What does stat show?

A: Detailed file information: size, blocks, device, inode, links, permissions (octal and symbolic), UID/GID, timestamps (access, modify, change, birth).

Q1935. [Linux] What is SSH tunneling (port forwarding)?

A: Local forwarding (-L): forwards a local port to a remote destination through the SSH connection. Remote forwarding (-R): forwards a remote port back to a local destination. Dynamic forwarding (-D): creates a SOCKS proxy.

Q1936. [Ansible] Explain the versioning split that happened at Ansible 2.10. What are the two separate packages?

A: Starting with 2.10, Ansible split into two packages: (1) ansible-core (originally ansible-base), which is the automation engine with minimal built-in content, and (2) the "ansible" community package, which bundles ansible-core with a curated set of community collections.

Q1937. [Python] What is threading.Condition?

A: A synchronization primitive combining a lock with the ability to wait for a condition: condition.wait(), condition.notify(), condition.notify_all().

Q1938. [Ansible] What is the ansible.builtin.raw module?

A: Executes a raw command over SSH without requiring Python on the remote host. Used for bootstrapping Python or managing devices that can't run Python.

Q1939. [Linux] What are the fundamental Linux technologies behind containers?

A: Namespaces (isolation), cgroups (resource limits), overlay/union filesystems (layered images), seccomp (syscall filtering), and capabilities (privilege restriction).

Q1940. [Linux] What is systemd's creator known for?

A: Lennart Poettering, a Red Hat developer, created systemd (2010), PulseAudio, and Avahi. systemd's adoption was controversial, leading to the "systemd wars" in the Linux community.


Batch 195

Q1941. [Python] What is cffi (C Foreign Function Interface)?

A: A third-party library for calling C code from Python. It is more Pythonic than ctypes and is used by PyPy for C extension compatibility.

Q1942. [Ansible] What shift in AAP 2.5 changed how the platform is deployed?

A: AAP 2.5 introduced a containerized installer using Podman, while the traditional RPM-based installer was deprecated, signaling a move toward container-native deployments. --- --- ## 18. Event-Driven Ansible (EDA)

Q1943. [Python] What is itertools.repeat() commonly used with?

A: As a constant argument source for map() and zip(): list(map(pow, range(5), itertools.repeat(2))) gives [0, 1, 4, 9, 16].

Q1944. [Ansible] What has the highest variable precedence?

A: Extra vars (--extra-vars or -e), at level 22.

Q1945. [Linux] What is GRE tunneling?

A: Generic Routing Encapsulation — a tunneling protocol that encapsulates packets inside IP packets. Used for connecting remote networks. Created in Linux with ip tunnel add.

Q1946. [Linux] What is Pacman?

A: The package manager for Arch Linux. Uses .pkg.tar.zst packages and the -S (sync/install), -R (remove), -Q (query), -U (upgrade local) operations. Example: pacman -Syu does a full system upgrade.

Q1947. [Ansible] What is ansible_run_tags and ansible_skip_tags?

A: ansible_run_tags contains the list of tags specified with --tags. ansible_skip_tags contains the list of tags specified with --skip-tags. Both are available to conditionals.

Q1948. [Python] What module was added in Python 3.11 for parsing TOML files?

A: tomllib — a read-only TOML parser in the standard library. For writing TOML, you still need a third-party library like tomli-w. --- ## 9. String Formatting & Text

Q1949. [Ansible] What is the default strategy plugin in Ansible?

A: linear -- it runs each task on all targeted hosts before moving to the next task.

Q1950. [Ansible] Can you use more than one connection plugin per host in a single play?

A: No. Only one connection plugin can be active per host at a time. However, you can use delegate_to with a different connection type for specific tasks.


Batch 196

Q1951. [Python] What is dict.setdefault(key, default)?

A: If key is in the dict, return its value. If not, insert key with default and return default. It is atomic (thread-safe in CPython due to the GIL).

Q1952. [Linux] What are network bonding modes?

A: Mode 0: balance-rr (round-robin). Mode 1: active-backup. Mode 2: balance-xor. Mode 3: broadcast. Mode 4: 802.3ad (LACP). Mode 5: balance-tlb (adaptive transmit load balancing). Mode 6: balance-alb (adaptive load balancing).

Q1953. [Ansible] What is ansible_facts?

A: A dictionary containing all facts gathered about the current host (previously accessed via ansible_* variables). Since Ansible 2.5, the recommended way to access facts is ansible_facts['os_family'] rather than ansible_os_family.

Q1954. [Ansible] What method prefix do v2 callback plugin methods use?

A: v2_ -- for example, v2_runner_on_ok, v2_runner_on_failed, v2_playbook_on_start, v2_runner_on_async_poll.

Q1955. [Linux] What is a Linux kernel LTS release?

A: A Long Term Support kernel receives bug fixes and security patches for 2-6 years, compared to the ~3-month lifecycle of a regular stable release. Greg Kroah-Hartman maintains LTS kernels.

Q1956. [Python] Give a common use case for the walrus operator.

A: In while loops reading input: while (line := input()) != 'quit': process(line). Or in list comprehensions for filtering: [y for x in data if (y := f(x)) > 0].

Q1957. [Python] What is the __aenter__ and __aexit__ protocol?

A: The async context manager protocol, used with async with. __aenter__ is an async method called on entry, __aexit__ on exit.

Q1958. [Ansible] What is the network_cli connection plugin used for?

A: Connecting to network devices (routers, switches, firewalls) over SSH using a persistent CLI session. It loads platform-specific Terminal plugins based on ansible_network_os to handle prompts, privilege escalation, and command execution.

Q1959. [Python] What is __dict__ on a class vs an instance?

A: A class's __dict__ contains its methods and class attributes (as a mappingproxy). An instance's __dict__ contains only its instance attributes.

Q1960. [Ansible] How do you disable fact gathering?

A: Set gather_facts: no in the play definition. This speeds up playbook execution when facts are not needed.


Batch 197

Q1961. [Python] What does pandas.read_csv() do?

A: It reads a CSV file into a DataFrame. It has dozens of parameters for handling different delimiters, encodings, missing values, data types, and more.

Q1962. [Ansible] What is the cloud.terraform collection?

A: An Ansible collection that integrates Terraform CLI operations within Ansible playbooks, allowing management of Terraform-provisioned infrastructure alongside Ansible configuration.

Q1963. [Python] What is asyncio.run() used for?

A: It is the main entry point for running async code from synchronous code. It creates an event loop, runs the coroutine, and closes the loop. Added in Python 3.7.

Q1964. [Python] What is boto3?

A: The official AWS SDK for Python. It provides low-level client interfaces and higher-level resource interfaces for AWS services.

Q1965. [Python] What is the __contains__ method?

A: It implements the in operator: x in obj calls obj.__contains__(x). If not defined, Python falls back to iterating through __iter__.

Q1966. [Python] What is the WAT moment with [] == False?

A: [] == False is False. An empty list is falsy (bool([]) is False), but == compares by value, and a list does not equal a boolean.

Q1967. [Python] Why was pytz problematic?

A: pytz had a non-standard API — you had to use localize() instead of replace() to attach timezones. Using replace() with pytz gave wrong results for DST transitions. zoneinfo uses the standard datetime API.

Q1968. [Linux] What does ${var:-default} do?

A: Returns $var if it is set and non-null, otherwise returns default. Does not assign default to var.

Q1969. [Linux] What is a swap partition vs a swap file?

A: A swap partition is a dedicated partition formatted as swap. A swap file is a regular file on an existing filesystem used as swap. Performance is nearly identical on modern kernels. Swap files are more flexible (can be resized easily).

Q1970. [Linux] What was Shellshock?

A: CVE-2014-6271 — a family of vulnerabilities in GNU Bash that allowed remote code execution through crafted environment variables. It affected CGI scripts, SSH, DHCP clients, and more.


Batch 198

Q1971. [Ansible] What is the ipaddr filter?

A: A network-focused filter from ansible.utils that validates and manipulates IP addresses: {{ '192.168.1.0/24' | ipaddr('network') }}. ---

Q1972. [Python] What does divmod(a, b) return?

A: A tuple (a // b, a % b) — the quotient and remainder. It is more efficient than computing them separately.

Q1973. [Ansible] What is creates parameter in command/shell modules?

A: If the specified file already exists, the task is skipped. Helps enforce idempotency for command tasks.

Q1974. [Linux] What does the cut command do?

A: Extracts sections from lines. -d sets delimiter, -f selects fields: cut -d: -f1,3 /etc/passwd extracts username and UID.

Q1975. [Linux] What is cgroup memory.max in cgroups v2?

A: The hard memory limit for a cgroup. If a process in the cgroup exceeds this, the OOM killer is invoked for that cgroup. Set to max for no limit.

Q1976. [Python] What caused Guido to resign as BDFL?

A: The bitter debate over PEP 572 (the walrus operator :=). Guido was tired of fighting for the PEP and facing personal attacks, so he stepped down in July 2018.

Q1977. [Ansible] What is check_mode: true at the task level?

A: Forces a specific task to run in check mode even when the playbook is run normally. The inverse (check_mode: false) forces a task to run even in check mode.

Q1978. [Ansible] What is the default number of forks?

A: 5.

Q1979. [Linux] What is the loopback address in IPv6?

A: ::1 (equivalent to 127.0.0.1 in IPv4).

Q1980. [Linux] What does sysctl net.ipv4.tcp_fin_timeout control?

A: The time (in seconds) a socket stays in FIN_WAIT2 state. Default is 60. Lowering it frees resources faster on servers with many short-lived connections.


Batch 199

Q1981. [Ansible] What port does Ansible use for SSH by default?

A: Port 22.

Q1982. [Python] What does itertools.accumulate() do?

A: It yields running totals (or running results of any binary function). For example, accumulate([1,2,3,4]) yields 1, 3, 6, 10. You can pass a function like operator.mul for running products.

Q1983. [Linux] What are syslog facilities?

A: Categories for log messages: kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron, authpriv, ftp, local0-local7. Used in rsyslog rules to route messages.

Q1984. [Python] What does enumerate() return?

A: An iterator of (index, element) tuples. It accepts an optional start parameter: enumerate(items, start=1).

Q1985. [Ansible] What are Ansible's default privilege escalation methods?

A: sudo (default), su, pbrun, pfexec, doas, dzdo, ksu, runas (Windows), enable (network), machinectl (systemd).

Q1986. [Linux] What replaced CFS in Linux 6.6?

A: EEVDF (Earliest Eligible Virtual Deadline First), which improves latency fairness by considering both virtual runtime and virtual deadlines, reducing scheduling latency for interactive workloads.

Q1987. [Linux] What is the difference between vmstat si/so and sar -W?

A: Both show swap activity. vmstat si=swap in (pages from swap to RAM), so=swap out (pages from RAM to swap). sar -W shows pswpin/s and pswpout/s. High swap activity indicates memory pressure.

Q1988. [Python] What is io.BytesIO used for?

A: An in-memory binary stream. Useful for working with binary data using file-like APIs without actual files.

Q1989. [Ansible] Can you loop over import_tasks?

A: No. Loops only work with include_tasks. Import is static and cannot be looped.

Q1990. [Python] What major features were added in Python 3.13?

A: Free-threading experimental build (--disable-gil, PEP 703), new interactive REPL with multiline editing and color, PEP 649 deferred annotations (experimental), and an experimental JIT compiler.


Batch 200

Q1991. [Ansible] What is the ansible.builtin.package module?

A: A generic OS package module that automatically selects the appropriate backend (yum, apt, dnf, zypper) based on the target OS.

Q1992. [Linux] What is a zombie process?

A: A process that has finished execution but whose exit status has not yet been read by its parent via wait(). It occupies a slot in the process table (shown as state Z) but consumes no other resources.

Q1993. [Python] What is monkey patching?

A: Dynamically modifying a class or module at runtime. For example, replacing a method on an existing class. It is powerful but can make code hard to debug.

Q1994. [Linux] What does kernel.panic control?

A: Number of seconds the kernel waits before automatically rebooting after a panic. 0 means no auto-reboot (waits for manual intervention).

Q1995. [Linux] What does sync do?

A: Flushes filesystem buffers — writes all modified in-memory data to disk. Important before removing external drives or shutting down.

Q1996. [Python] What is a metaclass?

A: A class whose instances are themselves classes. type is the default metaclass in Python. Metaclasses control class creation and can customize the behavior of class statements.

Q1997. [Python] What is the match statement's __match_args__ attribute used for?

A: It defines the positional pattern matching order for a class. For example, __match_args__ = ('x', 'y') allows case Point(1, 2) instead of requiring case Point(x=1, y=2).

Q1998. [Ansible] What authentication methods does WinRM support?

A: Basic, Certificate, NTLM, Kerberos, and CredSSP. Each has different security characteristics and delegation capabilities.

Q1999. [Ansible] What module creates and manages Podman containers?

A: containers.podman.podman_container --- --- ## 24. CI/CD Integration

Q2000. [Linux] What is zypper?

A: The package manager for SUSE/openSUSE. Supports RPM packages with libsolv dependency resolver, patterns, patches, and repository management.


Batch 201

Q2001. [Linux] What information can you find in /proc/PID/status?

A: Process name, state, TGID, PID, PPid, UID/GID (real, effective, saved, filesystem), memory usage (VmSize, VmRSS, VmSwap), threads, voluntary/involuntary context switches, capabilities, cgroup, and namespace info.

Q2002. [Python] What is math.inf equal to?

A: float('inf'). It represents positive infinity.

Q2003. [Ansible] How are Windows modules different from Linux modules internally?

A: Windows modules are written in PowerShell (not Python) and use the Module Replacer framework instead of Ansiballz. --- --- ## 23. Cloud & Container Automation

Q2004. [Python] What is typing.runtime_checkable used for?

A: It is a decorator for Protocol classes that allows isinstance() checks at runtime.

Q2005. [Ansible] What does ignore_errors: true do?

A: Forces Ansible to continue executing subsequent tasks even if the current task fails.

Q2006. [Linux] What is the purpose of /usr?

A: Secondary hierarchy containing the majority of user applications, libraries, documentation, and shared data. /usr/bin for user commands, /usr/sbin for system admin commands, /usr/lib for libraries, /usr/share for architecture-independent data.

Q2007. [Linux] What is tcpdump?

A: A packet capture tool that displays network packets matching filter expressions. tcpdump -i eth0 port 80 -w capture.pcap captures HTTP traffic to a file. Uses BPF (Berkeley Packet Filter) syntax.

Q2008. [Python] What is __iter__ vs __getitem__ for iteration?

A: Python first tries __iter__ for iteration. If not defined, it falls back to calling __getitem__ with increasing integer indices starting from 0, stopping at IndexError.

Q2009. [Ansible] How does Ansible manage network devices?

A: Using network-specific modules (ios_config, junos_config, eos_config, nxos_config) and connection plugins (network_cli, netconf, httpapi).

Q2010. [Python] What is the WAT moment with hash(-1) and hash(-2) in CPython?

A: hash(-1) == hash(-2) is True. CPython's hash function maps -1 to -2 internally because -1 is used as an error indicator in the C implementation.


Batch 202

Q2011. [Linux] What signal number is SIGHUP?

A: 1. Originally "hangup" — sent when a terminal disconnects. Daemons often repurpose it to trigger config reload.

Q2012. [Python] What is paramiko?

A: A Python library implementing SSHv2. It provides both client and server functionality for SSH connections, file transfers (SFTP), and remote command execution.

Q2013. [Ansible] What is the difference between a playbook and a play?

A: A playbook is a YAML file containing one or more plays. A play is a set of tasks and roles that run on one or more managed hosts within that playbook.

Q2014. [Python] What does datetime.datetime.fromisoformat() parse?

A: ISO 8601 formatted strings. In Python 3.11, it was expanded to handle many more ISO 8601 formats including the Z suffix for UTC.

Q2015. [Linux] What is macvlan?

A: A Linux network driver that allows creating multiple virtual interfaces with distinct MAC addresses on a single physical interface. Each virtual interface gets its own IP and appears as a separate device on the network. Used in container networking.

Q2016. [Ansible] What open-source tool can dramatically speed up Ansible by replacing SSH with a custom Python-based protocol?

A: Mitogen for Ansible. It replaces SSH with a bootstrapped Python interpreter tunnel, reducing the per-task overhead from multiple SSH round-trips to a single connection with multiplexed execution. --- --- ## 3. Inventory

Q2017. [Ansible] What are the two built-in inventory file formats?

A: INI format and YAML format.

Q2018. [Python] What does the __future__ module's annotations import do?

A: from __future__ import annotations makes all annotations lazily evaluated — they are stored as strings instead of being evaluated at definition time (PEP 563).

Q2019. [Linux] What does grep -l do?

A: Prints only the filenames of files containing matches, not the matching lines.

Q2020. [Python] What is a code object in Python?

A: An immutable object containing compiled bytecode, constants, variable names, and metadata for a function or module. Accessed via function.__code__.


Batch 203

Q2021. [Linux] What is the Linux Standard Base (LSB)?

A: A joint ISO/IEC and Linux Foundation project to standardize the internal structure of Linux distributions. It defines package formats, filesystem layout, library interfaces, and commands for binary compatibility.

Q2022. [Linux] What is the lsmod vs /proc/modules relationship?

A: lsmod is a formatted reader of /proc/modules. Both show loaded kernel modules with size and dependency (used-by) information. modinfo module_name shows detailed module information.

Q2023. [Linux] What is /dev/zero?

A: A special device that produces an infinite stream of null bytes (0x00) on read. Used to create empty files or zero-fill disks: dd if=/dev/zero of=file bs=1M count=100.

Q2024. [Python] What is conftest.py in pytest?

A: A special file where you define fixtures, hooks, and plugins that are automatically available to all tests in the same directory and subdirectories. No import needed.

Q2025. [Python] What is Jinja2?

A: A template engine for Python used by Flask, Ansible, and many other tools. It supports template inheritance, macros, filters, and auto-escaping.

Q2026. [Ansible] What are tags used for?

A: Selective execution of tasks, roles, or plays. Run only tagged items with --tags or skip them with --skip-tags.

Q2027. [Linux] How do you create an LVM logical volume?

A: pvcreate /dev/sdbvgcreate myvg /dev/sdblvcreate -L 10G -n mylv myvgmkfs.xfs /dev/myvg/mylv.

Q2028. [Linux] What is the loopback interface?

A: lo — a virtual network interface with address 127.0.0.1/8 (IPv4) and ::1/128 (IPv6). Traffic sent to it never leaves the host; used for inter-process communication and testing. --- ## 8. Package Management

Q2029. [Python] What is __del__ used for?

A: It is a finalizer called when an object is about to be garbage collected. It is unreliable for cleanup because you cannot predict when (or if) it will be called. Use context managers instead.

Q2030. [Linux] What is SIGPIPE?

A: Signal 13, sent when a process writes to a pipe with no readers. Default action is termination. Many applications ignore it and check write return values instead.


Batch 204

Q2031. [Python] What does the __iter__ method return?

A: An iterator object (which must implement __next__). If a class defines __iter__ and __next__, its instances are iterators. If it only defines __iter__, it is iterable.

Q2032. [Linux] What is a softirq?

A: A deferred interrupt handling mechanism in the kernel. Hardware interrupts (hardirqs) run minimal code quickly, then schedule softirqs to do the heavier processing. Network packet processing and block I/O completion use softirqs.

Q2033. [Ansible] A playbook fails to decrypt Vault data. What do you check?

A: Verify the vault password is correct, check the file path, ensure the correct Vault ID is specified, verify the file was encrypted with the expected password. --- Total: 300+ Q&A pairs covering Ansible core concepts, architecture, configuration, modules, plugins, Galaxy/Collections, Vault, Tower/AWX, facts/variables, Jinja2, best practices, networking, cloud, CI/CD, performance, security, testing, and history/trivia. --- ## 27. Quick-Fire Trivia & Rapid Recall

Q2034. [Ansible] How are facts gathered?

A: By the setup module, which runs automatically at the start of each play (unless gather_facts: no is set).

Q2035. [Linux] What is /etc/cron.d/?

A: A directory for drop-in cron files using the same format as /etc/crontab (with user field). Packages can install cron jobs here without modifying the system crontab.

Q2036. [Python] What is isort?

A: A tool that automatically sorts Python imports alphabetically and separates them into sections (stdlib, third-party, local). Now largely superseded by ruff.

Q2037. [Linux] What is AIDE?

A: Advanced Intrusion Detection Environment — a file integrity monitoring tool that creates a database of file checksums and attributes, then periodically checks for unauthorized changes. Similar to Tripwire.

Q2038. [Python] What is time.monotonic()?

A: A clock that cannot go backwards, even if system time is adjusted. Useful for measuring elapsed time.

Q2039. [Ansible] Can you write custom Ansible modules?

A: Yes, write Python scripts using AnsibleModule from ansible.module_utils.basic, define argument specs, implement logic, and place in a library/ directory.

Q2040. [Ansible] What is the ungrouped group?

A: A special built-in group containing hosts that are not members of any other group.


Batch 205

Q2041. [Linux] What is coredumpctl?

A: A systemd tool for managing core dumps stored by systemd-coredump. coredumpctl list shows recent crashes. coredumpctl debug PID opens the core dump in gdb.

Q2042. [Python] What is the PEP process for proposing language changes?

A: Write a PEP draft, submit it, get a PEP editor to assign a number, discuss it on Python-Dev/Discourse, revise based on feedback, and the Steering Council (or a delegate) accepts, rejects, or defers it.

Q2043. [Python] What does Counter.most_common(n) return?

A: A list of the n most common elements and their counts, as (element, count) tuples, sorted from most common to least.

Q2044. [Ansible] What does the debug module do?

A: Prints variable values or custom messages during playbook execution. Useful for troubleshooting.

Q2045. [Linux] What does the init= kernel parameter do?

A: It overrides the default init process. For example, init=/bin/bash boots directly into a root shell without running systemd, useful for emergency recovery.

Q2046. [Ansible] How does Ansible interact with Docker?

A: Using community.docker collection modules (docker_container, docker_image, docker_network, docker_compose).

Q2047. [Python] What is the difference between re.search() and re.fullmatch()?

A: re.search() finds a match anywhere in the string. re.fullmatch() (added in Python 3.4) requires the entire string to match the pattern.

Q2048. [Python] What is a context manager protocol?

A: Any object that implements __enter__ and __exit__ methods. __enter__ is called at the start of a with block, and __exit__ is called at the end.

Q2049. [Ansible] What is the argument_spec in a custom module?

A: A dictionary defining all supported module parameters, their types, defaults, required status, choices, mutually_exclusive groups, and other validation constraints.

Q2050. [Linux] What signal number is SIGKILL?

A: 9. Immediately terminates a process. Cannot be caught, blocked, or ignored.


Batch 206

Q2051. [Ansible] How do you select a specific lint profile on the command line?

A: ansible-lint --profile production playbook.yml

Q2052. [Ansible] What is the most downloaded Ansible Galaxy role author namespace?

A: geerlingguy -- Jeff Geerling's roles collectively have hundreds of millions of downloads, with roles like geerlingguy.docker, geerlingguy.java, geerlingguy.apache, and geerlingguy.nginx being among the most popular on Galaxy.

Q2053. [Linux] What are the three SELinux modes?

A: enforcing: policies are enforced, violations are blocked and logged. permissive: violations are logged but not blocked (useful for debugging). disabled: SELinux is completely off.

Q2054. [Linux] What is the advantage of AppArmor's path-based approach?

A: Much simpler to understand and write profiles — rules use familiar filesystem paths. No need to manage labeling or relabeling. Easier adoption curve for administrators.

Q2055. [Ansible] What is inventory_hostname vs ansible_hostname?

A: inventory_hostname is the name of the host as defined in the inventory file. ansible_hostname is the actual hostname discovered from the remote system via fact gathering.

Q2056. [Python] What is Black?

A: An opinionated Python code formatter that enforces a consistent style with minimal configuration. Its motto is "the uncompromising code formatter."

Q2057. [Ansible] How does Ansible differ from Puppet?

A: Ansible is agentless (push-based, YAML syntax) while Puppet is agent-based (pull-based, uses its own DSL). Ansible is simpler to set up; Puppet is more mature for large-scale, complex environments.

Q2058. [Ansible] What other connection optimizations exist beyond Mitogen?

A: Enable pipelining = True in ansible.cfg (reduces SSH operations), increase forks for parallelism, configure SSH ControlPersist to keep connections open, and use fact caching to avoid repeated gathering.

Q2059. [Python] What is the walrus operator's PEP number?

A: PEP 572 — "Assignment Expressions."

Q2060. [Ansible] What collection provides AWS modules?

A: amazon.aws for core AWS modules, and community.aws for community-contributed modules.


Batch 207

Q2061. [Ansible] What is the relationship between Ansible Tower and Automation Controller?

A: Automation Controller is the rebranded name for Ansible Tower, starting with AAP 2.x. The underlying technology (AWX upstream) remains the same, but "Tower" branding was retired in favor of "Automation Controller."

Q2062. [Python] What is __getattr__ vs __getattribute__?

A: __getattribute__ is called for every attribute access. __getattr__ is only called when normal attribute lookup fails. Overriding __getattribute__ is risky and can easily cause infinite recursion.

Q2063. [Ansible] What is provisioning?

A: The process of setting up new servers and infrastructure. Ansible can automate the creation and initial configuration of systems.

Q2064. [Ansible] What is the ansible.cfg search order (precedence)?

A: 1) ANSIBLE_CONFIG environment variable, 2) ./ansible.cfg (current directory), 3) ~/.ansible.cfg (home directory), 4) /etc/ansible/ansible.cfg (global). First found wins.

Q2065. [Python] What does the abc.abstractmethod decorator do?

A: It marks a method as abstract, preventing the class from being instantiated unless the method is overridden. The containing class must inherit from ABC or use ABCMeta.

Q2066. [Linux] What does which do?

A: Shows the full path of a command by searching PATH. which python3 might show /usr/bin/python3.

Q2067. [Python] What did Python 2.7 introduce?

A: The final Python 2 release. It added set literals {1, 2, 3}, dict comprehensions, OrderedDict, Counter, and the argparse module.

Q2068. [Python] What does json.dumps(obj, default=str) do?

A: It serializes obj to JSON, using str() as a fallback for objects that are not JSON-serializable. This is a common trick for handling datetime objects.

Q2069. [Ansible] What was the first AnsibleFest, and when did it take place?

A: The first AnsibleFest was held in 2013 in the early days of the Ansible community, organized by AnsibleWorks (later Ansible, Inc.) to bring together early adopters.

Q2070. [Python] What does hash(-1) return in CPython?

A: -2. CPython's C-level hash function uses -1 as an error indicator, so it maps the hash value -1 to -2.


Batch 208

Q2071. [Linux] What is SNI (Server Name Indication)?

A: A TLS extension that allows the client to indicate the hostname it's connecting to during the TLS handshake. Enables multiple HTTPS sites on the same IP address. Without SNI, one IP = one SSL certificate.

Q2072. [Ansible] What is the psrp connection plugin, and how does it differ from winrm?

A: PSRP (PowerShell Remoting Protocol) is an alternative to WinRM for managing Windows hosts. It uses the same underlying protocol but is implemented in Python using the pypsrp library, offering better performance and more reliable stream handling than the winrm plugin.

Q2073. [Python] What is the difference between list.copy() and list[:]?

A: They both create a shallow copy. list.copy() was added in Python 3.3 and is more readable. list[:] uses slice syntax for the same effect.

Q2074. [Linux] What does exit code 2 mean?

A: Misuse of shell command or built-in, such as invalid options or missing required arguments.

Q2075. [Linux] What does the sort command do?

A: Sorts lines. Key flags: -n numeric sort, -r reverse, -k sort by field, -u unique, -t field separator, -h human-readable numbers, -V version sort.

Q2076. [Linux] What does grep -c do?

A: Prints only the count of matching lines per file.

Q2077. [Python] What is scikit-learn?

A: The most widely used Python machine learning library, providing consistent APIs for classification, regression, clustering, dimensionality reduction, model selection, and preprocessing.

Q2078. [Ansible] What is ansible_port?

A: An inventory variable that specifies the SSH port to use for connecting to the host.

Q2079. [Ansible] What is the auto inventory plugin?

A: A meta-plugin that automatically detects and delegates to the correct inventory plugin based on the inventory source file name or content. For example, a file ending in aws_ec2.yml triggers the aws_ec2 plugin.

Q2080. [Linux] What is lynis?

A: An open-source security auditing tool that scans Linux systems for security issues, configuration problems, and hardening opportunities. Generates a hardening index and actionable recommendations.


Batch 209

Q2081. [Linux] What is LUKS?

A: Linux Unified Key Setup — the standard for Linux disk encryption. It stores encryption metadata in a header on the partition and supports multiple key slots (up to 8). Uses dm-crypt as the kernel-level encryption layer.

Q2082. [Linux] What is the purpose of /home?

A: User home directories. Each user typically has /home/username/. Root's home is /root.

Q2083. [Python] What is itertools.product with the repeat parameter?

A: It computes the Cartesian product of an iterable with itself: product('AB', repeat=2) is equivalent to product('AB', 'AB').

Q2084. [Ansible] Why do Execution Environments exist when Python virtual environments (venvs) already exist?

A: Virtual environments only isolate Python packages. They cannot bundle system-level tools like openssh-clients, vendor CLI utilities, or non-Python dependencies. EEs wrap everything into a container so the runtime is identical everywhere it executes.

Q2085. [Ansible] What is include_tasks vs import_tasks?

A: include_tasks is dynamic (processed at runtime, supports conditionals and loops). import_tasks is static (processed at parse time, no runtime conditionals but better for pre-validation). ---

Q2086. [Ansible] How do you run a playbook that uses vault-encrypted files?

A: ansible-playbook playbook.yml --ask-vault-pass (interactive) or --vault-password-file /path/to/password-file (automated).

Q2087. [Python] What is pre-commit?

A: A framework for managing and running git pre-commit hooks. It can run linters, formatters, and other checks automatically before each commit. --- ## 15. Testing

Q2088. [Ansible] Why don't Juniper Junos Ansible modules require Python on the device?

A: They use Junos PyEZ and the Junos XML API over NETCONF to interface with the device, all executed from the control node.

Q2089. [Linux] What is port 514 used for?

A: UDP 514 = syslog (traditional). TCP 514 = RSH (remote shell, deprecated). rsyslog can use TCP 514 for reliable log transport.

Q2090. [Linux] What is the bmon tool?

A: A real-time bandwidth monitor that shows per-interface traffic rates and statistics in a terminal-based UI. Simpler alternative to iftop for quick bandwidth monitoring.


Batch 210

Q2091. [Python] What is decimal.Decimal vs float for financial calculations?

A: Decimal provides exact decimal arithmetic without floating-point rounding errors, making it essential for financial calculations where exactness matters.

Q2092. [Linux] What is CAP_NET_BIND_SERVICE?

A: A capability allowing a process to bind to ports below 1024 without running as root.

Q2093. [Linux] What operating system inspired Linus to write Linux?

A: MINIX, a small Unix-like teaching OS written by Andrew S. Tanenbaum for his textbook "Operating Systems: Design and Implementation."

Q2094. [Ansible] What is the ansible_ssh_common_args variable used for?

A: Adds extra SSH arguments to ALL SSH-based connection types (ssh, sftp, scp). Common use: adding -o ProxyCommand for bastion/jump host configurations.

Q2095. [Ansible] What command initializes a new role skeleton?

A: ansible-galaxy role init my_role_name

Q2096. [Ansible] How do you implement RBAC in Ansible Tower?

A: Create users and teams, assign roles (Admin, User, Auditor) at global or object level, and set permissions on projects, inventories, job templates, and credentials.

Q2097. [Linux] What UID is reserved for root?

A: UID 0. Any account with UID 0 has full superuser privileges.

Q2098. [Linux] What is the difference between ps aux and ps -ef?

A: ps aux is BSD-style showing USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND. ps -ef is POSIX-style showing UID, PID, PPID, C, STIME, TTY, TIME, CMD. Both show all processes; different column layouts.

Q2099. [Linux] What does systemctl daemon-reload do?

A: Reloads systemd's configuration — required after modifying unit files. It does NOT restart any services; it just re-reads the files.

Q2100. [Ansible] What does changed_when do?

A: Overrides when Ansible considers a task as "changed." Useful for command/shell tasks where you want to control change reporting: changed_when: result.rc != 0


Batch 211

Q2101. [Ansible] How would you apply BGP configuration across 100 routers with minimum downtime?

A: Use ios_config module, implement serial batching (serial: 5), verify with --check mode, validate BGP status with ios_command after each batch.

Q2102. [Ansible] What format does a dynamic inventory script return?

A: JSON with host and group data, following a specific schema that Ansible expects. ---

Q2103. [Linux] What is timedatectl?

A: Manages system time, timezone, and NTP synchronization on systemd systems. timedatectl set-timezone America/New_York. timedatectl set-ntp true enables time synchronization.

Q2104. [Linux] What does "ping" stand for?

A: Named after sonar ping sounds. Sends ICMP echo request packets and measures round-trip time.

Q2105. [Python] What does dict | other_dict do in Python 3.9+?

A: It creates a new dict with merged key-value pairs. Values from other_dict override those in dict for shared keys. |= does the merge in-place.

Q2106. [Python] What does sys.getrecursionlimit() return?

A: The current recursion limit. The default is 1000 on most platforms.

Q2107. [Ansible] What rule does no-changed-when enforce?

A: Tasks using command, shell, raw, or script modules must include a changed_when condition to prevent always reporting "changed."

Q2108. [Linux] What is the difference between adduser and useradd?

A: useradd is the low-level binary that creates users. adduser (on Debian) is a friendly wrapper script that interactively sets password, creates home directory, and copies skeleton. On RHEL, adduser is a symlink to useradd.

Q2109. [Ansible] What is the cli_parse module used for?

A: Parsing unstructured CLI output from network devices into structured data using parsers like TextFSM, TTP, xmltodict, or pyATS.

Q2110. [Ansible] What is the lookup plugin?

A: Retrieves data from external sources at the control node level. Example: {{ lookup('file', '/path/to/file') }}


Batch 212

Q2111. [Linux] What does iostat show?

A: CPU utilization and device I/O statistics: tps (transfers/sec), read/write bandwidth, average queue size, await (latency), and utilization. Part of the sysstat package.

Q2112. [Python] What is enum.unique used for?

A: It is a decorator that ensures no two enum members have the same value. Without it, duplicate values create aliases to the first member with that value.

Q2113. [Python] What does object.__repr__ return by default?

A: Something like <ClassName object at 0x7f...> — the class name and memory address.

Q2114. [Python] What does itertools.dropwhile(predicate, iterable) do?

A: It drops elements from the beginning of the iterable as long as the predicate is true, then yields all remaining elements (even if the predicate becomes true again later).

Q2115. [Linux] What is the column command useful for?

A: Formats input into aligned columns: mount | column -t produces a neatly formatted table.

Q2116. [Linux] What is a Unix domain socket?

A: A socket for inter-process communication on the same host, using a filesystem path instead of IP:port. Faster than TCP loopback because it bypasses the network stack. Used by Docker, MySQL, PostgreSQL, and systemd.

Q2117. [Ansible] What does any_errors_fatal: true do at the play level?

A: Causes any task failure on any host to immediately abort the entire play for all hosts.

Q2118. [Linux] Where are traditional log files stored?

A: /var/log/. Key files: messages or syslog (general), auth.log or secure (authentication), kern.log (kernel), dmesg (kernel ring buffer), boot.log (boot messages).

Q2119. [Linux] What is port 80 used for?

A: HTTP (Hypertext Transfer Protocol) — unencrypted web traffic.

Q2120. [Linux] What is the TLB?

A: Translation Lookaside Buffer — a CPU cache for recent virtual-to-physical address translations. TLB misses require expensive page table walks, so TLB efficiency is critical for performance.


Batch 213

Q2121. [Python] What is asyncio.sleep() vs time.sleep()?

A: asyncio.sleep() is non-blocking — it yields control back to the event loop. time.sleep() blocks the entire thread, including the event loop.

Q2122. [Python] What is CPython's memory allocator?

A: CPython uses a custom memory allocator called pymalloc for small objects (up to 512 bytes). It uses memory pools and arenas to reduce fragmentation and improve performance.

Q2123. [Ansible] What is the converge step in Molecule?

A: It runs the role or playbook under test against the test instance. It is the core "apply the automation" step.

Q2124. [Python] What does typing.Protocol do?

A: Introduced in Python 3.8 (PEP 544), it enables structural subtyping (duck typing for type checkers). A class satisfies a Protocol if it has the required methods/attributes, without explicitly inheriting from it.

Q2125. [Linux] What is kernel.org?

A: The primary distribution point for Linux kernel source code, maintained by the Linux Kernel Organization. It hosts stable, mainline, longterm, and next kernel trees.

Q2126. [Ansible] How is set_fact different from vars?

A: set_fact creates variables dynamically at runtime after on-the-fly processing/filtering. vars defines variables with predetermined values before execution.

Q2127. [Python] Which standard library module provides a min-heap implementation?

A: The heapq module. Python's heapq only implements a min-heap natively; for a max-heap you negate values or use a wrapper.

Q2128. [Linux] What is the GRUB_CMDLINE_LINUX variable?

A: A setting in /etc/default/grub that specifies kernel parameters added to every boot entry when grub2-mkconfig regenerates grub.cfg.

Q2129. [Ansible] What Ansible community package version corresponds to ansible-core 2.14?

A: Ansible 7.x ships with ansible-core 2.14.

Q2130. [Ansible] What is the difference between include_tasks and import_tasks?

A: import_tasks is static -- processed at playbook parse time, so variables in filenames must be static. include_tasks is dynamic -- processed at runtime, supporting dynamic filenames, loops, and conditionals. Tags and task attributes behave differently between them.


Batch 214

Q2131. [Linux] What is KVM?

A: Kernel-based Virtual Machine — a Linux kernel module that turns Linux into a Type-1 hypervisor. It uses hardware virtualization extensions (Intel VT-x, AMD-V) and works with QEMU for device emulation.

Q2132. [Linux] What is lsblk?

A: Lists block devices in a tree format showing name, size, type (disk, partition, lvm), mountpoint, and other attributes. lsblk -f adds filesystem and UUID info.

Q2133. [Linux] What is the typical UID range for system accounts vs regular users?

A: System accounts: 1-999 (or 1-499 on older systems). Regular users: 1000+ (or 500+ on older systems). Defined in /etc/login.defs.

Q2134. [Python] What was the original name of pip?

A: pip is a recursive acronym: "pip installs packages" (originally "pip installs Python"). It replaced easy_install from setuptools.

Q2135. [Python] What is Fabric?

A: A library for executing shell commands remotely over SSH. Built on top of paramiko and Invoke, it is commonly used for deployment automation.

Q2136. [Ansible] What is orchestration in Ansible?

A: Coordinating multiple systems and tasks together in a specific order to achieve complex multi-tier deployments.

Q2137. [Ansible] What is any_errors_fatal and when would you use it?

A: When set to true at the play level, if ANY host fails a task, all hosts in the play are immediately marked as failed and execution stops. Useful for critical tasks where partial success is dangerous (e.g., database migrations). --- ## 9. Handlers

Q2138. [Ansible] What is a Workflow in Tower/AWX?

A: A chain of job templates linked by success/failure/always conditions, enabling multi-step automation pipelines.

Q2139. [Linux] What does lsof do?

A: Lists open files — including regular files, directories, sockets, pipes, and devices. lsof -i :80 shows what's using port 80. lsof +D /var/log shows processes with files open in that directory.

Q2140. [Python] What does sys.getsizeof(1) return approximately?

A: About 28 bytes on a 64-bit system. Even small integers have significant overhead due to the object header.


Batch 215

Q2141. [Python] What is a mappingproxy?

A: A read-only view of a dictionary, used for class __dict__ to prevent accidental modification of the class namespace through the dict interface.

Q2142. [Python] What is subprocess.Popen vs subprocess.run?

A: run() is a high-level convenience function that waits for completion. Popen is the low-level class for more control: non-blocking execution, streaming I/O, and process management.

Q2143. [Python] What method makes an object callable?

A: __call__. If a class defines __call__, its instances can be called like functions: obj().

Q2144. [Ansible] What is the obscure ANSIBLE_FORCE_COLOR environment variable?

A: Forces colored output even when Ansible detects it's not running in a terminal (e.g., in CI/CD pipelines). Useful for readable CI logs.

Q2145. [Ansible] What is until / retries / delay in a task?

A: Retry loop configuration. until specifies the success condition, retries is the max attempts (default 3), and delay is seconds between retries. Example: poll an API until it returns healthy.

Q2146. [Linux] What was the "SCO vs IBM" lawsuit?

A: SCO Group sued IBM in 2003 claiming IBM contributed SCO's proprietary Unix code to Linux. The case dragged on for years, threatening Linux adoption. SCO ultimately lost and went bankrupt in 2007. The case was significant for validating Linux's legal standing.

Q2147. [Ansible] What Python and Java versions does ansible-rulebook require?

A: Python 3.8+ and Java 17 (OpenJDK).

Q2148. [Linux] What is /proc/PID/cmdline?

A: Contains the command and arguments used to start the process, with arguments separated by null bytes. --- ## 5. File Systems & Storage

Q2149. [Linux] What is epoll in Linux?

A: A scalable I/O event notification mechanism that efficiently monitors large numbers of file descriptors (sockets). Used by high-performance servers (nginx, Node.js). Superior to select and poll for many concurrent connections.

Q2150. [Ansible] What year was Ansible Lightspeed announced?

A: 2023, with integration into AAP and the VS Code Ansible extension.


Batch 216

Q2151. [Ansible] What does force_handlers: yes do?

A: Forces handlers to run even if a task fails, ensuring cleanup actions still execute.

Q2152. [Ansible] What does --tags tagged mean?

A: Run only tasks that have at least one tag (skip all untagged tasks). The never tag still overrides -- tagged tasks with never won't run.

Q2153. [Linux] How does Ubuntu version numbering work?

A: Ubuntu uses YY.MM format — e.g., 24.04 was released in April 2024. LTS (Long Term Support) releases come every two years in April (even years) and are supported for five years.

Q2154. [Python] What is PyPy and why is it significant?

A: A Python implementation with a Just-In-Time (JIT) compiler that can be 4-10x faster than CPython for long-running programs. It is written in RPython (a restricted subset of Python).

Q2155. [Linux] What is GRUB2?

A: GRand Unified Bootloader version 2 — the default bootloader for most Linux distributions. It supports multiple OSes, filesystems, UEFI, and offers a rescue shell.

Q2156. [Linux] What is ICMP?

A: Internet Control Message Protocol — used for error reporting and diagnostics (ping, traceroute, destination unreachable, TTL exceeded). Not a transport protocol — it operates at the network layer.

Q2157. [Linux] What is WireGuard?

A: A modern VPN protocol integrated into the Linux kernel since 5.6. Faster, simpler, and more secure than IPsec and OpenVPN. Uses Curve25519, ChaCha20, and Poly1305 cryptography.

Q2158. [Python] What is the "six" library?

A: A Python 2/3 compatibility library by Benjamin Peterson, named because 2 x 3 = 6. It provided utilities to write code that worked on both Python 2 and 3 during the long migration.

Q2159. [Linux] What is a FIFO (named pipe)?

A: A special file that allows inter-process communication. Created with mkfifo. One process writes, another reads. Data flows through the kernel buffer, not the filesystem.

Q2160. [Ansible] How does a custom module return data to Ansible?

A: By calling module.exit_json(**result) for success or module.fail_json(msg="error message", **result) for failure. These methods print JSON to stdout and exit.


Batch 217

Q2161. [Python] Does Python intern strings?

A: CPython interns some strings automatically (like identifiers and string literals that look like identifiers). You can also explicitly intern with sys.intern(). Interning allows is comparison instead of == for speed.

Q2162. [Ansible] How many modules were in the monolithic Ansible 2.9 repository before the split?

A: Over 3,400 modules lived in the single ansible/ansible repository before the collections migration.

Q2163. [Linux] How do you check why a service failed?

A: systemctl status <service> shows recent log output and the exit code. journalctl -u <service> -b --no-pager shows full logs for the current boot. --- ## 12. Security

Q2164. [Linux] What is /etc/motd?

A: "Message of the Day" — displayed to users after login. Can be static (file content) or dynamic (generated by scripts in /etc/update-motd.d/ on Ubuntu).

Q2165. [Python] What is Django's ORM?

A: An Object-Relational Mapper that lets you define database models as Python classes and query databases using Python code instead of raw SQL.

Q2166. [Ansible] If you specify both --tags and --skip-tags for the same tag, what happens?

A: --skip-tags takes precedence. For example, --tags tag1,tag3 --skip-tags tag3 runs only tag1 tasks.

Q2167. [Ansible] How do you configure a dynamic inventory for AWS EC2?

A: Install boto/boto3, configure AWS credentials, create an aws_ec2.yml inventory plugin configuration file, and reference it with the -i flag.

Q2168. [Ansible] Can you set strategy globally?

A: Yes, via DEFAULT_STRATEGY in ansible.cfg or the ANSIBLE_STRATEGY environment variable. ---

Q2169. [Ansible] What is pipelining in Ansible's SSH configuration?

A: When enabled (pipelining = True in ansible.cfg), Ansible sends the module code and execution instructions in a single SSH session instead of multiple steps (copy module, execute, clean up). It reduces SSH round-trips but requires requiretty to be disabled in sudoers on the target.

Q2170. [Ansible] What is the ansible.windows collection?

A: The official collection containing Windows-specific modules like win_copy, win_file, win_service, win_user, win_group, win_regedit, win_shell, win_command, win_dsc, etc.


Batch 218

Q2171. [Ansible] What types of errors do NOT trigger rescue blocks?

A: Errors caused by invalid task definitions (syntax errors) and unreachable hosts.

Q2172. [Ansible] What module would you use to wait for a port to become available?

A: wait_for -- can wait for a port, file, or regex match in a file. Common use: wait_for: port=8080 delay=5 timeout=300.

Q2173. [Ansible] What is the ansible_host variable?

A: The connection address for a host, allowing the inventory name to differ from the actual hostname/IP used for SSH.

Q2174. [Linux] What command reloads udev rules without rebooting?

A: udevadm control --reload-rules && udevadm trigger.

Q2175. [Python] What is the __init__.py file for?

A: It marks a directory as a Python package. It can be empty or contain initialization code. Since Python 3.3, namespace packages allow packages without __init__.py.

Q2176. [Linux] What is containerd?

A: An industry-standard container runtime that manages the container lifecycle (image pull, storage, execution, networking). Docker uses containerd internally; Kubernetes can use it directly via CRI.

Q2177. [Python] Where has Guido van Rossum worked?

A: CWI Amsterdam (1980s-1995), CNRI (1995-2000), BeOpen (2000), Zope/Digital Creations (2001-2003), Elemental Security (2003-2005), Google (2005-2012), Dropbox (2013-2019), retired briefly, then Microsoft (2020-present).

Q2178. [Linux] What is find -print0?

A: Outputs filenames separated by null bytes instead of newlines, safely handling filenames with spaces and special characters. Used with xargs -0.

Q2179. [Ansible] What is the forks setting, and what is its default value?

A: forks controls how many hosts Ansible connects to in parallel. The default is 5. Increasing this number can dramatically speed up playbook execution across large inventories.

Q2180. [Linux] How do you define a Bash associative array?

A: declare -A map; map[key1]=val1; map[key2]=val2. Access: ${map[key1]}. All keys: ${!map[@]}.


Batch 219

Q2181. [Python] What major feature did Python 3.12 change regarding f-strings?

A: F-strings were completely reformulated with a new parser, removing many previous limitations. They can now contain any valid Python expression, including nested f-strings and backslashes.

Q2182. [Linux] How do you rebuild an RPM package?

A: Use rpmbuild with a .spec file. The spec defines sources, build steps, dependencies, and file lists. Build with rpmbuild -ba package.spec.

Q2183. [Ansible] What is register and what does the registered variable contain?

A: register captures a task's return data into a variable. The variable contains: changed, failed, rc (return code), stdout, stderr, stdout_lines, stderr_lines, msg, and module-specific keys.

Q2184. [Python] What does collections.Counter return when you access a key that doesn't exist?

A: It returns 0 (not a KeyError), because Counter is a subclass of dict that overrides __missing__ to return zero.

Q2185. [Ansible] What is the register keyword?

A: Captures the output of a task into a variable for use in subsequent tasks. Enables conditional logic based on previous task results.

Q2186. [Python] What is a __fspath__ method?

A: Added in Python 3.6, it allows objects to represent filesystem paths. os.fspath() calls it. pathlib.Path implements it.

Q2187. [Linux] What does grep stand for?

A: "Global Regular Expression Print" — from the ed command g/re/p.

Q2188. [Linux] What is the host command?

A: Simple DNS lookup tool: host example.com returns A records. host -t MX example.com queries MX records. Simpler output than dig, good for quick lookups.

Q2189. [Python] What is the fractions.Fraction.limit_denominator() method?

A: It finds the closest rational approximation with a denominator at most max_denominator: Fraction(3.141592653).limit_denominator(100) gives Fraction(311, 99).

Q2190. [Python] What is the numbers module?

A: It defines abstract base classes for numeric types: Number, Complex, Real, Rational, Integral. It forms a numeric tower for type checking. --- ## 11. Memory Management & Internals


Batch 220

Q2191. [Linux] What is ldd?

A: Lists shared library dependencies of an executable: ldd /bin/ls. Shows which .so files are needed and where they resolve to. Note: do not use ldd on untrusted binaries — it may execute them.

Q2192. [Ansible] Does poll: 0 automatically clean up the async job cache file?

A: No. You must manually clean up using async_status with mode: cleanup.

Q2193. [Python] What is the difference between a list comprehension and a generator expression?

A: A list comprehension [x for x in items] creates the entire list in memory. A generator expression (x for x in items) produces values lazily, one at a time, using much less memory for large sequences.

Q2194. [Python] What does functools.reduce do?

A: It applies a two-argument function cumulatively to the items of an iterable, reducing it to a single value. For example, reduce(operator.add, [1,2,3,4]) returns 10.

Q2195. [Ansible] Where did the Ansible community move after leaving IRC?

A: The community moved to the Ansible Forum (forum.ansible.com) based on Discourse, and Matrix for real-time chat (replacing IRC on Libera.Chat).

Q2196. [Linux] What does /proc/loadavg contain?

A: Five fields: 1-minute load, 5-minute load, 15-minute load, running/total processes, last PID assigned.

Q2197. [Linux] What is iowait in CPU statistics?

A: The percentage of time the CPU is idle while the system has outstanding I/O requests. High iowait suggests I/O bottleneck but can be misleading — it's measured per CPU and only when the CPU would otherwise be idle.

Q2198. [Ansible] What are connection plugins?

A: Control how Ansible connects to managed nodes. Examples: ssh, winrm, local, docker, network_cli.

Q2199. [Python] What is the difference between combinations and combinations_with_replacement?

A: combinations does not allow repeated elements, while combinations_with_replacement does. For example, combinations_with_replacement('AB', 2) yields ('A','A'), ('A','B'), ('B','B').

Q2200. [Linux] What does fuser do?

A: Identifies processes using files or sockets: fuser -v /var/log/syslog shows who has the file open. fuser -k 8080/tcp kills the process using that port.


Batch 221

Q2201. [Linux] What does "PTY" stand for?

A: Pseudo-TeletYpe — a pair of virtual devices (master/slave) used by terminal emulators and SSH. The master side is the emulator; the slave side (/dev/pts/N) is what the shell sees.

Q2202. [Ansible] How do you install a role from Galaxy?

A: ansible-galaxy install username.role_name

Q2203. [Ansible] What does the gather_facts: false optimization do?

A: It skips the automatic fact-gathering step at the beginning of a play. If your play doesn't use any host facts, this saves the time of running the setup module on every host (which can be significant with hundreds of hosts).

Q2204. [Linux] What is the difference between DAC and MAC?

A: DAC (Discretionary Access Control): file owners set permissions (traditional chmod). MAC (Mandatory Access Control): system-wide policy enforced regardless of ownership (SELinux, AppArmor). MAC overrides DAC.

Q2205. [Ansible] What is ansible-builder?

A: A tool that creates Execution Environment container images from a definition file (execution-environment.yml) that specifies Python requirements, system packages, collections, and the base image.

Q2206. [Linux] What is ftrace?

A: The kernel's built-in function tracer, accessible via /sys/kernel/debug/tracing/. It can trace function calls, measure latencies, and generate call graphs. Backends include function tracer, function_graph, and various event tracers.

Q2207. [Python] What is the with statement's full syntax since Python 3.1?

A: Multiple context managers in one statement: with open('a') as f1, open('b') as f2:. Python 3.10 also allows parenthesized multi-line form.

Q2208. [Ansible] What is the difference between vars, vars_files, and vars_prompt?

A: vars declares variables inline in a play. vars_files references separate YAML files containing variables. vars_prompt prompts the user for input during execution.

Q2209. [Ansible] What does meta: end_play do?

A: Immediately ends the current play for the current host. The host is not marked as failed -- it simply stops processing.

Q2210. [Python] When was Python 3.0 released?

A: December 3, 2008. It was intentionally backward-incompatible to fix fundamental design issues like the print statement vs function, integer division, and Unicode handling.


Batch 222

Q2211. [Linux] What is procfs?

A: A virtual filesystem mounted at /proc that exposes kernel and process information as files. It contains no actual files on disk — the kernel generates content dynamically when files are read.

Q2212. [Linux] What is the fmt command?

A: Reformats text to a specified width: fmt -w 72 file wraps lines to 72 characters. Useful for formatting email text and documentation.

Q2213. [Ansible] What is the .retry file that Ansible creates?

A: When a playbook fails on some hosts, Ansible creates a .retry file containing the hostnames that failed. You can re-run only the failed hosts with --limit @playbook.retry. This behavior can be disabled in ansible.cfg.

Q2214. [Ansible] What is the hostvars magic variable?

A: A dictionary containing variables for all hosts in the inventory. Access another host's variables with hostvars['hostname']['variable_name'].

Q2215. [Linux] What is Btrfs?

A: B-tree filesystem — a copy-on-write filesystem with built-in volume management, snapshots, checksumming, compression, RAID, and send/receive for incremental backups. Default on openSUSE and Fedora workstation.

Q2216. [Linux] What is RAID 6?

A: Like RAID 5 but with double distributed parity across 4+ disks. Survives two simultaneous disk failures. Usable capacity = (N-2) disks.

Q2217. [Ansible] Why is CredSSP sometimes needed for Windows automation?

A: Because most WinRM auth methods don't delegate credentials, causing "double hop" authentication failures when accessing network resources. CredSSP forwards credentials, enabling access to network shares, SQL servers, etc.

Q2218. [Linux] What does dmesg show?

A: The kernel ring buffer — messages from the kernel about hardware, drivers, and system events. dmesg -T shows human-readable timestamps. dmesg --level=err,warn filters by severity.

Q2219. [Linux] What is $!?

A: The PID of the most recently backgrounded process.

Q2220. [Ansible] What is play_hosts?

A: A list of all hosts in the current play that are still active (not failed or unreachable).


Batch 223

Q2221. [Linux] What is the ephemeral port range in Linux?

A: 32768-60999 by default, configurable via /proc/sys/net/ipv4/ip_local_port_range. Used for outbound connections.

Q2222. [Linux] What is the "available" column in free?

A: An estimate of how much memory is available for starting new applications without swapping. It accounts for reclaimable cache and buffers. More useful than "free" for capacity planning.

Q2223. [Python] What is the difference between asyncio.gather() and TaskGroup?

A: gather() runs coroutines concurrently but has error-handling issues — if one task fails, others may be left running. TaskGroup (3.11) provides structured concurrency: if any task fails, all others are cancelled and the group raises an ExceptionGroup.

Q2224. [Ansible] How do you specify the SSH user for Ansible?

A: Via CLI with -u username, in inventory with ansible_user=username, or in playbooks/ansible.cfg.

Q2225. [Ansible] What is the pause module?

A: Pauses playbook execution for a specified duration or until user input is provided.

Q2226. [Linux] What is inotifywait?

A: A tool that watches filesystem events (create, modify, delete, move) on files or directories. Part of inotify-tools. Useful for triggering actions on file changes.

Q2227. [Ansible] What is the difference between variable names and environment variables?

A: Variable names are Ansible-internal. Environment variables reference system environment values using {{ ansible_env.SOME_VARIABLE }}.

Q2228. [Python] What is str.encode() and bytes.decode()?

A: str.encode('utf-8') converts a string to bytes. bytes.decode('utf-8') converts bytes to a string. The encoding defaults to UTF-8.

Q2229. [Ansible] What is the "canary deployment" pattern in Ansible?

A: Using serial: [1, 5, "100%"] to deploy to one host first (canary), then a small batch, then the rest. If the canary fails, the entire play stops before affecting other hosts.

Q2230. [Python] What does deque.rotate(n) do?

A: Rotates the deque n steps to the right. If n is negative, it rotates to the left. For example, deque([1,2,3]).rotate(1) gives deque([3,1,2]).


Batch 224

Q2231. [Ansible] What does meta/runtime.yml in a collection do?

A: Defines routing information: module/plugin redirects, deprecations, and tombstones for backward compatibility.

Q2232. [Linux] What is a block device?

A: A device that provides buffered, random-access I/O in fixed-size blocks (sectors). Examples: hard drives, SSDs, partitions, LVM logical volumes. Listed with lsblk.

Q2233. [Ansible] What is the galaxy.yml file in a collection?

A: The collection manifest file containing metadata: namespace, name, version, authors, description, license, dependencies on other collections, repository URL, and required Ansible version.

Q2234. [Ansible] Name all the major connection plugin types in Ansible.

A: ssh, paramiko_ssh, local, docker, kubectl, podman, network_cli, httpapi, netconf, winrm, psrp (PowerShell Remoting Protocol), lxd, jail (FreeBSD), zone (Solaris), chroot, funcd, and community-contributed options.

Q2235. [Linux] What is NOPASSWD in sudoers?

A: alice ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart nginx allows alice to run that specific command via sudo without entering a password.

Q2236. [Linux] What is BEGIN/END in awk?

A: BEGIN {actions} runs before any input is processed (good for initialization). END {actions} runs after all input is processed (good for summaries). Example: awk 'BEGIN{sum=0} {sum+=$1} END{print sum}'.

Q2237. [Ansible] What is the Ansible Community Steering Committee?

A: The governing body that provides continuity, guidance, and technical direction for the Ansible community project. It approves new proposals, policies, collection inclusion requests, and packaging decisions.

Q2238. [Linux] What is the difference between snap, flatpak, and AppImage?

A: Snap (Canonical): sandboxed, auto-updating, uses squashfs, centralized Snap Store. Flatpak (Red Hat/Freedesktop): sandboxed via bubblewrap, Flathub as main repo, desktop-focused. AppImage: single-file portable executables, no installation, no sandboxing.

Q2239. [Ansible] What is the security warning about Vault and "data at rest" vs. "data in use"?

A: Vault ONLY protects data at rest (on disk). Once decrypted during play execution, secrets are in memory and potentially in logs. Play authors must use no_log to prevent disclosure during task execution. ---

Q2240. [Linux] Who created Linux, and in what year?

A: Linus Torvalds created Linux in 1991 while a 21-year-old computer science student at the University of Helsinki, Finland.


Batch 225

Q2241. [Python] What is httpx?

A: A modern HTTP client for Python that supports both sync and async requests, HTTP/2, and has an API similar to requests. It is the async-capable successor to requests.

Q2242. [Linux] What does "dd" stand for?

A: Officially "convert and copy" (from IBM's JCL dd = Data Definition). Jokingly called "disk destroyer" due to its potential for data loss when misused.

Q2243. [Ansible] What are the three main connection types for network automation?

A: ansible.netcommon.network_cli (CLI over SSH), ansible.netcommon.netconf (NETCONF over SSH), and ansible.netcommon.httpapi (REST/HTTP APIs).

Q2244. [Linux] What does "tee" refer to?

A: A T-shaped pipe fitting — the command splits output like a T-junction in plumbing, sending it to both stdout and a file.

Q2245. [Ansible] What year did Ansible Tower (the commercial UI product) first appear?

A: Ansible Tower 1.0 was released in 2013 by AnsibleWorks, providing a web UI, REST API, and RBAC on top of Ansible.

Q2246. [Ansible] What is meta: end_play?

A: Immediately ends the current play without executing remaining tasks.

Q2247. [Python] What is __setitem__ and __delitem__?

A: __setitem__ implements obj[key] = value. __delitem__ implements del obj[key].

Q2248. [Linux] What is the hostnamectl command?

A: Manages the system hostname on systemd systems. hostnamectl set-hostname myserver sets all three hostname types (static, transient, pretty). Shows OS and kernel info with hostnamectl status.

Q2249. [Linux] What is the purpose of /bin?

A: Essential command binaries needed for single-user mode and booting (ls, cp, mount, bash). On modern systems with UsrMerge, /bin is a symlink to /usr/bin.

Q2250. [Python] What is a generator in Python?

A: A function that uses yield to produce a series of values lazily. Calling the function returns a generator iterator. Generators are memory-efficient for large sequences.


Batch 226

Q2251. [Ansible] When should you use a role vs a simple task file?

A: Use roles for reusable, well-organized automation with standard layouts shared across projects. Task files suffice for simple, lightweight, one-off automation.

Q2252. [Ansible] When did Red Hat acquire Ansible?

A: October 2015.

Q2253. [Linux] What is the Completely Fair Scheduler (CFS)?

A: The default Linux process scheduler from kernel 2.6.23 (2007) to 6.5, designed by Ingo Molnar. It uses a red-black tree to track virtual runtime, ensuring each process gets a fair share of CPU proportional to its weight (nice value).

Q2254. [Ansible] Besides git, what other VCS does ansible-pull support?

A: Subversion, Mercurial (hg), and Bazaar (bzr). Git is the default. --- --- ## 28. Community & Governance

Q2255. [Ansible] What is a Fully Qualified Collection Name (FQCN)?

A: The format namespace.collection.module_name used to reference content within collections (e.g., community.general.docker_container).

Q2256. [Linux] What are the key ss flags?

A: -t TCP, -u UDP, -l listening, -n numeric (no DNS resolution), -p show process, -a all sockets, -s summary statistics, -4/-6 IPv4/IPv6 only.

Q2257. [Python] What framework is FastAPI built on top of?

A: Starlette (for the web parts) and Pydantic (for data validation).

Q2258. [Python] What is the core data structure in NumPy?

A: The ndarray (n-dimensional array), a fixed-size, homogeneous, contiguous block of memory that enables fast vectorized operations.

Q2259. [Ansible] What is the default poll interval?

A: Controlled by the DEFAULT_POLL_INTERVAL configuration setting (default is typically 15 seconds).

Q2260. [Python] What does the / separator in function parameters do?

A: Introduced in Python 3.8 (PEP 570), parameters before / are positional-only: def f(a, /, b): means a must be passed positionally.


Batch 227

Q2261. [Python] What is pip install -e . (editable install)?

A: It installs a package in development mode — the package is linked (not copied) so changes to source code take effect immediately without reinstalling.

Q2262. [Python] What is Hypothesis?

A: A property-based testing library for Python (inspired by Haskell's QuickCheck). It generates random test inputs based on strategies and finds edge cases automatically.

Q2263. [Linux] What is /proc/cpuinfo?

A: Contains information about each CPU/core: processor number, vendor, model name, clock speed, cache size, CPU flags (instruction set extensions), and known hardware bugs.

Q2264. [Ansible] What module copies files from remote to local?

A: fetch

Q2265. [Python] How do you suppress exception chaining?

A: Use raise NewException() from None. This sets __cause__ to None and __suppress_context__ to True.

Q2266. [Python] What does hashlib provide?

A: Secure hash functions: hashlib.sha256(data).hexdigest(). It supports MD5, SHA-1, SHA-256, SHA-512, BLAKE2, and more.

Q2267. [Python] What does BDFL stand for, and who held that title?

A: Benevolent Dictator For Life — Guido van Rossum, Python's creator. He held this title until July 2018 when he stepped down after the contentious PEP 572 (walrus operator) debate.

Q2268. [Python] What is the pydoc module?

A: It generates documentation from Python modules: python -m pydoc module_name displays documentation, and python -m pydoc -b starts a documentation server.

Q2269. [Python] When was functools.cached_property introduced?

A: Python 3.8.

Q2270. [Linux] What is fsck?

A: Filesystem check — scans and repairs filesystem inconsistencies. Must be run on unmounted filesystems (or read-only mounted root in single-user mode). ext4 uses e2fsck; XFS uses xfs_repair.


Batch 228

Q2271. [Ansible] What is the free strategy?

A: Each host runs as fast as possible without waiting for other hosts to complete each task.

Q2272. [Linux] What is /var/log/auth.log?

A: Authentication-related logs on Debian/Ubuntu (login attempts, sudo usage, SSH sessions). RHEL uses /var/log/secure.

Q2273. [Ansible] What is callback plugin profile_tasks?

A: Displays timing information for each task, helping identify performance bottlenecks.

Q2274. [Linux] What is firewalld?

A: A dynamic firewall manager (frontend to nftables/iptables) using zones and services. Default on RHEL/Fedora. Supports runtime and permanent configurations.

Q2275. [Linux] What is the difference between ip route and ip rule?

A: ip route manages routing tables (where to send packets). ip rule manages the routing policy database (which routing table to use, based on source IP, mark, etc.). Together they enable policy-based routing.

Q2276. [Ansible] What happens if you write version: 1.0 in YAML without quotes?

A: YAML interprets it as the floating-point number 1.0, not the string "1.0". This can cause issues when version strings need to remain as strings. Always quote version numbers.

Q2277. [Python] When was Python 2.0 released and what did it add?

A: October 16, 2000. It introduced list comprehensions (PEP 202) and a cycle-detecting garbage collector.

Q2278. [Python] What does import __hello__ do?

A: It prints "Hello world!".

Q2279. [Python] What is Django's manage.py?

A: A command-line utility for Django projects: python manage.py runserver, python manage.py migrate, python manage.py createsuperuser, etc.

Q2280. [Linux] What is the most common bonding mode in production?

A: Mode 4 (802.3ad / LACP) — requires switch support. Mode 1 (active-backup) is used when switch configuration isn't possible.


Batch 229

Q2281. [Linux] What is the XDP (eXpress Data Path) framework?

A: An eBPF-based programmable packet processing framework that runs at the earliest point in the network stack (before skb allocation). Achieves near-line-rate packet processing for DDoS mitigation, load balancing, and filtering.

Q2282. [Ansible] What is a fact cache?

A: A persistent store (jsonfile, redis, memcached) that saves gathered facts between playbook runs, avoiding redundant fact collection.

Q2283. [Ansible] Can Ansible run on Windows as a control node?

A: No, the control node must be Linux or macOS. However, you can use WSL (Windows Subsystem for Linux) to run Ansible on Windows. ---

Q2284. [Ansible] What features does Ansible Tower/AWX provide?

A: Web dashboard, role-based access control (RBAC), job scheduling, workflow orchestration, credential management, real-time job monitoring, REST API, activity logging, audit trails, integration with Git/SCM, and notifications.

Q2285. [Python] What is pyenv?

A: A tool for managing multiple Python versions on the same machine. It lets you install and switch between different Python versions per-project or globally.

Q2286. [Linux] What license is the Linux kernel released under?

A: The GNU General Public License version 2 (GPLv2) only — not "or later." Linus has explicitly stated it will remain GPLv2.

Q2287. [Python] What API convention does scikit-learn follow?

A: The fit/predict/transform pattern: model.fit(X_train, y_train) trains, model.predict(X_test) predicts, and transformers use transform() or fit_transform().

Q2288. [Python] What is typing.Union used for?

A: Expressing that a value can be one of several types: Union[int, str]. In Python 3.10+, the | syntax replaces it: int | str.

Q2289. [Ansible] What is a "handler" in Ansible, and what makes it special?

A: A handler is a task that runs only when "notified" by another task that reported "changed." Handlers run at the end of the play (or when flushed with meta: flush_handlers) and are deduplicated -- even if notified multiple times, a handler runs only once.

Q2290. [Python] What is the site module responsible for?

A: It is automatically imported during Python startup and adds site-specific paths (like site-packages) to sys.path.


Batch 230

Q2291. [Ansible] What is ansible_play_batch?

A: A magic variable containing the list of hosts in the current batch when using serial.

Q2292. [Python] What does @dataclass(kw_only=True) do, introduced in Python 3.10?

A: It makes all fields keyword-only in the generated __init__, so they cannot be passed as positional arguments.

Q2293. [Ansible] How do you check disk space on all hosts ad-hoc?

A: ansible all -m shell -a "df -h"

Q2294. [Python] What is __getitem__ used for?

A: It implements obj[key]. For sequences, the key is an integer index. For mappings, it can be any hashable key. It also enables iteration as a fallback if __iter__ is not defined.

Q2295. [Ansible] What is diff mode?

A: --diff flag displays the difference between the current state and the proposed changes, useful for validating before applying.

Q2296. [Ansible] How do you handle a playbook that exposes sensitive data in logs?

A: Use no_log: true on sensitive tasks, store secrets in Ansible Vault, use callback plugins for redaction, avoid echoing passwords in debug statements.

Q2297. [Ansible] What connection type does ansible-pull use?

A: local -- since it runs on the target host itself, no SSH connection is needed. ---

Q2298. [Ansible] What makes SaltStack's execution speed notably faster than Ansible for large fleets?

A: Salt uses persistent ZeroMQ connections to pre-installed minion agents, enabling near-simultaneous command execution across thousands of nodes. Ansible must establish SSH connections serially (limited by forks), which is inherently slower.

Q2299. [Linux] What is perf record and perf report?

A: perf record -g command profiles a command, capturing stack traces. perf report displays the collected data as an interactive call graph. Essential for performance analysis and optimization.

Q2300. [Python] What major features were added in Python 3.12?

A: F-string improvements (any expression allowed), type statement (PEP 695), per-interpreter GIL (PEP 684), sys.monitoring (PEP 669), itertools.batched(), Linux perf profiler support, and deprecated distutils removal.


Batch 231

Q2301. [Ansible] What are "magic variables" in Ansible?

A: Variables automatically set by Ansible that provide information about the current play, host, and inventory. They cannot be set by the user directly and are always available during execution.

Q2302. [Linux] What is the OOM killer?

A: The Out-Of-Memory killer — a kernel mechanism that selects and kills processes when the system is critically low on memory. It uses oom_score (0-1000) to choose victims, preferring processes with high memory usage and low importance.

Q2303. [Python] What does itertools.repeat(elem, times=None) do?

A: It yields elem over and over, either infinitely (if times is None) or the specified number of times.

Q2304. [Linux] What is LD_LIBRARY_PATH?

A: A colon-separated list of directories the dynamic linker searches for shared libraries before the default paths. Useful for development but considered a security risk in production.

Q2305. [Python] Why was PEP 572 (walrus operator) controversial?

A: It sparked intense debate about readability and Pythonic style. The contentious discussion led to Guido van Rossum resigning as BDFL in July 2018, stating he was tired of fighting for the PEP and facing personal attacks.

Q2306. [Ansible] What is ansible-console?

A: An interactive REPL-style console for running ad-hoc Ansible tasks against an inventory, with tab completion.

Q2307. [Python] What is tox?

A: A tool for automating testing across multiple Python versions and environments. It creates virtualenvs and runs test commands in each.

Q2308. [Ansible] What does the fqcn lint rule require?

A: That all module references use Fully Qualified Collection Names (e.g., ansible.builtin.copy instead of just copy).

Q2309. [Ansible] What does YAML stand for?

A: YAML Ain't Markup Language (originally "Yet Another Markup Language"). ---

Q2310. [Python] What is the signal module used for?

A: Handling Unix signals in Python: signal.signal(signal.SIGTERM, handler) registers a handler for graceful shutdown.


Batch 232

Q2311. [Python] What happened to long in Python 3?

A: Python 2 had both int (fixed-size) and long (arbitrary precision). Python 3 unified them into a single int type with arbitrary precision.

Q2312. [Ansible] What is the serial keyword, and how does it interact with strategy?

A: serial limits how many hosts are processed in each batch. With serial: 5, Ansible processes 5 hosts at a time through the play. It works with any strategy and is essential for rolling updates. You can specify a number, percentage, or a list that escalates (e.g., serial: [1, 5, 10]). ---

Q2313. [Linux] What is /proc/meminfo?

A: Contains detailed memory statistics: total, free, available, buffers, cached, swap, active, inactive, slab, page tables, huge pages, and more.

Q2314. [Python] What is __class_getitem__ used for?

A: It enables the subscript syntax for classes: MyClass[int]. Used to make classes generic without metaclasses. Added in Python 3.7 (PEP 560).

Q2315. [Linux] What is restorecon?

A: Restores the default SELinux context on files based on the file context database. Usage: restorecon -Rv /var/www/html/.

Q2316. [Linux] What is sysctl?

A: A command to read and write kernel parameters at runtime. sysctl -a lists all. sysctl vm.swappiness=10 changes the value. Persistent changes go in /etc/sysctl.conf or /etc/sysctl.d/*.conf.

Q2317. [Python] What safer alternatives to pickle exist for data serialization?

A: JSON (for simple data), msgpack, Protocol Buffers, or marshal (limited to Python-internal types). For untrusted data, JSON is strongly preferred.

Q2318. [Python] What is typing.TypeGuard used for?

A: Added in Python 3.10, it narrows types in conditional branches. A function returning TypeGuard[X] tells the type checker that if the function returns True, the argument is of type X.

Q2319. [Ansible] What is hash_behaviour in ansible.cfg?

A: Controls how dictionary variables are handled when the same variable is defined in multiple places. replace (default) replaces the entire dictionary. merge does a deep merge. The merge behavior is deprecated and being removed.

Q2320. [Ansible] Why is hash_behaviour: merge deprecated?

A: It causes globally unpredictable behavior, makes debugging variable values extremely difficult, and is a constant source of bugs. The recommended approach is explicit merging with the combine filter.


Batch 233

Q2321. [Linux] What does "RTFM" stand for?

A: "Read The Fine Manual" — a common response in Linux communities directing users to read documentation (man pages).

Q2322. [Linux] What is journalctl --vacuum-time=7d?

A: Removes journal entries older than 7 days. --vacuum-size=1G removes entries until the journal is under 1GB. Useful for reclaiming disk space.

Q2323. [Ansible] What does the yum module do?

A: Manages packages on RHEL/CentOS systems (install, remove, update).

Q2324. [Ansible] What file extension is used for Jinja2 templates?

A: .j2 (e.g., nginx.conf.j2)

Q2325. [Linux] What is a Linux bridge and how does it relate to containers?

A: A software Layer 2 switch in the kernel. Docker creates docker0 bridge by default. Container veth pairs connect to this bridge, enabling container-to-container and container-to-host communication.

Q2326. [Ansible] What is become_method?

A: Specifies the escalation method (default is sudo). Other options: su, pbrun, pfexec, doas, dzdo.

Q2327. [Python] What is a Python "magic comment" for encoding?

A: A comment like # -*- coding: utf-8 -*- or # coding: utf-8 on the first or second line of a source file. It declares the source encoding. Not needed in Python 3 (UTF-8 is default).

Q2328. [Linux] What is the dig command used for?

A: DNS lookup utility that queries DNS servers directly. dig example.com A queries A records. dig @8.8.8.8 example.com uses a specific DNS server. Shows query details, answer section, and timing.

Q2329. [Ansible] What is the no_log: true directive?

A: Prevents Ansible from logging task parameters and results, useful for tasks handling sensitive data like passwords.

Q2330. [Python] What is unittest.mock.patch used for?

A: Temporarily replacing an object with a mock during testing. It can be used as a decorator or context manager: @patch('module.ClassName').


Batch 234

Q2331. [Ansible] Can rulebooks call Ansible Automation Platform job templates?

A: Yes. EDA integrates with AAP's automation controller, allowing rulebooks to trigger job templates via the run_job_template action. --- --- ## 19. Ansible Lightspeed & AI

Q2332. [Linux] What is the difference between TCP RST and FIN?

A: FIN is a graceful connection close — both sides complete the four-way teardown. RST (reset) is an abrupt close — immediately drops the connection without waiting for acknowledgments. RST indicates an error or rejected connection.

Q2333. [Linux] What is the rev command?

A: Reverses each line of input character by character. echo "hello" | rev outputs "olleh". A quirky but occasionally useful text processing tool.

Q2334. [Python] What is a daemon thread?

A: A thread that runs in the background and is automatically killed when all non-daemon threads exit. Set with thread.daemon = True before starting.

Q2335. [Linux] What is auditd?

A: The Linux Audit daemon — records security-relevant events based on rules. Rules define file watches (-w) and syscall auditing (-a). Logs go to /var/log/audit/audit.log.

Q2336. [Ansible] What is the query function, and how does it differ from lookup?

A: query (or q) always returns a list. lookup returns a comma-separated string by default. query('file', '/etc/hosts') returns a list with one element; lookup('file', '/etc/hosts') returns a string.

Q2337. [Ansible] What protocol does Ansible use for Windows?

A: WinRM (Windows Remote Management) with PowerShell.

Q2338. [Python] What is a PEP?

A: Python Enhancement Proposal — a design document providing information or describing a new feature for Python. Key PEPs include PEP 8 (style guide), PEP 20 (Zen of Python), and PEP 484 (type hints).

Q2339. [Ansible] What does failed_when do?

A: Overrides when Ansible considers a task as "failed." Allows custom failure conditions: failed_when: "'ERROR' in result.stdout"

Q2340. [Linux] What is $??

A: The exit status of the last executed command.


Batch 235

Q2341. [Python] What does sys.version_info return?

A: A named tuple with major, minor, micro, releaselevel, and serial fields.

Q2342. [Ansible] What are the two categories of callback plugins?

A: stdout callbacks (control terminal output; only one active at a time) and notification/aggregate callbacks (multiple can be active simultaneously for logging, metrics, etc.).

Q2343. [Python] What is the enum.auto() function used for?

A: It automatically generates values for enum members, typically incrementing integers starting from 1. The behavior can be customized by overriding _generate_next_value_().

Q2344. [Linux] What architecture was Linux originally written for?

A: The Intel 80386 (i386). Linus wrote it specifically for his 386-based PC.

Q2345. [Python] What is __sizeof__ used for?

A: Returns the internal size of the object in bytes (used by sys.getsizeof()). It does not include the size of referenced objects.

Q2346. [Ansible] Name ten commonly used lookup plugins.

A: (1) file -- read file contents; (2) template -- render a Jinja2 template; (3) env -- read environment variables; (4) password -- generate or retrieve passwords; (5) pipe -- run a command and capture output; (6) csvfile -- read from CSV files; (7) ini -- read from INI files; (8) url -- fetch content from a URL; (9) hashi_vault -- read from HashiCorp Vault; (10) aws_ssm -- read from AWS Systems Manager Parameter Store.

Q2347. [Python] Why do we use raw strings (r'...') for regex patterns in Python?

A: Raw strings prevent Python from interpreting backslash sequences before the regex engine sees them. Without r, \b would be a backspace character rather than a word boundary.

Q2348. [Linux] What is the difference between buffers and cache in memory?

A: Buffers: kernel buffer cache for raw block device I/O metadata. Cache: page cache for file data read from disk. Both can be reclaimed under memory pressure, so the "available" column is more meaningful than "free."

Q2349. [Ansible] When did IBM acquire Red Hat?

A: July 2019, for approximately $34 billion.

Q2350. [Ansible] What are Molecule's default test phases (the test sequence)?

A: dependency, lint, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy.


Batch 236

Q2351. [Linux] What is xargs -0?

A: Reads null-delimited input (from find -print0). Safely handles filenames with spaces, newlines, and special characters.

Q2352. [Linux] What is the difference between RUID, EUID, and SUID?

A: RUID (Real UID): the actual user who started the process. EUID (Effective UID): the UID used for permission checks (can differ from RUID via setuid). SUID (Saved UID): saves the previous EUID so the process can switch back.

Q2353. [Python] What is the warnings module?

A: It provides a mechanism for issuing warning messages (like DeprecationWarning) that do not stop execution. Warnings can be filtered, silenced, or turned into exceptions.

Q2354. [Ansible] How do you run a playbook with a specific inventory file?

A: ansible-playbook -i /path/to/inventory playbook.yml

Q2355. [Ansible] What is the default strategy, and what is its key characteristic?

A: linear. It waits for all hosts to complete a task before moving to the next task. This means a slow host delays all others.

Q2356. [Linux] What signal number is SIGQUIT?

A: 3. Sent by Ctrl-\. Default action is to terminate and produce a core dump.

Q2357. [Ansible] What is the template module's output_encoding parameter?

A: Specifies the character encoding for the rendered template output file (default: utf-8).

Q2358. [Ansible] What is the difference between with_items and loop?

A: with_items is the legacy syntax for looping. loop is the modern, preferred keyword with cleaner syntax and more advanced features.

Q2359. [Python] What major features were added in Python 3.9?

A: Dict merge operator | (PEP 584), str.removeprefix()/removesuffix(), zoneinfo module, built-in generic types (list[int] instead of typing.List[int]), graphlib.TopologicalSorter, and functools.cache.

Q2360. [Python] What does @dataclass(frozen=True) do?

A: It makes instances of the dataclass immutable (read-only). Attempting to assign to fields after creation raises FrozenInstanceError. Frozen dataclasses are also hashable by default.


Batch 237

Q2361. [Ansible] What is Ansible?

A: Ansible is an open-source IT automation tool for configuration management, application deployment, orchestration, and provisioning. It is agentless, written in Python, and uses SSH to communicate with managed nodes.

Q2362. [Ansible] What is the standard role directory structure?

A: tasks/main.yml (core tasks), handlers/main.yml (triggered actions), defaults/main.yml (default variables, lowest precedence), vars/main.yml (role variables, higher precedence), files/ (static files), templates/ (Jinja2 templates), meta/main.yml (role metadata and dependencies), tests/ (test playbooks).

Q2363. [Ansible] What is ansible-doc used for?

A: Viewing documentation for modules, plugins, filters, and other Ansible components from the command line without needing internet access. Example: ansible-doc ansible.builtin.copy.

Q2364. [Python] What is the relationship between type and object?

A: object is the base class of all classes (including type), and type is the metaclass of all classes (including object). So type is an instance of itself, and object is an instance of type.

Q2365. [Ansible] What is the structure of an EDA rulebook?

A: A rulebook contains three main components: (1) sources -- where events come from (webhooks, Kafka, alertmanager, etc.); (2) rules -- conditions evaluated against incoming events; (3) actions -- what to do when conditions match (run a playbook, module, or trigger a workflow in Controller).

Q2366. [Linux] What is the difference between wall and write?

A: wall broadcasts a message to all logged-in users' terminals. write user sends a message to a specific user's terminal. Both are one-way messaging tools.

Q2367. [Ansible] When is ansible-pull appropriate?

A: When central coordination of task completion isn't required and eventual consistency is acceptable. It scales well because processing is distributed across the fleet.

Q2368. [Ansible] What cannot collection role names contain?

A: Hyphens. When migrating roles to collections, hyphens must be replaced with underscores.

Q2369. [Linux] What is the difference between a bind mount and a regular mount?

A: A regular mount attaches a filesystem (from a device) to a directory. A bind mount makes an existing directory tree available at another location: mount --bind /old/path /new/path. The same data is accessible from both paths.

Q2370. [Python] What is Flask's g object?

A: A per-request global namespace for storing data during a request lifecycle. It is reset between requests.


Batch 238

Q2371. [Linux] What is the sticky bit?

A: Octal 1000 (chmod +t). On directories: only the file owner, directory owner, or root can delete files within. Set on /tmp to prevent users from deleting each other's files.

Q2372. [Ansible] Can you set variables with magic variable names?

A: No. Magic variable names are reserved and setting them will be overridden by Ansible's internal values.

Q2373. [Python] What is typing.AsyncIterator?

A: A type hint for async iterators — objects implementing __aiter__ and __anext__.

Q2374. [Python] What is a list comprehension and when was it introduced?

A: A concise syntax for creating lists: [x**2 for x in range(10)]. Introduced in Python 2.0 (PEP 202), inspired by Haskell.

Q2375. [Ansible] What is meta: clear_host_errors?

A: Clears the failed state from hosts, allowing them to continue in subsequent tasks.

Q2376. [Python] What does @dataclass(order=True) do?

A: It generates __lt__, __le__, __gt__, and __ge__ methods that compare instances as if they were tuples of their fields (in order of definition).

Q2377. [Linux] What is LVM?

A: Logical Volume Manager — an abstraction layer between physical disks and filesystems. It allows flexible volume management including resizing, snapshots, and spanning multiple disks.

Q2378. [Python] What is the difference between venv and virtualenv?

A: venv is in the standard library but has fewer features. virtualenv is faster, supports more Python versions, has more configuration options, and can create environments for different interpreters.

Q2379. [Python] What method does defaultdict call to produce a default value?

A: It calls the default_factory attribute, which is the callable passed to the constructor. This is invoked from the __missing__ method.

Q2380. [Ansible] Before Ansible 2.10, how was all community-contributed content structured?

A: Everything -- thousands of modules, plugins, and roles -- lived in a single monolithic GitHub repository (ansible/ansible). This made Ansible an outlier among open-source projects.


Batch 239

Q2381. [Python] What does itertools.zip_longest() do differently from zip()?

A: zip() stops at the shortest iterable. zip_longest() continues until the longest iterable is exhausted, filling missing values with a fillvalue (default None).

Q2382. [Linux] How do containers differ from virtual machines?

A: Containers share the host kernel and use namespaces/cgroups for isolation — they start in milliseconds with minimal overhead. VMs run their own kernel on a hypervisor, providing stronger isolation but with more resource overhead and slower startup.

Q2383. [Linux] What is job control?

A: Interactive shell feature for managing background/foreground processes. command & runs in background. Ctrl-Z suspends foreground job. bg resumes in background. fg brings to foreground. jobs lists current jobs.

Q2384. [Ansible] Which config management tool uses a "master-minion" architecture with a ZeroMQ message bus?

A: SaltStack (Salt). The master communicates with minions over a ZeroMQ or TCP transport bus, which gives it very fast command execution across large fleets.

Q2385. [Python] What is vars(obj) equivalent to?

A: obj.__dict__ — it returns the __dict__ attribute of the object. Without an argument, vars() returns locals().

Q2386. [Python] What is the precedence of the walrus operator?

A: It has very low precedence — lower than most operators. Parentheses are often needed: if (n := len(data)) > 10: requires the parentheses around the assignment.

Q2387. [Python] What is a named group backreference in regex?

A: (?P=name) in the pattern references a previously captured named group. For example, (?P<word>\w+)\s+(?P=word) matches repeated words. --- ## 10. Numeric Types

Q2388. [Python] What is typing.Never (Python 3.11) or typing.NoReturn used for?

A: NoReturn annotates functions that never return (they always raise an exception or run forever). Never (Python 3.11) is the bottom type — it also works for variables that should never have a value.

Q2389. [Python] When does the else clause of a try block execute?

A: Only when no exception was raised in the try block. It is useful for code that should run only on success, keeping the try block minimal.

Q2390. [Python] What is python -m zipapp used for?

A: It creates executable Python ZIP applications (.pyz files). A ZIP file with a __main__.py entry point can be executed directly by Python.


Batch 240

Q2391. [Linux] What is RAID 0?

A: Striping — data is distributed across multiple disks for performance. No redundancy. If one disk fails, all data is lost. Read/write speed scales with the number of disks.

Q2392. [Ansible] What is ANSIBLE_ROLES_PATH?

A: Specifies additional directories where Ansible searches for roles beyond the default ./roles and ~/.ansible/roles.

Q2393. [Linux] What does "tar" stand for?

A: "Tape ARchive" — originally designed for writing data to tape drives.

Q2394. [Python] What does the str.partition(sep) method return?

A: A 3-tuple: (before, sep, after). If the separator is not found, it returns (string, '', ''). There is also rpartition() which splits at the last occurrence.

Q2395. [Python] When was Django first released?

A: July 2005. It was originally developed at the Lawrence Journal-World newspaper in Lawrence, Kansas.

Q2396. [Python] What does itertools.tee(iterable, n=2) return?

A: n independent iterators from a single iterable. Once teed, the original iterator should not be used. Note: it can consume significant memory if one copy advances far ahead of the others.

Q2397. [Ansible] What is BYOM in the context of Ansible Lightspeed?

A: "Bring Your Own Model" -- introduced in AAP 2.6, it allows customers to use LLM providers other than IBM watsonx, including Red Hat AI, OpenAI, and Azure OpenAI.

Q2398. [Ansible] What configuration language does each tool use?

A: Ansible: YAML (playbooks) + Jinja2 (templates). Puppet: Puppet DSL (declarative). Chef: Ruby DSL (imperative "recipes"). Salt: YAML (state files) + Jinja2 (templates).

Q2399. [Ansible] How did Ansible end up under IBM's umbrella?

A: IBM acquired Red Hat in 2019 for $34 billion. Since Ansible was a Red Hat product, it became part of IBM's portfolio.

Q2400. [Linux] How do you lock a user account?

A: usermod -L username (prepends ! to the password hash in /etc/shadow) or passwd -l username. To also expire the account: chage -E 0 username.


Batch 241

Q2401. [Linux] What is the basic structure of an awk program?

A: awk 'pattern {action}' file. If no pattern, the action runs on every line. If no action, matching lines are printed. $1, $2, etc., are fields; $0 is the whole line.

Q2402. [Ansible] What is environment at the task or play level?

A: Sets environment variables for the duration of the task/play on the remote host. Commonly used for proxy settings or PATH modifications.

Q2403. [Python] What is the zip() function's strict mode?

A: Added in Python 3.10 (PEP 618): zip(*iterables, strict=True) raises ValueError if the iterables have different lengths.

Q2404. [Python] What is ssl.create_default_context() for?

A: It creates an SSL context with secure default settings (certificate verification, modern TLS versions). Always use it instead of bare ssl.SSLContext().

Q2405. [Python] What is the pathlib module and when was it introduced?

A: Introduced in Python 3.4, pathlib provides object-oriented filesystem paths via the Path class, offering a more Pythonic alternative to os.path.

Q2406. [Python] What is the GIL?

A: The Global Interpreter Lock — a mutex in CPython that allows only one thread to execute Python bytecode at a time. It simplifies memory management but prevents true multi-threaded parallelism for CPU-bound code.

Q2407. [Python] What is sys.monitoring in Python 3.12?

A: A new API for monitoring Python execution (PEP 669), designed for debuggers and profilers. It is much lower overhead than the previous sys.settrace approach.

Q2408. [Linux] What is the purpose of /etc/securetty?

A: Historically listed terminal devices from which root was allowed to log in. Modern systems using PAM may not use it, and systemd-based systems have deprecated it.

Q2409. [Linux] What is memory.high in cgroups v2?

A: A memory throttling threshold. When usage exceeds memory.high, the kernel aggressively reclaims memory from the cgroup, slowing it down. Unlike memory.max, it does not trigger OOM killing.

Q2410. [Python] What is the result of () is ()?

A: True in CPython. Empty tuples are cached as singletons because they are immutable and commonly used.


Batch 242

Q2411. [Linux] What does renice do?

A: Changes the nice value of a running process. Usage: renice -n 10 -p <PID>.

Q2412. [Python] What is __class_getitem__ vs __getitem__?

A: __class_getitem__ handles MyClass[item] (class-level subscript, used for generics). __getitem__ handles instance[item] (instance-level subscript).

Q2413. [Python] What does raise without an argument do?

A: It re-raises the current exception being handled. It can only be used inside an except block.

Q2414. [Python] What does itertools.product('AB', repeat=3) produce?

A: All 8 three-element tuples from the Cartesian product of 'AB' with itself 3 times, equivalent to product('AB', 'AB', 'AB').

Q2415. [Ansible] How do you fire-and-forget a long-running task?

A: Set async: <timeout> and poll: 0. The task starts in the background and Ansible continues. You can check on it later with async_status.

Q2416. [Linux] What is the Debian Social Contract?

A: A founding document of the Debian Project that commits to keeping Debian 100% free software, giving back to the free software community, not hiding problems, and prioritizing users and free software.

Q2417. [Python] What did breakpoint() (Python 3.7) replace?

A: The verbose import pdb; pdb.set_trace(). The breakpoint() built-in is also configurable via the PYTHONBREAKPOINT environment variable to use different debuggers.

Q2418. [Ansible] How do you specify which Ansible collections to include in an EE?

A: Add them to a requirements.yml file referenced in the dependencies.galaxy field of execution-environment.yml.

Q2419. [Python] What is the time complexity of bisect.insort() for inserting into a sorted list?

A: O(n) overall — O(log n) for the binary search to find the insertion point, but O(n) for the actual insertion due to shifting elements in the list.

Q2420. [Python] What is the maximum recursion depth in Python by default?

A: 1000. It can be changed with sys.setrecursionlimit(), but deep recursion is discouraged due to stack overflow risk.


Batch 243

Q2421. [Python] What is the contextlib.aclosing() context manager?

A: Added in Python 3.10, it calls aclose() on an async generator when exiting the async with block, ensuring cleanup.

Q2422. [Python] What does Flask call itself?

A: A "micro" web framework. It provides the core (routing, request/response handling, templating via Jinja2) but leaves choices like ORM and authentication to extensions.

Q2423. [Ansible] What is an Ansible module?

A: A reusable, standalone script that performs a specific task (installing packages, managing files, restarting services, etc.) on managed nodes. Modules are idempotent and return JSON output.

Q2424. [Ansible] Where should custom filter plugins be placed?

A: In a filter_plugins/ directory adjacent to the playbook, inside a role's filter_plugins/ directory, in a collection's plugins/filter/ directory, or in a path configured in ansible.cfg under DEFAULT_FILTER_PLUGIN_PATH.

Q2425. [Linux] What is Arch Linux known for?

A: Its rolling-release model, minimalist design philosophy, and "The Arch Way" (simplicity, user-centricity). The meme "I use Arch btw" is a well-known joke in the Linux community.

Q2426. [Python] What is functools.singledispatch limited to?

A: It dispatches only on the type of the first argument. For multiple-dispatch (dispatching on types of multiple arguments), use third-party libraries like multipledispatch.

Q2427. [Ansible] What is the precedence order if the same variable is defined in group_vars for a parent group and a child group?

A: Child group variables override parent group variables. Ansible merges variables from parent to child, with the child winning. If a host is in multiple groups at the same level, alphabetical group name ordering determines precedence (last alphabetically wins).

Q2428. [Python] What is maturin?

A: A build tool for Rust-based Python extensions (PyO3/cffi). It compiles Rust code into Python-installable wheels.

Q2429. [Python] What is PEP 649 about?

A: "Deferred Evaluation of Annotations" — an alternative to PEP 563 that evaluates annotations lazily on access rather than converting them to strings. Accepted for Python 3.14. --- ## 14. Python Packaging & Ecosystem

Q2430. [Python] What does the statistics module provide?

A: Basic statistical functions: mean(), median(), mode(), stdev(), variance(), quantiles(), and more. Added in Python 3.4.


Batch 244

Q2431. [Python] What is the textwrap module useful for?

A: Wrapping and formatting plain text: wrap(), fill(), dedent(), indent(), and shorten() for truncating text with a placeholder.

Q2432. [Python] What are "sprints" at Python conferences?

A: Multi-day coding sessions after the main conference where attendees collaborate on open-source projects, fix bugs, and contribute to Python itself.

Q2433. [Linux] What are the three journaling modes in ext4?

A: data=journal: both data and metadata are journaled (safest, slowest). data=ordered (default): metadata is journaled, data is flushed before metadata commits. data=writeback: only metadata is journaled (fastest, least safe).

Q2434. [Python] What is the difference between WSGI and ASGI?

A: WSGI (Web Server Gateway Interface) is synchronous — one request per thread. ASGI (Asynchronous Server Gateway Interface) supports async, WebSockets, and long-lived connections.

Q2435. [Linux] What is the difference between softirq and hardirq?

A: Hardirqs (hardware interrupts) are triggered by hardware events and must be handled quickly with interrupts disabled. Softirqs are deferred processing scheduled by hardirqs to run with interrupts enabled, handling the bulk of the work.

Q2436. [Python] How do you format a number with thousands separators in an f-string?

A: f'{1000000:,}' produces '1,000,000'. You can also use _ as a separator: f'{1000000:_}' gives '1_000_000'.

Q2437. [Python] What is the TaskGroup in Python 3.11's asyncio?

A: asyncio.TaskGroup provides structured concurrency — a context manager that runs multiple tasks and ensures all are completed (or cancelled) before exiting the block.

Q2438. [Python] What is the LEGB rule?

A: The variable scoping rule in Python: Local, Enclosing, Global, Built-in. Python searches for names in this order.

Q2439. [Ansible] What are key limitations of Mitogen?

A: The raw action requires Python on targets (preventing Python bootstrapping); only doas, su, and sudo are supported for become (not arbitrary become plugins); actions serialize per (host, user) combination; Python 3 performance lags behind Python 2.

Q2440. [Python] Why does 0.1 + 0.2 != 0.3 in Python?

A: Because floating-point numbers use IEEE 754 binary representation, and 0.1 and 0.2 cannot be represented exactly in binary. The result is 0.30000000000000004. Use math.isclose() or decimal.Decimal.


Batch 245

Q2441. [Python] What is __name__ set to when a module is imported?

A: The module's name (e.g., 'mymodule'). When run as a script, it is set to '__main__'.

Q2442. [Python] What is compileall used for?

A: python -m compileall directory compiles all .py files in a directory tree to .pyc files. Used when deploying to ensure bytecode is pre-compiled.

Q2443. [Linux] What is the perf top command?

A: A real-time performance profiler showing which functions consume the most CPU, similar to top but at the function/instruction level. Excellent for identifying hot spots.

Q2444. [Ansible] When do handlers execute?

A: At the end of each play, after all tasks have completed. You can force earlier execution with meta: flush_handlers. ---

Q2445. [Python] What did Python 2.5 introduce?

A: The with statement (PEP 343), conditional expressions (x if cond else y), and try/except/finally as a single statement.

Q2446. [Python] What does itertools.batched() do, and when was it added?

A: Added in Python 3.12, it yields non-overlapping batches (tuples) of a given size from an iterable. batched('ABCDEFG', 3) yields ('A','B','C'), ('D','E','F'), ('G',).

Q2447. [Linux] What does loginctl do?

A: Manages systemd user sessions. loginctl list-sessions shows active sessions. loginctl terminate-session ID kills a session. Part of systemd-logind.

Q2448. [Linux] What is the difference between TCP and UDP?

A: TCP: connection-oriented, reliable (acknowledgments, retransmission, ordering), flow control, slower. UDP: connectionless, unreliable (no guarantees), no flow control, faster. TCP for web/SSH/email; UDP for DNS queries, streaming, gaming.

Q2449. [Ansible] What is the ansible.builtin.pause module?

A: Pauses playbook execution for a specified time or until the user presses Enter. Can also prompt for user input. Example: pause: seconds=30 or pause: prompt="Are you sure?".

Q2450. [Linux] What are the common Linux capabilities?

A: CAP_NET_BIND_SERVICE (bind low ports), CAP_NET_RAW (raw sockets, ping), CAP_SYS_ADMIN (broad admin), CAP_SYS_PTRACE (debug processes), CAP_DAC_OVERRIDE (bypass file permissions), CAP_CHOWN (change file ownership), CAP_SETUID/CAP_SETGID (change UID/GID), CAP_NET_ADMIN (network configuration).


Batch 246

Q2451. [Python] What is the __qualname__ attribute?

A: The qualified name of a class or function, showing the path from the module level. For a nested class method: Outer.Inner.method. Added in Python 3.3.

Q2452. [Ansible] What is a Smart Inventory?

A: A dynamic inventory in automation controller defined by a filter query against existing inventories. It automatically updates as source inventories change. --- --- ## 17. Ansible Automation Platform (AAP)

Q2453. [Python] What does itertools.groupby() yield?

A: Pairs of (key, group_iterator) where the group iterator yields all consecutive elements with that key. The group iterators share the underlying iterator, so you must consume each group before advancing to the next.

Q2454. [Linux] What is a here document (heredoc)?

A: A redirection that allows multi-line input: command <<EOF ... EOF. With <<'EOF' (quoted delimiter), variable expansion is disabled. <<-EOF allows leading tabs to be stripped.

Q2455. [Linux] What is the difference between grep -E and grep -P?

A: -E uses Extended Regular Expressions (ERE): +, ?, |, {}, () without backslash escaping. -P uses Perl-Compatible Regular Expressions (PCRE) with advanced features like lookahead, lookbehind, and \d.

Q2456. [Python] What does argparse.ArgumentParser.add_subparsers() do?

A: Creates subcommands (like git commit, git push), where each subcommand has its own set of arguments.

Q2457. [Python] What is hasattr(obj, name) equivalent to?

A: Calling getattr(obj, name) and catching AttributeError. It returns True if the attribute exists.

Q2458. [Ansible] What is a handler in Ansible?

A: A special task that only runs when notified by another task via the notify directive. Commonly used for service restarts after configuration changes.

Q2459. [Linux] What are major and minor device numbers?

A: Major number identifies the driver (e.g., 8 = SCSI/SATA disk). Minor number identifies the specific device instance (e.g., 0 = sda, 1 = sda1, 16 = sdb). Visible with ls -l /dev/.

Q2460. [Ansible] What is the ternary filter?

A: A conditional filter: {{ condition | ternary('true_value', 'false_value') }}.


Batch 247

Q2461. [Python] Approximately how many packages are on PyPI as of 2025?

A: Over 500,000 packages.

Q2462. [Linux] What is the nslookup command?

A: An older DNS query tool. nslookup example.com performs a forward lookup. Less detailed output than dig but simpler syntax. Considered deprecated by some in favor of dig.

Q2463. [Linux] What is the magic number in a Linux executable?

A: ELF binaries start with the magic bytes \x7fELF (hex: 7f 45 4c 46). ELF stands for Executable and Linkable Format.

Q2464. [Linux] What is the difference between Fluentd and Fluent Bit?

A: Fluentd is a full-featured log collector/processor written in Ruby/C. Fluent Bit is a lightweight subset written in C, optimized for embedded systems and containers. Both are CNCF projects.

Q2465. [Linux] What are cgroups?

A: Control Groups — a kernel feature for organizing processes into hierarchical groups and applying resource limits (CPU, memory, I/O, network, PIDs). cgroups v1 uses multiple independent hierarchies; cgroups v2 uses a unified hierarchy.

Q2466. [Linux] What is the taskset command?

A: Sets or retrieves the CPU affinity of a process — which CPUs it can run on. taskset -c 0,1 command restricts to CPUs 0 and 1. Useful for performance tuning and NUMA optimization.

Q2467. [Ansible] What Python version does ansible-core 2.17+ require on managed nodes?

A: Python 3.7+ on managed nodes. Python 2.7 support on managed nodes was dropped.

Q2468. [Linux] What is bpftrace?

A: A high-level tracing language for Linux using eBPF. Allows one-liner performance tools: bpftrace -e 'tracepoint:syscalls:sys_enter_open { printf("%s %s\n", comm, str(args->filename)); }'.

Q2469. [Python] What is the difference between str.strip() and str.removeprefix()/str.removesuffix()?

A: strip() removes individual characters from both ends. removeprefix()/removesuffix() removes a specific substring. 'Arthur'.lstrip('Art') gives 'hur' (strips characters), while 'Arthur'.removeprefix('Art') gives 'hur' (removes exact prefix).

Q2470. [Ansible] What Ansible community package version corresponds to ansible-core 2.16?

A: Ansible 9.x ships with ansible-core 2.16.


Batch 248

Q2471. [Python] What is the difference between @staticmethod and @classmethod?

A: @staticmethod receives no implicit first argument — it is just a regular function namespaced to the class. @classmethod receives the class as its first argument (cls), so it can access class-level data and be properly inherited.

Q2472. [Ansible] Can you install collections from a tarball?

A: Yes: ansible-galaxy collection install /path/to/collection-1.0.0.tar.gz ---

Q2473. [Linux] What does 2>&1 do?

A: Redirects stderr to wherever stdout is currently going. Combined with >, it captures both stdout and stderr to the same file: command > file 2>&1.

Q2474. [Ansible] What is --vault-password-file?

A: Points to a file (or executable script) containing the Vault password. If it's a script, Ansible executes it and uses stdout as the password. Useful for integration with secret managers (HashiCorp Vault, AWS Secrets Manager). --- --- ## 12. Error Handling & Debugging

Q2475. [Ansible] Name five Ansible-specific filters not found in stock Jinja2.

A: (1) to_yaml / to_nice_yaml -- convert to YAML; (2) to_json / to_nice_json -- convert to JSON; (3) from_json / from_yaml -- parse JSON/YAML strings; (4) ipaddr -- IP address manipulation (now in ansible.utils); (5) regex_search / regex_replace -- regex operations; (6) combine -- merge dictionaries; (7) hash / password_hash -- cryptographic hashing.

Q2476. [Ansible] How does Ansible differ from SaltStack?

A: Both can be agentless, but SaltStack also supports an agent-based (minion) model. SaltStack uses its own DSL and is typically faster at scale due to ZeroMQ messaging, while Ansible is simpler and uses SSH.

Q2477. [Linux] What are the stages of GRUB2 boot loading?

A: Stage 1: The boot.img in the MBR (446 bytes) loads stage 1.5. Stage 1.5 (core.img): filesystem-aware code in the post-MBR gap loads stage 2. Stage 2: Full GRUB environment reads grub.cfg, displays menu, and loads the kernel and initramfs.

Q2478. [Python] What is a frozenset?

A: An immutable version of set. Since it is hashable, it can be used as a dictionary key or as an element of another set.

Q2479. [Python] What is glob.glob() used for?

A: Finding files matching a Unix-style pattern: glob.glob('**/*.py', recursive=True) finds all Python files recursively.

Q2480. [Python] What format spec would you use in an f-string to display a float with exactly 2 decimal places?

A: f'{value:.2f}'. The .2f means 2 decimal places with fixed-point notation.


Batch 249

Q2481. [Python] What is PEP 703 (free-threading)?

A: It removes the GIL as an experimental opt-in build option in Python 3.13. It enables true multi-threaded parallelism but requires significant changes to C extensions.

Q2482. [Python] What does chr() and ord() do?

A: chr(n) returns the string character for Unicode code point n. ord(c) returns the Unicode code point for a single character string c. They are inverses.

Q2483. [Python] What is CPython?

A: The reference implementation of Python, written in C. When people say "Python," they usually mean CPython.

Q2484. [Python] What is sys.executable?

A: The path to the Python interpreter binary currently running.

Q2485. [Python] What is the dataclasses.make_dataclass() function?

A: Dynamically creates a dataclass from a name and list of fields: Point = make_dataclass('Point', ['x', 'y']). Useful for runtime dataclass generation.

Q2486. [Linux] How many lines of code are in a modern Linux kernel?

A: Approximately 30-35 million lines of code as of kernel 6.x, making it one of the largest collaborative software projects in history.

Q2487. [Ansible] What is ansible-creator?

A: A scaffolding tool that generates new Ansible content projects (collections, roles, playbooks) with best-practice directory structures and boilerplate.

Q2488. [Python] What is typing.Annotated used for?

A: Added in Python 3.9 (PEP 593), it attaches arbitrary metadata to type hints: Annotated[int, ValueRange(0, 100)]. Libraries like Pydantic and FastAPI use this for validation.

Q2489. [Python] What is the __pycache__ directory?

A: A directory Python creates to store compiled bytecode (.pyc files). It avoids recompiling modules that haven't changed. The files are named with the Python version, like module.cpython-312.pyc.

Q2490. [Linux] What is a Type-1 vs Type-2 hypervisor?

A: Type-1 (bare-metal): runs directly on hardware (KVM, ESXi, Xen, Hyper-V). Type-2 (hosted): runs on top of a host OS (VirtualBox, VMware Workstation). KVM is technically Type-1 because the kernel IS the hypervisor.


Batch 250

Q2491. [Ansible] How do you check the status of a fire-and-forget async task?

A: Use the async_status module with the jid (job ID) returned by the original async task registered in a variable.