Top 30 Jenkins interview questions

The blogs provides the common asked interview questions on Jenkins when appeared for DevOps development in IT job opening.  Jenkins helps in automatically the build process for developers once the code is check-in to the Source Code Repository  

Jenkins Interview Questions and Answers

1) What is Continuous Integration in DevOps ?

DevOps supports Continuous Integration and Continuous Development (CI /CD) as a process which enables developers to provide the code fix for the raised defects on priority. Once the code changes are merged into the Version Control System, automatic build deployment process gets started. This allows developers to quick check the build errors and make corrections.

Continuous Integration allows to perform the below activities:

  • Automated build deployment process
  • Allows to executes Junit test cases
  • Allows to validate business scenarios by invoking APIs to test the functional test cases
  • Allows to generate build and process related reports
  • Allows easy integration with other DevOps Tool

2) What is Jenkins and why it is commonly used ?

Jenkins is the open source continuous  integration (CI) tool which tracks the source version control , automate the build process once the code is checked in to the source code repository , monitor the build process, sends notifications and alerts in case of build failures.

Jenkins allows to integrate plug-ins for Junit testing, coding standard violations, Junit Code Coverage , etc. and helps to get the integrated testing done before it is being mad available as the new build for testers and business users.

3) Describe the features of Jenkins ?

The below given are the features of Jenkins

  • Jenkins is a open source continuous integration tool
  • Jenkins is one of the most commonly used tool for Continuous Integration and Continuous Development (CI /CD)
  • Jenkins can be installed on heterogenous environments supporting different operating system
  • Jenkins can be easily distributed among different machines
  • Jenkins provide extensibility by integrating plug-ins
  • Jenkins provides easy configuration setup
  • Jenkins provided pipeline support
  • Jenkins can be easily upgraded
  • Jenkins can be integrated with other DevOps tool
  • Jenkins provide easy documentation

4) Provide advantages of using Jenkins ?

Jenkins provide the below given advantages

  • Easy to use code integration and build deployment process
  • Allows to perform harness test by integrating Junit test cases
  • Jenkins is a free open source tool
  • Jenkins provides platform independence
  • Jenkins provide numerous plug-ins to integrated and support DevOps Development Activities
  • Build errors / bugs can be tracked in the early stage of deployment
  • Successful builds with same version can be deployed to higher environments with ease
  • Build notifications with build status and build errors helps in code fix and improving overall integration process

5) What are the pre-requisites to install Jenkins ?

Jenkins can be installed on Windows, Linux and MacOS. Jenkins can be integrated with Docker by uploading the latest Jenkins Image to run as the “container” . Docker can also be integrated easily with Kubernetes.

Jenkins uses Application Server as Jetty to run as a standalone application within its own process with the built-in Java Servlet Container

The below system requirements need to be checked before installing Jenkins

  • Minimum of 256MB of RAM
  • Minimum of 1GB Disk space
  • Jenkins can be installed using Java 8 and Java 11 only for both 32-bit and 64-bit versions.
  • Java 9 , Java 10 and Java 12 are not yet supported
  • Jenkins support Open JDK 8 and Open JDK11

6) How maven integration with Jenkins is useful ?

Maven is a build management tool which stores all the build dependencies in pom.xml which helps in building, testing and running the code. Maven support the project testing life cycle and thus when integrated with Jenkins, it becomes useful to test the project code changes during the deployment process to identify the build specific errors

7) Name few integrated plugins with Jenkins ?

The below given are the few plugins that can be integrated with Jenkins

  • Pipeline : REST API
  • GitHub Branch Source
  • Bitbucket Branch Source
  • Junit Attachments
  • Amazon S3 Publisher
  • AWS Code Commit Trigger

8) What is Jenkins Pipeline ?

Jenkins Pipeline is a combination of plugins which support in implementing continuous delivery pipelines into Jenkins

Jenkins supports Continuous Delivery (CD) process by automating the build process by retrieving the latest source version and deploying it to become it available for business users and customers.

Jenkins Pipeline uses the https://www.jenkins.io/doc/book/pipeline/syntax/ to execute as a “code” to make the deployment process simple for even complex scenarios also. Jenkins Pipeline defines the build process in the test file Jenkinsfile and commits the text file in the project source control repository. Jenkinsfile performs the below steps:

  • Automates the Pipeline build process for pull requests from all branches
  • helps in code review
  • Provides audit trail for the Pipeline
  • Common repository for the Pipeline even though multiple code commits

