CJE BENCHMARK FINAL EXAM PREP
QUESTIONS AND CORRECT ANSWERS
LATEST UPDATE
1. In a Declarative Pipeline, which directive is used to define a set of key-value pairs that are
available as environment variables for all steps or stage-specific steps?
A. parameters
B. options
C. environment
D. tools
Answer: C
Conceptual Explanation: The ‘environment’ directive specifies a sequence of key-value
pairs which will be defined as environment variables for all steps in the pipeline or a
specific stage.
2. Which Jenkins security realm allows Jenkins to delegate authentication to a servlet
container?
A. Jenkins’ own user database
B. LDAP
C. Delegate to servlet container
,D. Unix user/group database
Answer: C
Conceptual Explanation: The ‘Delegate to servlet container’ option allows Jenkins to use
the authentication mechanism provided by the web server (like Tomcat or Jetty) running
the Jenkins .war file.
3. When using the ‘SSH Build Agents’ plugin, where is the primary place the public key should
be stored for the Jenkins controller to authenticate with an agent?
A. The agent’s ~/.ssh/authorized_keys file
B. The controller’s filesystem in ~/.ssh/id_rsa.pub
C. The Global Tool Configuration
D. The Jenkins system logs
Answer: A
Conceptual Explanation: For SSH authentication, the public key corresponding to the
private key held by Jenkins must be placed in the ‘authorized_keys’ file on the remote agent
machine.
4. In a Pipeline script, which block is used to ensure code runs regardless of whether the build
succeeded, failed, or was aborted?
A. post { success { … } }
B. post { cleanup { … } }
, C. post { always { … } }
D. finally { … }
Answer: C
Conceptual Explanation: The ‘always’ condition in the post section of a Declarative
Pipeline executes regardless of the completion status of the pipeline run.
5. What is the primary benefit of using a ‘Jenkinsfile’ in a Source Control Management (SCM)
system?
A. It enables ‘Pipeline as Code’, allowing versioning and code review of the build process.
B. It allows for manual triggering of builds only.
C. It eliminates the need for any plugins.
D. It hides the build logic from developers.
Answer: A
Conceptual Explanation: Storing the Pipeline in a Jenkinsfile within SCM allows the build
process to be versioned, audited, and reviewed alongside the application code.
6. Which global variable provides access to the build number in a Jenkins Pipeline?
A. Both B and C are valid
B. currentBuild.number
C. env.BUILD_NUMBER
QUESTIONS AND CORRECT ANSWERS
LATEST UPDATE
1. In a Declarative Pipeline, which directive is used to define a set of key-value pairs that are
available as environment variables for all steps or stage-specific steps?
A. parameters
B. options
C. environment
D. tools
Answer: C
Conceptual Explanation: The ‘environment’ directive specifies a sequence of key-value
pairs which will be defined as environment variables for all steps in the pipeline or a
specific stage.
2. Which Jenkins security realm allows Jenkins to delegate authentication to a servlet
container?
A. Jenkins’ own user database
B. LDAP
C. Delegate to servlet container
,D. Unix user/group database
Answer: C
Conceptual Explanation: The ‘Delegate to servlet container’ option allows Jenkins to use
the authentication mechanism provided by the web server (like Tomcat or Jetty) running
the Jenkins .war file.
3. When using the ‘SSH Build Agents’ plugin, where is the primary place the public key should
be stored for the Jenkins controller to authenticate with an agent?
A. The agent’s ~/.ssh/authorized_keys file
B. The controller’s filesystem in ~/.ssh/id_rsa.pub
C. The Global Tool Configuration
D. The Jenkins system logs
Answer: A
Conceptual Explanation: For SSH authentication, the public key corresponding to the
private key held by Jenkins must be placed in the ‘authorized_keys’ file on the remote agent
machine.
4. In a Pipeline script, which block is used to ensure code runs regardless of whether the build
succeeded, failed, or was aborted?
A. post { success { … } }
B. post { cleanup { … } }
, C. post { always { … } }
D. finally { … }
Answer: C
Conceptual Explanation: The ‘always’ condition in the post section of a Declarative
Pipeline executes regardless of the completion status of the pipeline run.
5. What is the primary benefit of using a ‘Jenkinsfile’ in a Source Control Management (SCM)
system?
A. It enables ‘Pipeline as Code’, allowing versioning and code review of the build process.
B. It allows for manual triggering of builds only.
C. It eliminates the need for any plugins.
D. It hides the build logic from developers.
Answer: A
Conceptual Explanation: Storing the Pipeline in a Jenkinsfile within SCM allows the build
process to be versioned, audited, and reviewed alongside the application code.
6. Which global variable provides access to the build number in a Jenkins Pipeline?
A. Both B and C are valid
B. currentBuild.number
C. env.BUILD_NUMBER