Interview Questions Flashcards

1
Q
  1. What do you know about DevOps?
    https://www.simplilearn.com/tutorials/devops-tutorial/devops-interview-questions
    Be Creative:deploy back with azure and front with aws using IaC, Terraform
A

Your answer must be simple and straightforward. Begin by explaining the growing importance of DevOps in the IT industry. Discuss how such an approach aims to synergize the efforts of the development and operations teams to accelerate the delivery of software products, with a minimal failure rate. Include how DevOps is a value-added practice, where development and operations engineers join hands throughout the product or service lifecycle, right from the design stage to the point of deployment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. How is DevOps different from agile methodology?
A

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.
Check Images
Agile is a software development methodology that focuses on iterative, incremental, small, and rapid releases of software, along with customer feedback. It addresses gaps and conflicts between the customer and developers.
DevOps addresses gaps and conflicts between the Developers and IT Operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. Which are some of the most popular DevOps tools?
A
Selenium
Puppet
Chef
Git
Jenkins
Ansible
Docker

Check them out

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. What are the different phases in DevOps?
A

The various phases of the DevOps lifecycle are as follows:

Plan - Initially, there should be a plan for the type of application that needs to be developed. Getting a rough picture of the development process is always a good idea.
Code - The application is coded as per the end-user requirements.
Build - Build the application by integrating various codes formed in the previous steps.
Test - This is the most crucial step of the application development. Test the application and rebuild, if necessary.
Integrate - Multiple codes from different programmers are integrated into one.
Deploy - Code is deployed into a cloud environment for further usage. It is ensured that any new changes do not affect the functioning of a high traffic website.
Operate - Operations are performed on the code if required.
Monitor - Application performance is monitored. Changes are made to meet the end-user requirements.
*Check Image**

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. Mention some of the core benefits of DevOps.
A

The core benefits of DevOps are as follows:

Technical benefits
Continuous software delivery
Less complex problems to manage
Early detection and faster correction of defects
Business benefits
Faster delivery of features
Stable operating environments
Improved communication and collaboration between the teams
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  1. How will you approach a project that needs to implement DevOps?
A

The following standard approaches can be used to implement DevOps in a specific project:

Stage 1

An assessment of the existing process and implementation for about two to three weeks to identify areas of improvement so that the team can create a road map for the implementation.

Stage 2

Create a proof of concept (PoC). Once it is accepted and approved, the team can start on the actual implementation and roll-out of the project plan.

Stage 3

The project is now ready for implementing DevOps by using version control/integration/testing/deployment/delivery and monitoring followed step by step.

By following the proper steps for version control, integration, testing, deployment, delivery, and monitoring, the project is now ready for DevOps implementation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. What is the difference between continuous delivery and continuous deployment?
A
  1. Continuous Delivery 2.Continuous Deployment
  2. Ensures code can be safely deployed on to production 2.Every change that passes the automated tests is deployed to production automatically
  3. Ensures business applications and services function as expected 2.Makes software development and the release process faster and more robust
  4. Delivers every change to a production-like environment through rigorous automated testing 2.There is no explicit approval from a developer and requires a developed culture of monitoring

Check Image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  1. What is the role of configuration management in DevOps?
A
  1. Enables management of and changes to multiple systems.
  2. Standardizes resource configurations, which in turn, manage IT infrastructure.
  3. It helps with the administration and management of multiple servers and maintains the integrity of the entire infrastructure.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  1. How does continuous monitoring help you maintain the entire architecture of the system?
A

Check Image
Continuous monitoring in DevOps is a process of detecting, identifying, and reporting any faults or threats in the entire infrastructure of the system.

  1. Ensures that all services, applications, and resources are running on the servers properly.
  2. Monitors the status of servers and determines if applications are working correctly or not.
  3. Enables continuous audit, transaction inspection, and controlled monitoring.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. What is the role of AWS in DevOps?
A

AWS has the following role in DevOps:

  1. Flexible services - Provides ready-to-use, flexible services without the need to install or set up the software.
  2. Built for scale - You can manage a single instance or scale to thousands using AWS services.
  3. Automation - AWS lets you automate tasks and processes, giving you more time to innovate
  4. Secure - Using AWS Identity and Access Management (IAM), you can set user permissions and policies.
  5. Large partner ecosystem - AWS supports a large ecosystem of partners that integrate with and extend AWS services.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. Name three important DevOps KPIs.
A
  1. Meantime to failure recovery - This is the average time taken to recover from a failure.
  2. Deployment frequency - The frequency in which the deployment occurs.
  3. Percentage of failed deployments - The number of times the deployment fails.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. Explain the term “Infrastructure as Code” (IaC) as it relates to configuration management.
A
  1. Writing code to manage configuration, deployment, and automatic provisioning.
  2. Managing data centers with machine-readable definition files, rather than physical hardware configuration.
  3. Ensuring all your servers and other infrastructure components are provisioned consistently and effortlessly.
  4. Administering cloud computing environments, also known as infrastructure as a service (IaaS).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
  1. How is IaC implemented using AWS?
A

Start by talking about the age-old mechanisms of writing commands onto script files and testing them in a separate environment before deployment and how this approach is being replaced by IaC. Similar to the codes written for other services, with the help of AWS, IaC allows developers to write, test, and maintain infrastructure entities in a descriptive manner, using formats such as JSON or YAML. This enables easier development and faster deployment of infrastructure changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. Why Has DevOps Gained Prominence over the Last Few Years?
A

Before talking about the growing popularity of DevOps, discuss the current industry scenario. Begin with some examples of how big players such as Netflix and Facebook are investing in DevOps to automate and accelerate application deployment and how this has helped them grow their business. Using Facebook as an example, you would point to Facebook’s continuous deployment and code ownership models and how these have helped it scale up but ensure the quality of experience at the same time. Hundreds of lines of code are implemented without affecting quality, stability, and security.

Your next use case should be Netflix. This streaming and on-demand video company follow similar practices with fully automated processes and systems. Mention the user base of these two organizations: Facebook has 2 billion users while Netflix streams online content to more than 100 million users worldwide.

These are great examples of how DevOps can help organizations to ensure higher success rates for releases, reduce the lead time between bug fixes, streamline and continuous delivery through automation, and an overall reduction in manpower costs.

We will now look into the next set of DevOps Interview Questions that includes - Git, Selenium, Jenkins.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  1. What are the fundamental differences between DevOps & Agile?
A

The main differences between Agile and DevOps are summarized below:

  1. Characteristics
  2. Agile
  3. DevOps
  4. Work Scope
  5. Only Agility
  6. Automation needed along with Agility
  7. Focus Area
  8. Main priority is Time and deadlines
  9. Quality and Time management are of equal priority
  10. Feedback Source
  11. The main source of feedback - customers
  12. The main source of feedback - self (tools used for monitoring)
  13. Practices or Processes followed
  14. Practices like Agile Kanban, Scrum, etc., are followed.
  15. Processes and practices like Continuous Development (CD), Continuous Integration (CI), etc., are followed.
  16. Development Sprints or Release cycles
  17. Release cycles are usually smaller.
  18. Release cycles are smaller, along with immediate feedback.
  19. Agility
  20. Only development agility is present.
  21. Both in operations and development, agility is followed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  1. What are the anti-patterns of DevOps?
A

Patterns are common practices that are usually followed by organizations. An anti-pattern is formed when an organization continues to blindly follow a pattern adopted by others but does not work for them. Some of the myths about DevOps include:

  1. Cannot perform DevOps → Have the wrong people
  2. DevOps ⇒ Production Management is done by developers
  3. The solution to all the organization’s problems ⇒ DevOps
  4. DevOps == Process
  5. DevOps == Agile
  6. Cannot perform DevOps → Organization is unique
  7. A separate group needs to be made for DevOps
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
  1. What are the benefits of using version control?
A

Here are the benefits of using Version Control:

  1. All team members are free to work on any file at any time with the Version Control System (VCS). Later on, VCS will allow the team to integrate all of the modifications into a single version.
  2. The VCS asks to provide a brief summary of what was changed every time we save a new version of the project. We also get to examine exactly what was modified in the content of the file. As a result, we will be able to see who made what changes to the project.
  3. Inside the VCS, all the previous variants and versions are properly stored. We will be able to request any version at any moment, and we will be able to retrieve a snapshot of the entire project at our fingertips.
  4. A VCS that is distributed, such as Git, lets all the team members retrieve a complete history of the project. This allows developers or other stakeholders to use the local Git repositories of any of the teammates even if the main server goes down at any point in time.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
  1. Describe the branching strategies you have used.
A

To test our knowledge of the purpose of branching and our experience of branching at a past job, this question is usually asked.

Below topics can help in answering this DevOps interview question -

  1. Release branching - We can clone the develop branch to create a Release branch once it has enough functionality for a release. This branch kicks off the next release cycle, thus no new features can be contributed beyond this point. The things that can be contributed are documentation generation, bug fixing, and other release-related tasks. The release is merged into master and given a version number once it is ready to ship. It should also be merged back into the development branch, which may have evolved since the initial release.
  2. Feature branching - This branching model maintains all modifications for a specific feature contained within a branch. The branch gets merged into master once the feature has been completely tested and approved by using tests that are automated.

Task branching - In this branching model, every task is implemented in its respective branch. The task key is mentioned in the branch name. We need to simply look at the task key in the branch name to discover which code implements which task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
  1. Can you explain the “Shift left to reduce failure” concept in DevOps?
A

Shift left is a DevOps idea for improving security, performance, and other factors. Let us take an example: if we look at all of the processes in DevOps, we can state that security is tested prior to the deployment step. We can add security in the development phase, which is on the left, by employing the left shift method. [will be depicted in a diagram] We can integrate with all phases, including before development and during testing, not just development. This most likely raises the security level by detecting faults at an early stage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
  1. What is the Blue/Green Deployment Pattern?
A

This is a method of continuous deployment that is commonly used to reduce downtime. This is where traffic is transferred from one instance to another. In order to include a fresh version of code, we must replace the old code with a new code version.

The new version exists in a green environment and the old version exists in a blue environment. After making changes to the previous version, we need a new instance from the old one to execute a newer version of the instance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q
  1. What is Continuous Testing?
A

Continuous Testing constitutes the running of automated tests as part of the software delivery pipeline to provide instant feedback on the business risks present in the most recent release. In order to prevent problems in step-switching in the Software delivery life-cycle and to allow Development teams to receive immediate feedback, every build is continually tested in this manner. This results in significant increase in speed in a developer’s productivity as it eliminates the requirement for re-running all the tests after each update and project re-building.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q
  1. What are the benefits of Automation Testing?
A

Some of the advantages of Automation Testing are -

Helps to save money and time.
Unattended execution can be easily done.
Huge test matrices can be easily tested.
Parallel execution is enabled.
Reduced human-generated errors, which results in improved accuracy.
Repeated test tasks execution is supported.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
  1. What is Automation Testing?
    Test automation or manual testing Automation is the process of automating a manual procedure in order to test an application or system. Automation testing entails the use of independent testing tools that allow you to develop test scripts that can be run repeatedly without the need for human interaction.
A
  1. What are the benefits of Automation Testing?

Some of the advantages of Automation Testing are -

  1. Helps to save money and time.
  2. Unattended execution can be easily done.
  3. Huge test matrices can be easily tested.
  4. Parallel execution is enabled.
  5. Reduced human-generated errors, which results in improved accuracy.
  6. Repeated test tasks execution is supported.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q
  1. How to automate Testing in the DevOps lifecycle?
A

Developers are obliged to commit all source code changes to a shared DevOps repository.

Every time a change is made in the code, Jenkins-like Continuous Integration tools will grab it from this common repository and deploy it for Continuous Testing, which is done by tools like Selenium.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q
  1. Why is Continuous Testing important for DevOps?
A

Any modification to the code may be tested immediately with Continuous Testing. This prevents concerns like quality issues and release delays that might occur whenever big-bang testing is delayed until the end of the cycle. In this way, Continuous Testing allows for high-quality and more frequent releases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q
  1. What are the key elements of Continuous Testing tools?
A

Continuous Testing key elements are:

  1. Test Optimization - It guarantees that tests produce reliable results and actionable information. Test Data Management, Test Optimization Management, and Test Maintenance are examples of aspects.
  2. Advanced Analysis - In order to avoid problems from occurring in the first place and to achieve more within each iteration, it employs automation in areas like scope assessment/prioritization, changes effect analysis, and static code analysis.
  3. Policy Analysis - It guarantees that all processes are in line with the organization’s changing business needs and that all compliance requirements are met.
  4. Risk Assessment - Test coverage optimization, technical debt, risk mitigation duties, and quality evaluation are all covered to guarantee the build is ready to move on to the next stage.
  5. Service Virtualization - Ensures that real-world testing scenarios are available. Service visualisation provides access to a virtual representation of the needed testing phases, ensuring its availability and reducing the time spent setting up the test environment.
  6. Requirements Traceability - It guarantees that no rework is necessary and real criteria are met. To determine which needs require additional validation, are in jeopardy and performing as expected, an object evaluation is used.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q
  1. Explain the difference between a centralized and distributed version control system (VCS).
A

Centralized Version Control System

  1. All file versions are stored on a central server
  2. No developer has a copy of all files on a local system
  3. If the central server crashes, all data from the project will be lost
    * *Check Image**

Distributed Control System

  1. Every developer has a copy of all versions of the code on their systems
  2. Enables team members to work offline and does not rely on a single location for backups
  3. There is no threat, even if the server crashes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q
  1. What is the git command that downloads any repository from GitHub to your computer?
A

Check Image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q
  1. How do you push a file from your local system to the GitHub repository using Git?
A

First, connect the local repository to your remote repository:

git remote add origin [copied web address]

// Ex: git remote add origin https://github.com/Simplilearn-github/test.git

Second, push your file to the remote repository:

git push origin master

30
Q
  1. How is a bare repository different from the standard way of initializing a Git repository?
A

Using the standard method:

git init
You create a working directory with git init
A .git subfolder is created with all the git-related revision history
Using the bare way

git init –bare
It does not contain any working or checked out a copy of source files
Bare repositories store git revision history in the root folder of your repository, instead of the .git subfolder

31
Q
  1. Which of the following CLI commands can be used to rename files?
A
git rm
git mv
git rm -r
None of the above
The correct answer is B) git mv
32
Q
  1. What is the process for reverting a commit that has already been pushed and made public?
A

There are two ways that you can revert a commit:

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”

Create a new commit that undoes all the changes that were made in the bad commit. Use the following command:

git revert
Example: git revert 56de0938f

33
Q
  1. Explain the difference between git fetch and git pull.
A
  1. Git fetch 2.Git pull
  2. Git fetch only downloads new data from a remote repository
  3. Git pull updates the current HEAD branch with the latest changes from the remote server
  4. Does not integrate any new data into your working files
  5. Downloads new data and integrate it with the current working files
  6. Users can run a Git fetch at any time to update the remote-tracking branches
  7. Tries to merge remote changes with your local ones
  8. Command - git fetch origin
               git fetch –-all

2.Command - git pull origin master

34
Q
  1. What is Git stash?
A

A developer working with a current branch wants to switch to another branch to work on something else, but the developer doesn’t want to commit changes to your unfinished work. The solution to this issue is Git stash. Git stash takes your modified tracked files and saves them on a stack of unfinished changes that you can reapply at any time.

Check Image

35
Q
  1. Explain the concept of branching in Git.
A

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.

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 with the master branch

Check Image

36
Q
  1. What is the difference between Git Merge and Git Rebase?
A

Suppose you are working on a new feature in a dedicated branch, and another team member updates the master branch with new commits. You can use these two functions:

Git Merge

To incorporate the new commits into your feature branch, use Git merge.

Creates an extra merge commit every time you need to incorporate changes
But, it pollutes your feature branch history
**Check Image*

Git Rebase

As an alternative to merging, you can rebase the feature branch on to master.

Incorporates all the new commits in the master branch
It creates new commits for every commit in the original branch and rewrites project history
**Check Image*

37
Q
  1. How do you find a list of files that have been changed in a particular commit?
A

The command to get a list of files that have been changed in a particular commit is:

git diff-tree –r {commit hash}

Example: git diff-tree –r 87e673f21b

  1. -r flag instructs the command to list individual files
  2. commit hash will list all the files that were changed or added in that commit
38
Q
  1. What is a merge conflict in Git, and how can it be resolved?
A

A Git merge conflict happens when you have merge branches with competing for commits, and Git needs your help to decide which changes to incorporate in the final merge.

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 a merge conflict is caused after competing for line changes. For example, this may occur when people make different changes to the same line of the same file on different branches in your Git repository.