9) Describe syntax types supported by Jenkinsfile ?

Jenkinsfile can be written using below given syntax

  • Declarative Pipeline Syntax: Provides more syntax features and helps in reading and writing the code in a easy way. The top-level of the Pipeline must be a block with Pipeline { } . The Blocks supports only Sections, Directive, Steps and assignment statements. Does not support Semicolon as statement separators
  • Scripted Pipeline Syntax: Scripted Pipelines Syntax is built using Groovy and provides all possible features of Groovy which helps in implementing continuous delivery process . Scripted Pipeline executes the Jenkinsfile in the top-bottom hierarchy model . Scripted Pipeline handles conditions using if-else and captures the exceptions using try-catch blocks.

10) Which commands can be used to start Jenkins manually ?

The below given commands can be sued to restart Jenkins manually

  • (<JENKINS_ENVIRONMENT_URL>)/restart: enables the force start even if the build is in progress
  • (<JENKINS_ENVIRONMENT_URL>)/safeRestart: enables restart when all running build get completed

11) What are the available build statuses in Jenkins ?

The Jenkins provides the below given build status

  • Aborted: When the build is time-out or manually stopped by the user
  • Failed: When the build deployment stopped due to fatal error
  • Stable: When the build is successful
  • Unstable : When the build was successful but it got Junit test failed
  • Successful : When build has compiled with No errors

12) Name few SCM Tools supported by Jenkins ?

The below given SCM Tools can be integrated with Jenkins

  • Git
  • Clearcase
  • CVS
  • SubVersion
  • Mercurial

13) How to start Jenkins using command-line ?

The Jenkins can be started from command line using jenkins.exe

14) What is a job in Jenkins ?

The term job is deprecated in Jenkins and now it is called as Project.

A job or project is a set of task defined for Jenkins to consider during the Continuous Integration deployment process . A task could be source code compilation, Junit Code Coverage, executing Junit Test Cases, deployment to the specific web server, etc.

15) Describe to build a job in Jenkins ?

The below steps can be provided to build a job:

  • Click on Jenkins Dashboard -> New Item
  • Select Freestyle Project Option
  • Provide job details like build triggers, SCM, etc.
  • Provide the file location that need to be part of the build job
  • Click ‘Add Build Step’ and select the build option
  • Click ‘Build Now’ . This saves the build configuration and run the build

16) How to integrate a 3rd party tool in Jenkins?

The below steps can be performed in Jenkins to integrate 3rd Party tool

  • Install the Node
  • Install the Jenkins plugin code from Jenkins Admin Console
  • Navigate to Admin-> Manage -> Configure Settings
  • Configure Node to build job in the Jenkins Pipeline

17) Explain user authentication process in Jenkins ?

The below steps can be performed in Jenkins to authenticate users

  • Persist the user credentials in the database
  • Configure Jenkins to authenticate user using LDAP Server
  • Configure Jenkins to authenticate user defined by the server where Jenkins is deployed

18) Difference between Jenkins and Bamboo ?

Jenkins DeploymentBamboo Deployment
Jenkins is an open source continuous integration toolBamboo requires commercial continuous integration tool
Jenkins plugins and development release is supported by Jenkins CommunityBamboo Development Team owns the changes
Due to multiple plugin and SCM Tool integration, Jenkins is less user friendly interfaceBamboo provides user friendly interface
Provides multiple plugins for integrationBamboo provides more built-in functionality and less plugins

19) Explain Multibranch Pipeline in Jenkins ?

The below given steps can be performed for creating multibranch pipeline in Jenkins

  • Click on Jenkins Dashboard -> New Item
  • Provide the Project Name
  • Select ‘Multibranch Pipeline’ as an option
  • Select source code repository location and provide credentials
  • Save the Project
  • Jenkins creates multibranch Pipeline for repository and pull requests from the branches
  • To connect to repository we need URL from repository settings called as HookURL
  • Add the HookURL to Webhooks section
  • Jenkins can now automatically run the build

