Bird
Raised Fist0
Jenkinsdevops~20 mins

CI/CD tools landscape in Jenkins - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Jenkins CI/CD Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Jenkins Pipeline Stages

Which of the following best describes the purpose of the stage directive in a Jenkins Pipeline?

AIt sets environment variables for the entire pipeline.
BIt specifies the machine where the pipeline will run.
CIt defines a distinct phase in the pipeline to organize tasks and visualize progress.
DIt triggers the pipeline to start automatically on code commit.
Attempts:
2 left
💡 Hint

Think about how Jenkins shows progress in the pipeline view.

💻 Command Output
intermediate
2:00remaining
Jenkins CLI Command Output

What is the output of the following Jenkins CLI command if the Jenkins server is running and the job build-app exists?

java -jar jenkins-cli.jar -s http://localhost:8080/ list-jobs
A
build-app
deploy-app
test-app
BError: Job 'build-app' not found
CNo jobs found
DSyntax error: missing argument
Attempts:
2 left
💡 Hint

This command lists all jobs on the Jenkins server.

🔀 Workflow
advanced
2:00remaining
Jenkins Pipeline Script Execution Order

Given this Jenkins Pipeline snippet, what is the order of printed output?

pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
    stage('Test') {
      steps {
        echo 'Testing...'
      }
    }
    stage('Deploy') {
      steps {
        echo 'Deploying...'
      }
    }
  }
}
A
Testing...
Building...
Deploying...
B
Building...
Testing...
Deploying...
C
Deploying...
Testing...
Building...
D
Building...
Deploying...
Testing...
Attempts:
2 left
💡 Hint

Stages run in the order they are defined.

❓ Troubleshoot
advanced
2:00remaining
Diagnosing Jenkins Job Failure

A Jenkins freestyle job fails with the error: hudson.AbortException: script returned exit code 1. What is the most likely cause?

AThe shell script or command run by the job returned a non-zero exit code indicating failure.
BThe Jenkins user does not have permission to view the job.
CThe job configuration is missing the build steps section.
DThe Jenkins server is down and cannot execute the job.
Attempts:
2 left
💡 Hint

Exit code 1 usually means a command failed.

✅ Best Practice
expert
3:00remaining
Securing Jenkins Credentials

Which Jenkins feature is the best practice to securely store and use sensitive information like passwords or API tokens in pipelines?

AStore secrets in plain text files on the Jenkins master server.
BHardcode passwords directly in the Jenkinsfile for easy access.
CSend secrets as pipeline parameters without encryption.
DUse Jenkins Credentials Plugin to store secrets and access them via credentials binding in pipelines.
Attempts:
2 left
💡 Hint

Think about how to keep secrets safe and not expose them in logs or code.

Practice

(1/5)
1. What is the main purpose of CI/CD tools like Jenkins in software development?
easy
A. To design user interfaces
B. To write code manually
C. To automate building, testing, and deploying software
D. To manage hardware resources

Solution

  1. Step 1: Understand CI/CD tools role

    CI/CD tools automate repetitive tasks in software development like building, testing, and deploying.
  2. Step 2: Compare options

    Options B, C, and D describe unrelated tasks. Only To automate building, testing, and deploying software matches the automation purpose.
  3. Final Answer:

    To automate building, testing, and deploying software -> Option C
  4. Quick Check:

    CI/CD tools automate software delivery = A [OK]
Hint: CI/CD tools automate software delivery steps [OK]
Common Mistakes:
  • Confusing CI/CD tools with coding or design tools
  • Thinking CI/CD tools manage hardware
  • Assuming CI/CD tools replace developers
2. Which of the following is the correct way to define a stage in a Jenkins pipeline?
easy
A. stage('Build') { steps { echo 'Building...' } }
B. step('Build') { echo 'Building...' }
C. stage: Build { echo 'Building...' }
D. buildStage { echo 'Building...' }

Solution

  1. Step 1: Recall Jenkins pipeline syntax

    Jenkins uses stage('name') { steps { ... } } to define stages.
  2. Step 2: Check options for correct syntax

    Only stage('Build') { steps { echo 'Building...' } } matches the correct syntax with stage and steps blocks.
  3. Final Answer:

    <code>stage('Build') { steps { echo 'Building...' } }</code> -> Option A
  4. Quick Check:

    Correct Jenkins stage syntax = C [OK]
Hint: Stages use stage('name') with steps block [OK]
Common Mistakes:
  • Using 'step' instead of 'stage'
  • Missing the steps block inside stage
  • Incorrect block syntax with colons or missing braces
3. Given this Jenkins pipeline snippet, what will be printed during the 'Test' stage?
pipeline {
  agent any
  stages {
    stage('Build') {
      steps { echo 'Building...' }
    }
    stage('Test') {
      steps { echo 'Testing...' }
    }
  }
}
medium
A. Testing... Building...
B. Testing...
C. Building...
D. Building... Testing...

Solution

  1. Step 1: Understand pipeline stage order

    The pipeline runs stages in order: 'Build' then 'Test'.
  2. Step 2: Identify echo outputs

    'Build' stage prints 'Building...', 'Test' stage prints 'Testing...'. Both run sequentially.
  3. Final Answer:

    Building... Testing... -> Option D
  4. Quick Check:

    Stages run in order, print messages in sequence = B [OK]
Hint: Stages run sequentially, outputs print in order [OK]
Common Mistakes:
  • Assuming stages run in parallel by default
  • Mixing output order
  • Ignoring all stages run unless skipped
4. Identify the error in this Jenkins pipeline snippet:
pipeline {
  agent any
  stages {
    stage('Deploy') {
      step { echo 'Deploying...' }
    }
  }
}
medium
A. The keyword should be 'steps' not 'step'
B. Missing agent declaration
C. Stage name must be lowercase
D. Echo command is invalid

Solution

  1. Step 1: Check pipeline syntax for stages

    Inside a stage, the correct block is steps (plural), not step.
  2. Step 2: Verify other parts

    Agent is declared, stage name case is allowed, echo is valid. Only 'step' is wrong.
  3. Final Answer:

    The keyword should be 'steps' not 'step' -> Option A
  4. Quick Check:

    Use 'steps' block inside stage = A [OK]
Hint: Inside stage use 'steps' plural block [OK]
Common Mistakes:
  • Using 'step' instead of 'steps'
  • Thinking stage names must be lowercase
  • Assuming echo is not allowed
5. You want to create a Jenkins pipeline that builds, tests, and deploys only if tests pass. Which approach best fits this CI/CD workflow?
hard
A. Skip Test stage and deploy immediately after Build
B. Define sequential stages: Build, Test, Deploy; Deploy runs only if Test succeeds
C. Deploy first, then Build and Test in any order
D. Run Build and Deploy stages in parallel, then Test last

Solution

  1. Step 1: Understand CI/CD workflow logic

    Tests must pass before deploying to avoid broken releases.
  2. Step 2: Choose pipeline structure

    Sequential stages Build -> Test -> Deploy ensure deploy runs only if tests succeed.
  3. Step 3: Evaluate other options

    Parallel or skipping tests risks deploying broken code; deploying first is illogical.
  4. Final Answer:

    Define sequential stages: Build, Test, Deploy; Deploy runs only if Test succeeds -> Option B
  5. Quick Check:

    Sequential stages with test gate = D [OK]
Hint: Deploy only after successful tests in sequence [OK]
Common Mistakes:
  • Running deploy before tests
  • Skipping tests to save time
  • Running build and deploy in parallel
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard