This presentation about "DevOps interview questions part - 1" will take you through some of the most popular questions that you face in a DevOps interview. This video covers interview questions related to source code management, continuous integration, continuous testing, configuration management, containerization, and continuous monitoring. "The DevOps Hiring Boom” claims that as many as 80 percentages of Fortune 1000 organizations are expected to adopt DevOps by 2019. If you’ve started cross-training to prepare for development and operations roles in the IT industry, you know it’s a challenging field that will take some real preparation to break into. Here are some of the most common DevOps interview questions and answers that can help you while you prepare for DevOps roles in the industry. Learn and get a deeper understanding of these questions to set you apart from the crowd in this booming industry.
This "DevOps interview questions" presentation will answer the questions related to the topics mentioned below:
1. General DevOps questions
2. Source code management - Git
3. Continuous integration - Jenkins
4. Continuous testing - Selenium
Why learn DevOps?
Simplilearn’s DevOps training course is designed to help you become a DevOps practitioner and apply the latest in DevOps methodology to automate your software development lifecycle right out of the class. You will master configuration management; continuous integration deployment, delivery, and monitoring using DevOps tools such as Git, Docker, Jenkins, Puppet, and Nagios in a practical, hands-on and interactive approach. The DevOps training course focuses heavily on the use of Docker containers, a technology that is revolutionizing the way apps are deployed in the cloud today and is a critical skillset to master in the cloud age.
After completing the DevOps training course you will achieve hands-on expertise in various aspects of the DevOps delivery model. The practical learning outcomes of this Devops training course are:
An understanding of DevOps and the modern DevOps toolsets
The ability to automate all aspects of a modern code delivery and deployment pipeline using:
1. Source code management tools
2. Build tools
3. Test automation tools
4. Containerization through Docker
5. Configuration management tools
6. Monitoring tools
DevOps jobs are the third-highest tech role ranked by employer demand on Indeed.com but have the second-highest talent deficit.
1. This DevOps training course will be of benefit the following professional roles:
2. Software Developers
3. Technical Project Managers
4. Architects
5. Operations Support
6. Deployment engineers
7. IT managers
8. Development managers
Learn more at https://www.simplilearn.com/cloud-computing/devops-practitioner-certification-training
4. 1 How is DevOps different from Agile methodology?
DevOps is a culture that allows the Development and the Operations team to work together. This results in Continuous Development,
Testing, Integration, Deployment and Monitoring of the software throughout the lifecycle.
New Code
Operations teamDevelopment
team
Work together
Production
Environment
Continuous
Deployment
Continuous
Monitoring
5. 1 How is DevOps different from Agile methodology?
Agile is a software development methodology that focuses on iterative, incremental, small and rapid releases of software along with
customer feedback.
Customer
+
Software Requirement
Developer
+
Tester
Operations
+
IT Infrastructure
Agile addresses gaps and conflicts between the Customer and Developers
6. 1 How is DevOps different from Agile methodology?
Agile is a software development methodology that focuses on iterative, incremental, small and rapid releases of software along with
customer feedback.
Customer
+
Software Requirement
Developer
+
Tester
Operations
+
IT Infrastructure
Agile addresses gaps and conflicts between the Customer and Developers
Gap
Agile is the solution
7. 1 How is DevOps different from Agile methodology?
Agile is a software development methodology that focuses on iterative, incremental, small and rapid releases of software along with
customer feedback.
Customer
+
Software Requirement
Developer
+
Tester
Operations
+
IT Infrastructure
DevOps addresses gaps and conflicts between the Developers and IT Operations
Gap
DevOps is the solution
8. 2 What are the different phases in DevOps?
Operate
Monitor
DeployPlan
Build
Code
Test
Integrate
9. 3 Mention some of the core benefits of DevOps.
Technical benefits Business benefits
• Continuous software delivery
• Less complex problems to manage
• Early detection and faster correction of
defects
• Faster delivery of features
• Stable operating environments
• Improved communication and
collaboration between the teams
10. 4 How will you approach a project that needs to implement DevOps?
The following standard approaches can be used to implement DevOps in a certain project:
Stage 1 Stage 2 Stage 3
An assessment of the existing
process and implementation for
around 2-3 weeks to identify the
improvement areas and provide a
road map for the implementation
A pilot Proof of concept (PoC) can
be done. Once it is accepted and
approved by the end users, then
actual implementation and roll out
of the project plan should be
carried out
The project is now ready for
implementing DevOps by using
version control/integration/
testing/deployment/delivery and
monitoring followed step by step
assessment road map
DevOps
POC check Project
11. 5 What is the difference between Continuous Delivery and Continuous Deployment?
Ensures code can be safely deployed on to production
Continuous Delivery
Delivers every change to a production-like environment
through rigorous automated testing
Every change that passes the automated tests is deployed to
production automatically
Continuous Deployment
Makes software development and release process faster and
more robust
There is no explicit approval from a developer and requires
a developed culture of monitoring
Ensures business applications and services function as
expected
12. 5 What is the difference between Continuous Delivery and Continuous Deployment?
Version
control
Build Staging Production
Continuous
Integration
Continuous
Delivery
Continuous
Deployment
Manual
approval
Automatic
deployment
Automated Automated
Push changes in
source code
Run, build and test
code
Deploy to a test environment,
verify, do performance testing
etc.
Deploy to production for end-
user access
13. 6 What is the role of Configuration Management in DevOps?
Configuration
Management
Allows to manage and handle
changes to multiple systems
Helps in administering and managing
several servers and maintains integrity of
the entire infrastructure
Manages IT infrastructure by
standardizing resource configurations
14. 7 How does Continuous Monitoring help in maintaining the entire architecture of the system?
Continuous Monitoring in DevOps is a process of detecting, identifying and reporting any faults
or threats in the entire infrastructure of the system
Web ServerApplication
Server
Database
Server
Ensures that all the services, applications and
resources are running on the servers properly
Monitors the status of servers and if applications
are working properly or not
Provides solution that takes care of continuous
audit, transaction inspection and controlled
monitoring
15. 8 What is the role of AWS in DevOps?
Process Analyst
Or
Designer
Process Modeler
Built for Scale
• You can manage single instance or scale to thousands using AWS services
and compute resources by simplifying provisioning, configuration and scaling
Flexible Services
• Provides ready to use flexible services without any need to install or setup a
software
Automation • AWS helps you use automation in order to automate tasks, processes and
build faster
Secure
• Using AWS Identity and Access Management (IAM), you can set user
permissions and policies
Large partner ecosystem • AWS supports a large ecosystem of partners which integrate with and extend
AWS services
16. 9 Name three important DevOps KPIs.
Mean time to failure recovery1
Deployment frequency2
Percentage of failed deployments3
This is the average time taken to recover from a failure
It is the defined by the frequency in which
the deployment occurs
This is defined by the number of times the deployment fails
17. Explain the term "infrastructure as code" in configuration management.
10
Involves writing of code to manage
configuration, deployment and automatic
provisioning
Manages data centers through machine-
readable definition files, rather than physical
hardware configuration
This approach is promoted for cloud
computing, which is marked as Infrastructure
as a Service (IaaS)
Ensures all your servers and other
infrastructure components are provisioned
consistently and effortlessly
Infrastructure as code
19. Explain the difference between Centralized and Distributed Version Control System.
11
System A
File
System B
File
Centralized VCS Server
Version Database
Version 3
Version 2
Version 1
Centralized Version Control System
Uses a central server to store all the versions of files
No developer has a copy of all the files in the local system
If the central server crashes, entire data of the project will be
lost
20. Explain the difference between Centralized and Distributed Version Control System.
11
Distributed VCS Server
Version Database
Version 3
Version 2
Version 1
Distributed Version Control System
Every developer has a copy of all the versions of the code on
their system
Improves the ability to work offline and does not rely on single
location for backups
There is no threat even if the server crashes
System A File
System B File
Version 3
Version 2
Version 1
Version
Database
Version
Database
Version 3
Version 2
Version 1
21. What is the git command that downloads any repository from GitHub to your computer?
12
(a) git push
(b) git fork
(c) git clone
(d) git commit
22. How to push a file from your local system on to GitHub repository using Git?
13
First, connect the local repository to your remote repository:
git remote add origin [copied web address]
Second, push your file to the remote repository:
git push origin master
git remote add origin https://github.com/Simplilearn-
github/test.git
23. How is bare repository different from the standard way of initializing a Git repository?
14
git init
You create a working directory with git
init
A .git subfolder is created with all the git
related revision history
git init --bare
Does not contain any working or
checked out copy of source files
Bare repositories store git revision
history in the root folder of your
repository instead of .git subfolder
Using the standard way Using the bare way
24. Which of the following CLI command can be used to rename files?
15
(a) git rm
(b) git mv
(c) git rm -r
(d) None of the above
25. What is the process to revert a commit that has already been pushed and made public?
16
1
Remove or fix the bad file in a new commit and push it
to the remote repository. Then commit it to the remote
repository using:
git commit –m “commit message”
2
Create a new commit that undoes all
the changes that were made in the bad commit.
Use the following command:
git revert <commit id>
Example: git revert 56de0938f
There are two processes through which you can revert a commit:
26. Explain the difference between git fetch and git pull.
17
Git pullGit fetch
• Git fetch only downloads new data from a
remote repository
• Does not integrate any of this new data into
your working files
• Git pull updates the current HEAD branch with
the latest changes from the remote server
• It downloads new data and integrates it
with the current working files
• Git fetch can be done any time to update the
remote-tracking branches
• Command - git fetch origin
git fetch –-all
• It tries to merge remote changes with your
local ones
• Command - git pull origin master
27. What is Git stash?
18
Developer
working with
Current branch
wants to switch to another
branch to work on
something else
But you don’t want to commit changes
to your unfinished workgit stash
solution
It takes your modified tracked files and
saves it on a stack of unfinished
changes that you can reapply at any
time
28. Explain the concept of branching in Git.
19
Suppose you are working on an
application and you want to
add a new feature to the app
You can create a new branch and build the new
feature on that branch
Master branch
New branch
New Feature
By default, you always work on the master branch
The circles on the branch represent various commits made on
the branch
After you are done with all the changes, you can merge
it to the master branch
29. What is the difference between git merge and git rebase.
20
Suppose you are working on a new feature in a dedicated branch and another team member updates the master branch
with new commits
To incorporate the new commits into your feature
branch, you use merge
• Creates an extra merge commit every time you need to
incorporate changes
• Pollutes your feature branch history
As an alternative to merging, you can rebase the
feature branch onto master
• Incorporates all the new commits in master branch
• Re-writes the project history by creating brand new
commits for each commit in the original branch
*
Master
Feature
Master
Feature
30. How do you find a list of files that has been changed in a particular commit?
The command to get a list of files that has been changed in a particular commit is:
git diff-tree –r {commit hash}
• -r flag allows the command to list individual
files
• commit hash will list all the files that were
changed or added in that commit
21
Example: git diff-tree –r 87e673f21b
31. What is a merge conflict in Git and how can it be resolved?
It arises when you have merge branches that have competing commits and Git needs your help to decide which
changes to incorporate in the final merge
Git merge conflict
Manually edit the conflicted file to select
the changes that you want
to keep in the final merge
Resolve using GitHub conflict editor
This is done when merge conflict is caused by
competing line changes i.e. when people make
different changes to the same line of the same file on
different branches in your Git repository
22
32. What is a merge conflict in Git and how can it be resolved?
22
Under your repository name, click Pull requests.
In “Pull Requests” list, click the pull request with a merge
conflict that you’d like to resolve
Near the bottom of your pull request, click Resolve
conflicts
Decide if you want to keep only your branch’s changes,
keep only the other branch’s changes or make a brand
new change, which may incorporate changes from both
branches
1
2
3
4
Resolving a merge conflict using conflict editor
33. What is a merge conflict in Git and how can it be resolved?
22
Delete the conflict markers , ,
and make changes you want in the final merge
<<<<<<< ======= >>>>>>>
If you have more than one merge conflict in your file, scroll down to the
next set of conflict markers and repeat steps four and five to resolve
your merge conflict
Once you have resolved all the conflicts in the file, click
Mark as resolved
If you have more than one file with a conflict, select the next file you
want to edit on the left side of the page under “conflicting files” and
repeat steps 4 to 7 until you've resolved all of your pull request’s merge
conflicts
5
6
7
8
34. What is a merge conflict in Git and how can it be resolved?
22
Once you’ve resolved all your merge conflicts, click Commit merge. This
merges the entire base branch into your head branch
To merge your pull request, click Merge pull request
9
10
35. What is a merge conflict in Git and how can it be resolved?
It arises when you have merge branches that have competing commits and Git needs your help to decide which
changes to incorporate in the final merge
Git merge conflict
Resolve in a local clone of the repository and push
the change to your branch on GitHub
Used for all other types of merge conflicts. You can
use the command line or a tool like GitHub desktop to
push the change
22
Git merge conflict
Manually edit the conflicted file to select
the changes that you want
to keep in the final merge
36. What is a merge conflict in Git and how can it be resolved?
22
Navigate into the local Git repository that has the merge
conflict
Generate a list of the files affected by the merge conflict.
In this example, the file styleguide.md
has a merge conflict
Open Git Bash1
2
3
Resolving a merge conflict using the command line
37. What is a merge conflict in Git and how can it be resolved?
22
To see the beginning of the merge conflict
in your file, search the file for the conflict marker
Next you’ll see , which divides your changes
from the changes in the other branch, followed by
Open any text editor, such as Sublime text or Atom, and
navigate to the file that has merge conflicts
4
5
6
Resolving a merge conflict using the command line
<<<<<<<
You’ll see the changes from the base branch after the line
<<<<<<< HEAD
open
=======
>>>>>>> BRANCH-NAME
38. Decide if you want to keep only your branch’s changes, keep
only the other branch’s changes or make a brand new change,
which may incorporate changes from both branches
What is a merge conflict in Git and how can it be resolved?
22
7
8
Resolving a merge conflict using the command line
Delete the conflict markers , ,
and make changes you want in the final merge
<<<<<<< =======
>>>>>>>
In this example, both the changes are incorporated into the final merge:
39. What is a merge conflict in Git and how can it be resolved?
22
Resolving a merge conflict using the command line
Commit your changes with a comment
9 Add or stage your changes
10
Now you can merge the branches on the command line or push your changes to your remote repository
on GitHub and merge your changes in a pull request
41. • Jenkins master pulls the code from the remote GitHub repository every time there is a code commit
• It distributes the workload to all the Jenkins slaves
• On request from Jenkins master, the slaves carry out builds and tests and produce test reports
Explain master - slave architecture of Jenkins.
23
42. What is a Jenkinsfile?
It is a text file that contains the definition of a
Jenkins pipeline and is checked into source control repository
Allows code review and iteration on
the pipeline
Permits audit trail for the pipeline
There is a single source of truth for
the pipeline which can be viewed and
edited
What it does?
24
43. Which of the following commands runs Jenkins from the command line?
(a) java –jar Jenkins.war
(b) java –war Jenkins.jar
(c) java –jar Jenkins.jar
(d) java –war Jenkins.war
25
44. What concepts are key aspects of Jenkins pipeline?
Pipeline: User-defined model of a CD pipeline.
Pipeline’s code defines entire build process, that
includes building, testing and delivering an
application
Node: A machine which is part of Jenkins
environment capable of executing a pipeline
Step: A single task that tells Jenkins what to do at a
particular point in time
Stage: Defines a conceptually distinct subset of
tasks performed through the entire pipeline (build,
test, deploy stages)
Pipeline key
aspects
26
45. Which file is used to define dependency in maven?
(a) build.xml
(b) pom.xml
(c) dependency.xml
(d) version.xml
27
46. Explain the two types of pipeline in Jenkins along with their syntax.
Jenkins provides 2 ways of developing a pipeline code: Scripted and Declarative
Scripted Pipeline: It is based on Groovy script as their Domain Specific Language. One or more node blocks does the core
work throughout the entire pipeline
Jenkinsfile (Scripted Pipeline)
node {
stage(‘Build’) {
//
}
stage(‘Test’) {
//
}
stage(‘Deploy’) {
//
}
}
1
2
3
4
5
6
7
1 Execute this pipeline or any of its stages on any available agent
2 Defines the Build stage
3 Performs steps related to Build stage
4 Defines the Test stage
5 Performs steps related to Test stage
6 Defines the Deploy stage
7 Performs steps related to Deploy stage
28
47. Explain the two types of pipeline in Jenkins along with their syntax.
Jenkins provides 2 ways of developing a pipeline code: Scripted and Declarative
Declarative Pipeline: It provides a simple and friendly syntax to define a pipeline. Here, pipeline block defines the work done
throughout the pipeline
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage(‘Build’) {
steps {
//
}
}
stage(‘Test’) {
steps {
//
}
}
stage(‘Deploy’) {
steps {
//
}
}
}
}
1 Execute this pipeline or any of its stages on any available agent
2 Defines the Build stage
3 Performs steps related to Build stage
4 Defines the Test stage
5 Performs steps related to Test stage
6 Defines the Deploy stage
7 Performs steps related to Deploy stage
1
2
3
4
5
6
7
28
48. How do you create a backup and copy files in Jenkins?
To create a backup, periodically backup your JENKINS_HOME directory
periodically JENKINS_HOME
JENKINS_HOME
contains
Build jobs configurations
Slave node configurations
Build history
To create a back-up of your Jenkins setup, copy JENKINS_HOME directory. You can also
copy a job directory to clone or replicate a job or rename the directory
files
29
49. How can you copy Jenkins from one server to another?
Copy the jobs directory from the old server to the new one
copy
Jobs directory
(old server)
Jobs directory
(new server)
• Move a job from one installation of Jenkins to another by copying the corresponding job
directory
• Create a copy of an existing job by making a clone of a job directory by a different name
• Rename an existing job by renaming a directory
Following are the ways to do it:
30
50. Name three security mechanisms Jenkins uses to authenticate users.
Jenkins uses an internal database to store user data and credentials
Jenkins can be configured to employ the authentication mechanism
used by the application server upon which it is deployed
1
2
3
31
Lightweight Directory Access Protocol (LDAP) server can be used
by Jenkins to authenticate users
51. How to deploy a custom build of a core plugin?
Steps to deploy a custom build
of a core plugin
• Copy the .hpi file to $JENKINS_HOME/plugins
• Remove the plugin’s development directory
• Create an empty file called <plugin>.hpi.pinned
• Restart Jenkins and use your custom build of a core
plugin
32
52. 33 How can you temporarily turn off Jenkins security if the administrative users have locked themselves out
of the admin console?
JENKINS_HOME folder Config.xml
contains a file
• When security is enabled, Config file contains an XML element named
useSecurity that will be set to true
• By changing this setting to false, security will be disabled the next time Jenkins is
restarted
53. What are the ways in which build can be scheduled/run in Jenkins?
• By source code management commits
• After completion of other builds
• Scheduled to run at specified time
• Manual build requests
34
54. Mention the commands that you can use to restart Jenkins manually.
35
(Jenkins_url)/restart
(Jenkins_url)/safeRestart
Forces a restart without waiting for builds
to complete
Allows all running builds to complete before it
restarts
Two ways to manually restart Jenkins:
56. What are the different Selenium components?
• Has a simple framework and should be used for
prototyping
• Has an easy to install Firefox plug-in
1 Selenium Integrated Development Environment (IDE)
• Testing framework for developer to write code in any
programming language (Java, PHP, Perl, C#, etc.)
2 Selenium Remote Control (RC)
• Applies better approach to automate the browser activities
• Does not rely upon JavaScript
3 Selenium WebDriver
• Works along with Selenium RC and run tests on
different nodes using browsers
4 Selenium Grid
36
57. What are the different exceptions in Selenium WebDriver?
TimeoutException
It is thrown when a command performing an
operation does not complete in the stipulated
time
NoSuchElementException
It is thrown when an element with certain
given attributes is not found on the web page
ElementNotVisibleException
It is thrown when an element is present in
Document Object Model (DOM), but is not
visible.
Ex: Hidden Elements defined in HTML using
type=“hidden”
SessionNotFoundException
The WebDriver is performing the action
immediately after quitting the browser
Exceptions are events that occur during the execution of a program and
disrupts the normal flow of a program’s instructions
37
58. Can Selenium test an application on an Android browser?
Selenium is capable of testing an application on an Android browser using an Android driver
You can use Selendroid or Appium
framework to test native apps or web
apps in the android browser
Sample code
38
59. What are the different test types supported by Selenium?
Functional
Regression
Load Testing
This is a kind of black-box testing in which the test cases are based on the software
specification
This testing helps to find new errors, regressions, etc., in different functional and
non-functional areas of a code after alteration
This testing seeks to monitor the response of a device after putting a load on it. It is
carried out to study the behavior of the system under certain conditions
39
60. How can you get a text of a web element?
Get command is used to retrieve text of a specified web element. The command does not return
any parameter but returns a string value.
Used for:
• Verification of messages
• Labels
• Errors displayed on the web page
Syntax:
String Text=driver.findElement(By.id(“text”)).getText();
40
61. How can you handle keyboard and mouse actions using Selenium?
You can handle keyboard and mouse events by using
Advanced User Interaction API
Advanced User Interactions API contains Actions and Action Classes
Method Description
clickAndHold()
dragAndDrop()
keyDown(modifier_key)
Clicks without releasing the current mouse location
Performs click-and-hold at the location of the source element
Performs a modifier key press (ctrl, shift, Fn, etc.)
keyUp(modifier_key) Performs a key release
41
62. Which of these options is not a WebElement Method?
(a) getText()
(b) size()
(c) getTagName()
(d) sendKeys()
42
63. When do we use findElement() and findElements()?
findElement() findElements()
• It finds the first element in the current
web page that matches to the specified
locator value
Syntax:
WebElement
element=driver.findElements(By.xpath(“//di
v[@id=‘example’]//ul//li”));
• It finds all the elements in the current
web page that matches to the specified
locator value
Syntax:
List
elementList=driver.findElements(By.
xpath(“//div[@id=‘example’]//ul//li”));
43
64. What are driver.close() and driver.quit() in WebDriver?
These are two different methods used to close the browser session in Selenium
WebDriver
To close the current browser window on which the focus is set.
In this case, there is only one browser open
driver.close()
driver.quit() It closes all the browser windows and ends the WebDriver
session using driver.dispose method
44
65. How can you submit a form using Selenium?
WebElement el = driver.findElement(By.id(“ElementID”));
el.submit();
The following lines of code will let you submit a form using Selenium
45