20) Difference between Jenkins, Maven and Ant ?

JenkinsMavenAnt
Jenkins is a continuous integration toolMaven is a Build Management ToolAnt is Java library for building code
Jenkins automate the software deployment processMaven stores project dependencies in pom.xml for build deployment processhelps in building code deployment using xml
Jenkins provide Plugins for integrationdoes not provide plugin integrationdoes not provide plugin integration

21) Give Environment variable names defined in Jenkins?

  • $NODE_NAME
  • $JOB_NAME
  • $WORKSPACE
  • $JOB_URL
  • $BUILD_URL

22) What is flow control in Jenkins ?

Flow control is mechanism used by Scripted Pipeline structure for executing the Jenkinsfile from top to bottom approach

23) What is Agent Directive in Jenkins?

Agent Directive lets Jenkins know how to and where to execute the pipeline. The agent directive is provided at the top-level of the pipeline block.

24) How can we schedule a build in Jenkins?

The below given options can be sued for scheduling a build in Jenkins

  • Schedule a Jenkins build using source code management commits
  • Schedule a Jenkins build when all other build get completed
  • Schedule a Jenkins build for a specified time as cron job
  • Manually raise build request

25) What Does JENKINS_HOME directory contains ?

The JENKINS_HOME directory contains configurations, settings & logs

26) What step to perform when the pipeline first job is successful but second job failed ?

Restart the pipeline from the point where it failed by doing ‘restart from stage’

27) How to automate testing in Jenkins?

Automated tests can be executes using Selenium or maven. The test runs can be scheduled and every time test is executed by Jenkins, it send the report with test results

28) Name other continuous integration tools ?

  • Bamboo
  • ThoughtWorks
  • Perforce
  • Integrity


Top 30 XML Interview Questions

The blog provides the commonly asked XML Interview Questions, XML interview questions on XML benefits, XML interview questions on SAX Parser, XML interview questions on DOM Parser, XML interview questions on Valid XML Document, XML interview questions on XML HttpRequest, XML interview questions on namespace, XML interview questions on XML vs HTML , XML interview questions on XLink , Xpointer and many more

XML Interview Questions are useful for the preparation of  competitive exams or IT professionals job openings.  

XML Interview Questions & Answers

1) What is XML?

XML stands for Extensible Markup language. XML is a markup language which is defined as a common standard to store and transport data.

XML specific data attributes can be sent from any programming language and can be read through any programming language as each programming language uses the same XML standard.

XML allows to create user-defined tags for storing and displaying the data which are both human and machine readable

For instance, a sample XML structure for User Info

<?xml version="1.0" encoding="UTF-8"?>
<userInfo>
  <firstName>Mohit</firstName>
  <lastName>Sharma</lastName>
  <City>Chandigarh</City>
  </userInfo>

2) Describe the benefits of XML ?

The below given are the XML benefits

  • XML is W3C Standard endorsed by software industry market leaders
  • XML provides tags which easy to understand and learn
  • XML supports tags and that makes it Extensible language
  • XML is scalable as it is written using tags that contains text
  • XML documents are faster to access and read
  • XML provides flexibility as tags can be added and edited easily

3) Describe well-formed XML document?

The well formed XML documents should have features

  • XML document must have the root element
  • XML document should have the Version specified
  • XML elements should be properly nested
  • XML tags should be closed properly
  • XML values should be defined within double-quotes ( ” ” )

4) What is an XMl Element ?

An XML document contains XML elements to form a complete XML data request. An XML tag defined with the start and end tag including the value is termed as an XML element. An XML element can contain text, attributes, other XML elements.

An XML example displaying the XML Elements

  <onlinestore>
  <clothes category="women">
    <type>Jeans</type>
    <brand>Levis</brand>
    <year>2021</year>
    <price>79.99</price>
  </clothes>
  <clothes category="men">
    <type>Jeans</type>
    <brand>Diesel</brand>
    <year>2021</year>
    <price>99.99</price>
  </clothes>
</onlinestore>

5) What is an XML Attribute?

XML elements can have attributes which allows to contain data related to specific XML element in the XML document

In the above example , element clothes ahs the attribute category defined

<!-- exmaple for XML attribute -->
<clothes category="women">
or 
<user name="Mohit Sharma">