Resolving a merge conflict using conflict editor:
Under your repository name, click “Pull requests.”

Check Rest

39
Q
  1. What is Git bisect? How can you use it to determine the source of a (regression) bug?
A

Git bisect is a tool that uses binary search to locate the commit that triggered a bug.

Git bisect command -

git bisect

The git bisect command is used in finding the bug performing commit in the project by using a binary search algorithm.

The bug occurring commit is called the “bad” commit, and the commit before the bug occurring one is called the “good” commit. We convey the same to the git bisect tool, and it picks a random commit between the two endpoints and prompts whether that one is the “good” or “bad” one. The process continues uptil the range is narrowed down and the exact commit that introduced the exact change is discovered.

40
Q
  1. Explain some basic Git commands.
A

Check Table

41
Q
  1. Explain the master-slave architecture of Jenkins.
A

Check Image

42
Q
  1. What is Jenkinsfile?
A

Jenkinsfile contains the definition of a Jenkins pipeline and is checked into the source control repository. It is a text file.

  1. It allows code review and iteration on the pipeline.
  2. It permits an audit trail for the pipeline.
  3. There is a single source of truth for the pipeline, which can be viewed and edited.
43
Q
  1. Which of the following commands runs Jenkins from the command line?
A

1.java –jar Jenkins.war
2.java –war Jenkins.jar
3.java –jar Jenkins.jar
4.java –war Jenkins.war
The correct answer is A) java –jar Jenkins.war

44
Q
  1. What concepts are key aspects of the Jenkins pipeline?
A
  1. Pipeline: User-defined model of a CD pipeline. The pipeline’s code defines the entire build process, which includes building, testing and delivering an application
  2. Node: A machine that is part of the Jenkins environment and capable of executing a pipeline
  3. Step: A single task that tells Jenkins what to do at a particular point in time
  4. Stage: Defines a conceptually distinct subset of tasks performed through the entire pipeline (build, test, deploy stages)
45
Q
  1. Which file is used to define dependency in Maven?
A

1.build.xml
2.pom.xml
3.dependency.xml
4.Version.xml
The correct answer is B) pom.xml

46
Q
  1. Explain the two types of pipeline in Jenkins, along with their syntax.
A

Jenkins provides two ways of developing a pipeline code: Scripted and Declarative.

A. Scripted Pipeline: It is based on Groovy script as their Domain Specific Language. One or more node blocks do the core work throughout the entire pipeline.

Syntax:

  1. Executes the pipeline or any of its stages on any available agent
  2. Defines the build stage
  3. Performs steps related to building stage
  4. Defines the test stage
  5. Performs steps related to the test stage
  6. Defines the deploy stage
  7. Performs steps related to the deploy stage

Check Image

B. Declarative Pipeline: It provides a simple and friendly syntax to define a pipeline. Here, the pipeline block defines the work done throughout the pipeline.

Syntax:

  1. Executes the pipeline or any of its stages on any available agent
  2. Defines the build stage
  3. Performs steps related to building stage
  4. Defines the test stage
  5. Performs steps related to the test stage
  6. Defines the deploy stage
  7. Performs steps related to the deploy stage

Check Image

47
Q
  1. How do you create a backup and copy files in Jenkins?
A

In order to create a backup file, periodically back up your JENKINS_HOME directory.

Check Image

In order to create a backup of Jenkins setup, copy the JENKINS_HOME directory. You can also copy a job directory to clone or replicate a job or rename the directory.

48
Q
  1. How can you copy Jenkins from one server to another?
A

Check Image

  1. Move the job from one Jenkins installation to another by copying the corresponding job directory.
  2. Create a copy of an existing job by making a clone of a job directory with a different name.
  3. Rename an existing job by renaming a directory.
49
Q
  1. Name three security mechanisms Jenkins uses to authenticate users.
A
  1. Jenkins uses an internal database to store user data and credentials.
  2. Jenkins can use the Lightweight Directory Access Protocol (LDAP) server to authenticate users.
  3. Jenkins can be configured to employ the authentication mechanism that the deployed application server uses.
50
Q
  1. How is a custom build of a core plugin deployed?
A

Steps to deploy a custom build of a core plugin:

  1. Copy the .hpi file to $JENKINS_HOME/plugins
  2. Remove the plugin’s development directory
  3. Create an empty file called .hpi.pinned
  4. Restart Jenkins and use your custom build of a core plugin
51
Q
  1. How can you temporarily turn off Jenkins security if the administrative users have locked themselves out of the admin console?
A
  • *Check Image**
    1. When security is enabled, the Config file contains an XML element named useSecurity that will be set to true.
    2. By changing this setting to false, security will be disabled the next time Jenkins is restarted.
52
Q
  1. What are the ways in which a build can be scheduled/run in Jenkins?
A
  1. By source code management commits.
  2. After completion of other builds.
  3. Scheduled to run at a specified time.
  4. Manual build requests.
53
Q
  1. What are the commands that you can use to restart Jenkins manually?
A

Two ways to manually restart Jenkins:

  1. (Jenkins_url)/restart // Forces a restart without waiting for builds to complete
  2. (Jenkins_url)/safeRestart // Allows all running builds to complete before it restarts
54
Q
  1. Explain how you can set up a Jenkins job?
A

To create a Jenkins Job, we go to the top page of Jenkins, choose the New Job option and then select Build a free-style software project.

The elements of this freestyle job are -

  1. Optional triggers for controlling when Jenkins builds.
  2. Optional steps for gathering data from the build, like collecting javadoc, testing results and/or archiving artifacts.
  3. A build script (ant, maven, shell script, batch file, etc.) that actually does the work.
  4. Optional source code management system (SCM), like Subversion or CVS.
55
Q
  1. What are the different Selenium components?
A

Selenium has the following components:

Selenium Integrated Development Environment (IDE)

  1. It has a simple framework and should be used for prototyping.
  2. It has an easy-to-install Firefox plug-in.

Selenium Remote Control (RC)
Testing framework for a developer to write code in any programming language (Java, PHP, Perl, C#, etc.).

Selenium WebDriver
Applies a better approach to automate browser activities.
It does not rely on JavaScript.

Selenium Grid

Works with Selenium RC and runs tests on different nodes using browsers.

56
Q
  1. What are the different exceptions in Selenium WebDriver?
A

Exceptions are events that occur during the execution of a program and disrupt the normal flow of a program’s instructions. Selenium has the following exceptions:

1.TimeoutException - It is thrown when a command performing an operation does not complete in the stipulated time.
2.NoSuchElementException - It is thrown when an element with specific attributes is not found on the web page.
3,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”.
4.SessionNotFoundException - The WebDriver is performing the action immediately after quitting the browser.

57
Q
  1. Can Selenium test an application on an Android browser?
A

Selenium is capable of testing an application on an Android browser using an Android driver. You can use the Selendroid or Appium framework to test native apps or web apps in the Android browser. The following is a sample code:

Check Image

58
Q
  1. What are the different test types that Selenium supports?
A

Functional - This is a type of black-box testing in which the test cases are based on the software specification.

Regression - This testing helps to find new errors, regressions, etc. in different functional and non-functional areas of code after the alteration.

Load Testing - 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.

59
Q
  1. How can you access the text of a web element?
A

Get command is used to retrieve the text of a specified web element. The command does not return any parameter but returns a string value.

Used for:

1.Verification of messages
2.Labels
3.Errors displayed on the web page
Syntax:

String Text=driver.findElement(By.id(“text”)).getText();

60
Q
  1. How can you handle keyboard and mouse actions using Selenium?
A

You can handle keyboard and mouse events with the advanced user interaction API. The advanced user interactions API contains actions and action classes.

  1. Method 2.Description
  2. clickAndHold() 2.Clicks without releasing the current mouse location
  3. dragAndDrop() 2.Performs click-and-hold at the location of the source element
  4. keyDown(modifier_key) 2.Performs a modifier key press (ctrl, shift, Fn, etc.)
  5. keyUp(modifier_key) 2.Performs a key release
  6. Which of these options is not a WebElement method?
    a.getText()
    b.size()
    c.getTagName()
    d.sendKeys()
    The correct answer is B) size()
61
Q
  1. When do we use findElement() and findElements()?
A

A. findElement()

It finds the first element in the current web page that matches the specified locator value.

