Bird
Raised Fist0
Jenkinsdevops~10 mins

What is Jenkins - Interactive Quiz & Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a Jenkins job from the command line.

Jenkins
java -jar jenkins-cli.jar -s http://localhost:8080 [1] MyJob
Drag options to blanks, or click blank then click option'
Abuild
Bexecute
Cstart
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'start' instead of 'build' causes errors.
2fill in blank
medium

Complete the Jenkinsfile snippet to define a pipeline stage.

Jenkins
pipeline {
  agent any
  stages {
    stage('[1]') {
      steps {
        echo 'Hello, Jenkins!'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
ADeploy
BBuild
CTest
DInit
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'Deploy' or 'Test' when the example is about building.
3fill in blank
hard

Fix the error in the Jenkinsfile to correctly declare an environment variable.

Jenkins
pipeline {
  agent any
  environment {
    GREETING = '[1]'
  }
  stages {
    stage('Example') {
      steps {
        echo "${GREETING}, Jenkins!"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A'Hello'
BHello
CGREETING
D"Hello"
Attempts:
3 left
💡 Hint
Common Mistakes
Missing quotes causes syntax errors.
4fill in blank
hard

Fill both blanks to create a Jenkins pipeline that runs a shell command only on the master branch.

Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      when {
        branch [1] '[2]'
      }
      steps {
        sh 'echo Building on master branch'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aequals
Bmaster
Cdevelop
DnotEquals
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'notEquals' or wrong branch name causes the step to skip.
5fill in blank
hard

Fill all three blanks to define a Jenkins pipeline with parameters and a conditional step.

Jenkins
pipeline {
  agent any
  parameters {
    string(name: '[1]', defaultValue: 'World', description: 'Who to greet')
  }
  stages {
    stage('Greet') {
      steps {
        script {
          if (params.[2] == '[3]') {
            echo "Hello, ${params.NAME}!"
          }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
ANAME
CWorld
DGREETING
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatched parameter names cause runtime errors.

Practice

(1/5)
1. What is Jenkins primarily used for in software development?
easy
A. Managing databases
B. Writing code manually
C. Designing user interfaces
D. Automating building, testing, and deploying software

Solution

  1. Step 1: Understand Jenkins purpose

    Jenkins is a tool that automates repetitive tasks in software development.
  2. Step 2: Identify main tasks Jenkins automates

    It automates building, testing, and deploying software to save time and reduce errors.
  3. Final Answer:

    Automating building, testing, and deploying software -> Option D
  4. Quick Check:

    Jenkins automates software tasks = A [OK]
Hint: Jenkins automates tasks, not manual coding [OK]
Common Mistakes:
  • Confusing Jenkins with coding tools
  • Thinking Jenkins designs UI
  • Assuming Jenkins manages databases
2. Which of the following is the correct way to start a Jenkins pipeline script?
easy
A. script { pipeline stages { echo 'Hello' } }
B. pipeline { agent any stages { stage('Build') { steps { echo 'Building...' } } } }
C. start pipeline { echo 'Run' }
D. build { steps { echo 'Start' } }

Solution

  1. Step 1: Recognize Jenkins pipeline syntax

    The correct pipeline starts with 'pipeline { agent any ... }' block.
  2. Step 2: Check for proper stages and steps structure

    pipeline { agent any stages { stage('Build') { steps { echo 'Building...' } } } } correctly uses stages and steps blocks with echo command.
  3. Final Answer:

    pipeline { agent any stages { stage('Build') { steps { echo 'Building...' } } } } -> Option B
  4. Quick Check:

    Correct pipeline syntax = D [OK]
Hint: Look for 'pipeline { agent any' to start scripts [OK]
Common Mistakes:
  • Missing 'pipeline' keyword
  • Incorrect block nesting
  • Using unknown keywords like 'build' or 'start'
3. Given this Jenkins pipeline snippet, what will be the output?
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        echo 'Running tests'
      }
    }
  }
}
medium
A. Running tests
B. Build completed successfully
C. Syntax error in pipeline
D. No output

Solution

  1. Step 1: Read the echo command inside the 'Test' stage

    The pipeline prints 'Running tests' during the 'Test' stage.
  2. Step 2: Confirm no syntax errors and output presence

    The syntax is correct, so the output will be the echo message.
  3. Final Answer:

    Running tests -> Option A
  4. Quick Check:

    Echo prints 'Running tests' = B [OK]
Hint: Look for echo statements inside steps for output [OK]
Common Mistakes:
  • Assuming build success message without echo
  • Thinking pipeline has syntax errors
  • Expecting no output from echo
4. Identify the error in this Jenkins pipeline snippet:
pipeline {
  agent any
  stages {
    stage('Deploy') {
      steps {
        sh 'deploy.sh'
      }
    }
  }
  post {
    always {
      echo 'Cleanup done'
    }
  }
}
medium
A. No error, pipeline is correct
B. Incorrect placement of post block outside pipeline
C. Missing closing brace for stages block
D. Missing agent declaration

Solution

  1. Step 1: Check block structure and braces

    All blocks (pipeline, stages, stage, steps, post) are properly closed.
  2. Step 2: Verify placement of post block

    Post block is correctly inside pipeline block after stages.
  3. Final Answer:

    No error, pipeline is correct -> Option A
  4. Quick Check:

    Proper block structure means no error = A [OK]
Hint: Post block goes inside pipeline, after stages [OK]
Common Mistakes:
  • Thinking post block must be inside stages
  • Missing braces in nested blocks
  • Forgetting agent declaration
5. You want Jenkins to run tests only when code is pushed to the 'main' branch. Which pipeline snippet correctly implements this?
hard
A. pipeline { agent any stages { stage('Test') { steps { echo 'Testing main branch' } } } }
B. pipeline { agent any stages { stage('Test') { when { branch 'dev' } steps { echo 'Testing main branch' } } } }
C. pipeline { agent any stages { stage('Test') { when { branch 'main' } steps { echo 'Testing main branch' } } } }
D. pipeline { agent any stages { stage('Test') { when { branch 'feature' } steps { echo 'Testing main branch' } } } }

Solution

  1. Step 1: Understand the 'when' condition for branch filtering

    The 'when { branch 'main' }' condition runs the stage only on 'main' branch.
  2. Step 2: Check which option uses 'main' branch correctly

    pipeline { agent any stages { stage('Test') { when { branch 'main' } steps { echo 'Testing main branch' } } } } uses 'main' branch in the when condition; others use different branches or no condition.
  3. Final Answer:

    pipeline { agent any stages { stage('Test') { when { branch 'main' } steps { echo 'Testing main branch' } } } } -> Option C
  4. Quick Check:

    Branch filter 'main' in when = C [OK]
Hint: Use 'when { branch 'main' }' to run only on main branch [OK]
Common Mistakes:
  • Using wrong branch name in when condition
  • Omitting when condition to filter branch
  • Placing when outside stage block
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