6) What is Uniform Resource Identifier (URI) ?

A Uniform Resource Identifier (URI) is a string of characters which helps in identifying an Internet Resource

Types of Uniform Resource Identifier (URI):

  • Uniform Resource Locator (URL): helps in identifying an Internet Domain Address
  • Uniform Resource Name (URN) : helps in identifying an Internet Resource Name

7) What is XML Namespace ?

XML namespace allows XML element to avoid naming conflict. There could be possibility of having same element name when referenced in the XML document.

  • The XML namespace should be defined with prefix namespace
  • The XML namespace should be defined in the xmlns attribute .
  • The xmlns attribute should be in the start tag of the XML element
  • The XML namespace syntax is: xmlns:prefix=”URI

8) Explain XML HttpRequest ?

The XML HttRequest is :

  • The XML HttpRequest is an object supported by all browsers to request data from server
  • The XML HttpRequest allows to update the web page without reloading the page
  • The XML HttpRequest send data request to web server at the time of page load
  • The XML HttpRequest receives requested data from web server when the page is loaded
  • The XML HttpRequest sends updated data to web server
  • The XML HttpRequest receives and sends the data using AJAX
  • The responseText property in the XML HttpRequest returns response as a string
  • The responseXML property in the XML HttpRequest returns response as XML DOM Object

9) Explain XML Parser ?

The XML Parser is :

  • XML Parser is used to access and make changes in the XML
  • All browsers supports built-in XML Parser
  • The XML Parser converts the received text into XML DOM Object
  • XML DOM (Document Object Model) defines the methods and properties for updating XML data
  • The XML DOM Parser is created using syntax parser = new DOMParser();
  • The XML parser creates a new XML DOM object using the text string

xmlDoc = parser.parseFromString(text,”text/xml”);

<!DOCTYPE html>
<html>
<body>
<p id="store"></p>
<script>
var parser, xmlDoc;
var text =   "<onlinestore>  <clothes>" +
   "<type>Jeans</type> " + 
   " <brand>Levis</brand> " + 
   " <year>2021</year> " + 
   " <price>79.99</price> " + 
   " </clothes> </onlinestore>  " ;
parser = new DOMParser();
xmlDoc = parser.parseFromString(text,"text/xml");
document.getElementById("store").innerHTML =
xmlDoc.getElementsByTagName("type")[0].childNodes[0].nodeValue;
</script>
</body>
</html>

Output:
Jeans

10) How a version is shown in XML ?

XML provides version tag to show the XML version

<?xml version="1.0" encoding="UTF-8"?>

11) Difference between XML and HTML ?

XMLHTML
An XML is a Tool based on W3C Standard to store and transport dataHTML is a language that interprets the received data
XML ensures what data is being sentHTML ensure how data is displayed
XML is case sensitiveHTML is not case sensitive
XML allows to create user-defined tagsHTML provides built-in tags
A well formed XML should have the closing tagClosing tags are not mandatory in HTML
XML is dynamicHTML is static
XML preserves whitespacesHTML does not preserve whitespaces
XML vs HTML

12) What is XML DOM ?

XML DOM stands for Document Object Model which represents the XML Document Structure. XML DOM allows to access and manipulate XML data

13) Explain SAX in XML ?

  • SAX stands for Simple API for XML
  • SAX is used as an alternative approach for DOM Parser
  • SAX allows to read data from the XML Document but does not allows XML update
  • SAX is a sequential XML Parser as it reads the XML document sequentially
  • SAX consumes less memory as it does not maintain any specifications like DOM

14) What is DTD in XML ?

DTD stands for Document Type Definition and is used to provide the XML Document Structure using XML elements and attributes. A XML document is considered a “well-formed” document if it is validated against DTD

Example for Well formed XML with DTD

<!DOCTYPE – indicates the root element for DT

<!ELEMENT – indicates the XML element of #PCDATA type

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE UserInfo  "user.dtd">  
<userInfo>
  <firstName>Mohit</firstName>
  <lastName>Sharma</lastName>
  <city>Chandigarh</city>
</userInfo>