Syntax:

WebElement element=driver.findElements(By.xpath(“//div[@id=‘example’]//ul//li”));

B. findElements()

It finds all the elements in the current web page that matches the specified locator value.

Syntax:

List elementList=driver.findElements(By.xpath(“//div[@id=‘example’]//ul//li”));

62
Q
  1. What are driver.close() and driver.quit() in WebDriver?
A

These are two different methods used to close the browser session in Selenium WebDriver:

  1. driver.close() - This is used to close the current browser window on which the focus is set. In this case, there is only one browser open.
  2. driver.quit() - It closes all the browser windows and ends the WebDriver session using the driver.dispose method.
63
Q
  1. How can you submit a form using Selenium?
A

The following lines of code will let you submit a form using Selenium:

WebElement el = driver.findElement(By.id(“ElementID”));

el.submit();

64
Q
  1. What are the Testing types supported by Selenium?
A

There are two types of testing that are primarily supported by Selenium:

Functional Testing - Individual testing of software functional points or features.

Regression Testing - Wherever a bug is fixed, a product is retested and this is called Regression Testing.

65
Q
  1. What is Selenium IDE?
A

Selenium integrated development environment (IDE) is an all-in-one Selenium script development environment. It may be used to debug tests, alter and record and is also available as a Firefox extension. Selenium IDE comes with the whole Selenium Core that allows us to rapidly and easily replay and record tests in the exact environment where they will be conducted.

Selenium IDE is the best environment for building Selenium tests, regardless of the style of testing we prefer, thanks to the ability to move instructions around rapidly and the autocomplete support.

66
Q
  1. What is the difference between Assert and Verify commands in Selenium?
A

The difference between Verify and Assert commands in Selenium are:

  1. The verify commands determine whether or not the provided condition is true. The program execution does not halt regardless of whether the condition is true or not, i.e., all test steps will be completed, and verification failure will not stop the execution.
  2. The assert command determines whether a condition is false or true. To know whether the supplied element is on the page or not, we do the following. The next test step will be performed by the program control, if the condition is true. However, no further tests will be run, and the execution will halt, if the condition is false.
67
Q
  1. How to launch Browser using WebDriver?
A

To launch Browser using WebDriver, following syntax is followed -

WebDriver driver = new InternetExplorerDriver();

WebDriver driver = new ChromeDriver();

WebDriver driver = new FirefoxDriver();

68
Q
  1. What is the difference between Asset Management and Configuration Management?
A

Differences between Configuration Management and Asset Management are:

  1. Configuration Management
  2. Asset Management
  3. Operational Relationships.
  4. Incidental relationships only.
  5. Maintains troubleshooting data.
  6. Maintains taxes data.
  7. Everything we deploy is scope.
  8. Everything we own is scope.
  9. Deployment to retirement - lifecycle.
  10. Purchase to disposal - lifecycle.
  11. Operations - main concern.
  12. Finances - main concern.
  13. ITIL processes from interfacing.
  14. Leasing and purchasing from interfacing.
69
Q
  1. Why are SSL certificates used in Chef?
A
  1. SSL certificates are used between the Chef server and the client to ensure that each node has access to the right data.
  2. Every node has a private and public key pair. The public key is stored at the Chef server.
  3. When an SSL certificate is sent to the server, it will contain the private key of the node.
  4. The server compares this against the public key in order to identify the node and give the node access to the required data.

Check Image

70
Q
  1. Which of the following commands would you use to stop or disable the ‘httpd’ service when the system boots?
A
A.# systemctl disable httpd.service
B.# system disable httpd.service
C.# system disable httpd
D.# systemctl disable httpd.service
The correct answer is A) # systemctl disable httpd.service
71
Q
  1. What is Test Kitchen in Chef?
A

Test Kitchen is a command-line tool in Chef that spins up an instance and tests the cookbook on it before deploying it on the actual nodes.

Here are the most commonly used kitchen commands:

Check Image

72
Q
  1. How does chef-apply differ from chef-client?
A

1.chef-apply is run on the client system.

chef-apply applies the recipe mentioned in the command on the client system.

$ chef-apply recipe_name.rb

2.chef-client is also run on the client system.

chef-client applies all the cookbooks in your server’s run list to the client system.

$ knife chef-client