Both are pipeline-as-code in a Jenkinsfile. Declarative has a fixed, validated structure (pipeline, agent, stages, steps, post) and is the default choice. Scripted is plain Groovy, more flexible but harder to read and maintain. Use declarative and drop into a script block only when you must.
Full answer with examplesInterview questions / DevOps
Jenkins Interview Questions
Jenkins is still common in enterprise QA. These questions cover pipelines as code, agents, parameters and publishing test reports.
3 questions · 1 beginner· 1 intermediate· 1 advanced
beginner questions
intermediate questions
Have the runner write JUnit XML, publish it in a post { always } block with the junit step, and archive HTML reports, screenshots and traces as artifacts. The junit step marks the build UNSTABLE when tests fail; FAILURE means the pipeline itself broke, such as a compile error or crash.
Full answer with examplesadvanced questions
Split the suite into shards, run each shard in a parallel stage on its own agent (labels or Kubernetes/Docker agents), stash the build once and unstash it per shard, publish every shard's JUnit XML, and use failFast deliberately. Balance shards by historical duration and keep tests independent.
Full answer with examples