<!-- user.dtd-->
<!ELEMENT employee (firstName,lastName,city)>  
<!ELEMENT firstName (#PCDATA)>  
<!ELEMENT lastName (#PCDATA)>  
<!ELEMENT city (#PCDATA)>  

15) Explain steps to apply DTD to an XML?

The below steps need to be performed to apply DTD to an XML Document

  • Create a DTD File with element and attributes
  • Provide the DTD Definition in the XML Document
  • Provide the reference of DTD file in the XML Document

16) What is XSL ?

  • XSL stands for Extensible Stylesheet Language
  • XSL provides stylesheet which helps in displaying XML data in a specific format

17) What is XSLT ?

  • XSLT stands for Extensible Stylesheet Language Transformations
  • XSLT is the recommended stylesheet language for XML
  • XSLT used XPath for traversing the XML Document
  • XSLT allows to add or remove XML elements and attribute based on user requirement
  • XSLT allow to rearrange , hide and sort XML elements and attributes

18) What is XQuery in XML ?

XQuery is a W3C recommendation. XQuery in XML is similar to SQL for Database which allows to query the XML data using the built-n XPath expression

XQuery can be used to transform XML data to HTML, helps in generating reports, passing requested data to Web Service, etc.

for $x in doc("store.xml")/onlinestore/clothes
where $x/price>70
order by $x/brand
return $x/brand

19) What is XLink in XML ?

XLink is a W3C recommendation and is useful when we need to create hyperlinks in the XML Document for any existing XML element

<?xml version="1.0" encoding="UTF-8"?>
<sitepage xmlns:xlink="http://www.planforexams.com/2021/xlink">
  <sitepage xlink:type="simple" xlink:href="http://www.planforexams.com">Planforexams.com -Online Exam Preparation Site</homepage>
</sitepage>

20) What is an XML schema ?

XML Schema is an alternate to DTD which describes the structure of XML Document. An XML Document with correct syntax, validated against the XML schema is termed as “Well Formed” and “Valid”

<xs:element name="address">
<xs:complexType>
	  <xs:sequence>
		<xs:element name="firstName" type="xs:string"/>
		<xs:element name="lastName" type="xs:string"/>
		<xs:element name="city" type="xs:string"/>
		<xs:element name="state" type="xs:string"/>
		<xs:element name="country" type="xs:string"/>
	  </xs:sequence>
</xs:complexType>
</xs:element>

21) Can XML files be viewed in browsers?

Yes, XML files are supported by all browsers but it does not display as HTML Pages

22) Difference between a simple element and complex type in XML ?

Simple Element:

  • Simple elements in XML are text-based elements.
  • Simple element does not hold much attributes but can contain child element.
  • Simple element cannot be empty

Complex Type:

  • A Complex Type is a combination of multiple elements and attributes
  • A Complex Type supports sub-elements among elements
  • A Complex Type supports empty element

23) For what purpose diffgram is used in XML ?

Diffgram is an XML format used to identify the current and original XML versions

24) What is XSNL ?

XSNL stands for XML Search Neutral Language which interacts with target system for meta search

25) What is CDATA in XML ?

CDATA is considered as unparsed character data . Thus , when we have the requirement not to get the XML data parsed then we should use CDATA.

The tags inside the CDATA are not treated as markup and thus not parsed

<?xml version="1.0"?>  
<!DOCTYPE userInfo "user.dtd">  
<userInfo> 
<![CDATA[  
  <firstName>Mohit</firstName>
  <lastName>Sharma</lastName>
  <city>Chandigarh</city>
]]>   
</userInfo> 

26) What is Xpointer in XML ?

Xpointer in XML allows hyperlinks (created using XLink) to point specific XML data within the XML Document

27) What is XML Data Binding ?

Representing the XML Document as an object in memory is known as XML Data Binding

28) Give an example of XML Encoding error ?

The below given could be considered as XML Encoding error

  • Invalid Character in the XML Document
  • Unsupported character encoding

29) What are the different XML APIs ?

The XML APIs can be classified as given below:

  • Tree-based APIs: DOM Parser compiles the XML Document in a tree like structure.
  • Event-based APIs: SAX Parser uses the built -in parsing events to traverse the XML Document

30) what is PCDATA in XML?

PCDATA is considered as parsed character data. XML parsers are used to parse all the text in an XML document. The tags inside the CDATA are treated as markup and thus parsed