yoklainterview sim

DevOps / Cloud Infrastructure As Code Interview Questions

75 verified DevOps / Cloud Infrastructure As Code interview questions — solve with answers, learn from explanations, test yourself in a real simulation.

Try the real simulation →

Sample questions

Infrastructure As CodeDifficulty 1
What is Infrastructure as Code (IaC), at its core?
  • aDocumenting every server change by hand on a shared wiki page for the whole operations team to follow
  • bManaging and provisioning infrastructure through version-controlled, machine-readable definition files
  • cClicking through a cloud console to create each resource one by one and saving screenshots of every step
  • dTreating server log output as the primary source of system configuration
Explanation:IaC means infrastructure (servers, networks, databases, etc.) is defined in text files that a tool reads and applies, so provisioning is repeatable and can be tracked in version control. (a) is wrong because a wiki page is not machine-readable or automatically applied — it still relies on someone manually repeating steps correctly.
Infrastructure As CodeDifficulty 1
What is the main practical benefit teams get from adopting IaC?
  • aPhysical servers automatically running faster
  • bNetwork latency being automatically reduced to zero
  • cBugs in application code being automatically detected and reported to the responsible engineer
  • dRecreating the same environment consistently and tracking change history in version control
Explanation:IaC's core value is reproducibility and traceability: the same definitions can be re-applied to get the same environment, and every change is a reviewable, revertible commit. (a) is wrong because IaC changes how infrastructure is managed, not the physical or network performance of the hardware itself.
Infrastructure As CodeDifficulty 1
What is the fundamental difference between a declarative IaC tool and an imperative script?
  • aDeclarative defines the desired end state; imperative specifies the exact ordered commands to run
  • bDeclarative only works through a GUI, imperative only works through a CLI
  • cDeclarative only works with cloud providers, imperative only works on-premise
  • dDeclarative never modifies resources and only reads them, imperative creates resources
Explanation:Declarative tools (e.g. Terraform, CloudFormation) let you describe 'what' you want and the tool figures out the steps; imperative scripts describe 'how', i.e. exact ordered commands. (b) is wrong — the declarative/imperative distinction is about how state is expressed, not about GUI vs CLI.
Infrastructure As CodeDifficulty 1
What does 'idempotency' mean in the context of IaC?
  • aResources must be recreated from scratch on every single run
  • bThe tool can only be run once; a second run always errors
  • cApplying the same operation repeatedly gives the same result, with no extra change once desired state is reached
  • dChanges made by the tool can never be rolled back once applied, regardless of the environment
Explanation:Idempotency means re-running the same apply/playbook is safe: the tool checks current state and only changes what actually differs from the desired state. (a) is wrong — recreating everything from scratch on every run is the opposite of idempotent behavior, it would be wasteful and destructive.
Infrastructure As CodeDifficulty 1
In IaC tools, what do the terms 'desired state' and 'current state' refer to?
  • aDesired state is a past change, current state is the next planned change
  • bDesired state is the target described in code; current state is what actually exists now
  • cDesired state means the test environment, current state means production
  • dDesired state is the engineer's preferred cloud provider, current state is the active billing plan
Explanation:IaC tools compare the desired state (declared in code) with the current state (real infrastructure, often tracked via a state file or live API calls) to compute what needs to change. (a) is wrong because both terms describe a snapshot of configuration, not a timeline of past/future changes.
Infrastructure As CodeDifficulty 1
A new engineer joins the team and needs an identical development environment to the rest of the team. What should they do instead of manually configuring servers for two days?
  • aPhysically copy an existing server's entire disk image onto brand new hardware in the data center
  • bGet direct access to production and test changes there instead
  • cWatch other engineers' screens and manually repeat the same steps
  • dRun the team's version-controlled IaC definitions to rebuild the same environment automatically
Explanation:A key benefit of IaC is fast, consistent onboarding: running the same tracked definitions reproduces the environment without manual, error-prone repetition. (a) is wrong — copying a disk image is a fragile, ad-hoc workaround, not a repeatable, auditable process.

Test yourself against the 3375-question DevOps / Cloud bank.

Start interview