Previous TCS Interview for QA:    https://www.softwaretestingo.com/tcs-selenium-interview-questions/https://www.interviewbit.com/automation-testing-interview-questions/#will-automated-testing-make-manual-testing-obsoleteSelenium Interview Question:    Top 50 Selenium Interview Questions (2022) - javatpointAccenture Interview Question:   Accenture Selenium Company Interview Questions New 2022 (softwaretestingo.com)
Capgemini Interview Question:   Talent Capgemini Selenium Bangalore Interview Questions 2022 (softwaretestingo.com)1.  Explain the locator present in the Selenium?     
Locator Description Syntax (in Java)
ID Identify the WebElement using the ID attribute driver.findElement(By.id(“IdValue”));
Name Identify the WebElement using the Name attribute driver.findElement(By.name(“nameValue”));
ClassNameUse the Class attribute for identifying the object driver.findElement(By.className(“classValue”));
LinkTextUse the text in hyperlinks to locate the WebElementdriver.findElement(By.linkText(“textofLink”));
Partial LinkTextUse a part of the text in hyperlinks to locate the desired WebElementdriver.findElement(By.partialLinkText(“PartialTextofLink”));
TagNameUse the TagName to locate the desired WebElementdriver.findElement(By.tagName(“htmlTag”));
CssSelectorCSS used to create style rules in web page is leveraged to locate the desired WebElementdriver.findElement(By.cssSelector(“cssValue”));
XPath Use XPath to locate the WebElementdriver.findElement(By.xpath(“xpathValue”));
2. Explain assertions in selenium?
 In Selenium, Asserts are validations or checkpoints for an application. Assertions state confidently that application behavior is working as expected. One can say that Asserts in Selenium are used to validate the test cases. They help testers understand if tests have passed or failed.3. Difference between verify and assertions?
In the case of the “Assert” command, as soon as the validation fails the execution of that particular test method is stopped. Following that the test method is marked as failed. Whereas, in the case of “Verify”, the test method continues execution even after the failure of an assertion statement
4.  How to handle the mouse click using Selenium?
---&gt;     Action a = new Action(driver)            Webelement element = driver.findElement(By.xpath(“”));        a.contextClick(element).perform();
5. What is the use of Data provider in the TestNG?
TestNG comes up with DataProvider to automate the process of providing test-cases for execution. DataProvider helps with data-driven test cases that carry the same methods but can be run multiple times with different data sets. It also helps in providing complex parameters to the test methods
6. Difference between the Selenium 2.0 and Selenium 3.0?
The main difference between selenium 3.0 and selenium 2.0 is that now all the major browser vendors will provide their own WebDriver implementations (Apple, Google, Microsoft, and Mozilla) in Selenium 3.0  instead of being developed by Selenium project (Selenium 2.0) and because they know their browsers better than anyone else, their WebDriver implementations can be tightly coupled to the browser, leading to a better testing experience for you.
7. Which type of testing is mainly done for Automation Testing?
Unit testing 
8. Explain OOPs concept briefly.
programming concept that works on the principles of abstraction, encapsulation, inheritance, and polymorphism. It allows users to create objects they want and create methods to handle those objects.
Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of  HYPERLINK "https://www.javatpoint.com/java-oops-concepts" OOPs
(Object Oriented programming system).
The idea behind inheritance in Java is that you can create new  HYPERLINK "https://www.javatpoint.com/object-and-class-in-java" classes
that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also.
---&gt; Explore The Essentials Of Java In Selenium With Examples (softwaretestinghelp.com)
9. What is Constructor in java.A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created. It can be used to set initial values for object attributes:
10 List the keyword in python?11. What are the methods in API testing?
There are mainly 4 types of API Testing methods: GET, POST, Delete, and PUT. GET– The GET method is used to extract information from the given server using a given URI
12 Difference between the SOAP and REST API?
Sr. No. Key REST API SOAP API
1 Internal communication REST APIs uses multiple standards like HTTP, JSON, URL, and XML for data communication and transfer. SOAP APIs is largely based and uses only HTTP and XML.
2 Resource requirement As REST API deploys and uses multiple standards as stated above, so it takes fewer resources and bandwidth as compared to SOAP API. On other hand Soap API requires more resource and bandwidth as it needs to convert the data in XML which increases its payload and results in the large sized file.
3 Description REST API uses Web Application Description Language for describing the functionalities being offered by web services. On other hand SOAP API used Web Services Description language for the same.
4 Security REST has SSL and HTTPS for security. On other hand SOAP has SSL( Secure Socket Layer) and WS-security due to which in the cases like Bank Account Password, Card Number, etc. SOAP is preferred over REST.
5 Abbreviation REST stands for Representational State Transfer. On other hand SOAP stands for Simple Object Access Protocol
6 Interchange REST can make use of SOAP as the underlying protocol for web services, because in the end it is just an architectural pattern. On other hand SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern.
13. Write a program to launch the website?---&gt;package EmployeeApp;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Login_new_User {
public static void main(String[] args)  {
System.setProperty("webdriver.chrome.driver","E:\\RAJAN KUMAR JHA\\Testing\\Selenium\\chrome\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String url = "https://employee.hyenaapps.com/#/";
  driver.get(url);       
    }
}
14. Explain is sampler and listener in Jmeter?---&gt; Samplers in JMeter allows JMeter to send different types of requests to a server. Samplers are the actual requests, JMeter sends to the web server under test. Each sampler (except Test Action) generates one or more sample results. The sample results have various attributes (success/fail, elapsed time, data size etc.) and can be viewed in the various listeners.       Listener allows us to view and analyze the Sampler request and response in the form of tables, graphs, trees etc. You can also save results in a file and read saved results later. You can access the sampler result in an ongoing load/stress test without waiting till end.15. Select the nth largest value in the list?       Select * From Employee
ORDERBY salary DESC
LIMIT 1Offset n-1
16. Write a syntax for for update row in SQl?
       UPDATE Customers   SET ContactName = 'Alfred Schmidt', City= 'Frankfurt'   WHERE CustomerID = 1;17. What is RC in selenium?
Selenium Remote Control (RC) was the main Selenium project that sustained for a long time before Selenium WebDriver(Selenium 2.0) came into existence. Now Selenium RC is hardly in use, as WebDriver offers more powerful features, however users can still continue to develop scripts using RC.
18. What is an API?---&gt; APIs (Application programing interface) are the intermediary between two programs and allow data to be transferred. APIs are very versatile and can be used on the web databases, and operating systems.19.  What is the full form of SQL? ---&gt; Structured Query language
20. Write the syntax to update the row in the SQL?---&gt;         UPDATE table_name                SET column1 = value1, column2 = value2, ...                 WHERE condition; 21. Explain Different type of join in the SQL?---&gt; A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
DIFFERENT TYPE OF SQL JOINs: ---SQL INNER JOIN KEYWORD:  The INNER JOIN keyword selects records that have matching values in both tables.    SYNTAX:          SELECT column_name(s)        FROM table1        INNER JOIN table2        ON table1.column_name = table2.column_name
---SQL LEFT JOIN KEYWORD: The LEFT JOIN keyword returns all records from the left table (table1), and the matching records from the right table (table2). The result is 0 records from the right side, if there is no match.    SYNTAX:         SELECT column_name(s)        FROM table1        LEFT JOIN table2        ON table1.column_name = table2.column_name;
---SQL RIGHT JOIN KEYWORD: The RIGHT JOIN keyword returns all records from the right table (table2), and the matching records from the left table (table1). The result is 0 records from the left side, if there is no match.    SYNTAX:        SELECT column_name(s)        FROM table1        RIGHT JOIN table2        ON table1.column_name = table2.column_name;
---SQL FULL OUTER JOIN KEYWORD: The FULL OUTER JOIN keyword returns all records when there is a match in left (table1) or right (table2) table records.    SYNTAX:       SELECT column_name(s)       FROM table1       FULL OUTER JOIN table2       ON table1.column_name = table2.column_name        WHERE condition; --SQL SELF JOIN KEYWORD: A self-join is a regular join, but the table is joined with itself.    SYNTAX:      SELECT column_name(s)      FROM table1 T1, table1 T2      WHERE condition;23. Different types of Error in the API? ---&gt; 1XX --- Informational: Informational codes indicating that the request initiated by the browser is continuing.
The client has requested the server to switch the protocol. The server sends the 100 switching protocol as a response code to inform the client that it is switching to the protocol as requested by the client, which sent the message that includes the upgrade request header.          2XX --- Success: The 2xx class means that the request made by the client was received, understood, and accepted. Or we can say that the 2xx http status code represents that the Http request was successful.         3XX --- Redirection: The 3xx block is a class used for redirection. It indicates that the client needs to take some additional measures to complete the request. Here Redirection means URL forwarding is a process of providing more one URL to the page. The HTTP provides HTTP redirect response for such kind of operations.        4XX --- Client: (wrong request made by client)
 The server sends the 4xx HTTP response status codes to the client when some errors occur in the request made by the client. This response indicates that the browser has sent a wrong request with an error that cannot be processed by the server. To get the proper response, the client needs to send the correct request again.        5XX --- Server: (from server side) 
 The error codes that come under the 5xx range are sent to the client when some problems occur with a server. When the client makes a request for some website, the browser sends a request to the website's server, and if the website's server is not able to serve the request, then the 5xx error code is sent to the client. These errors mainly when the server is facing some problem or unable to perform a request. The 5xx error messages represent the server-side error messages in which the website's server is unsuccessful in performing a request. The server-side error does not mean that problem is coming on a website, computer, or an internet connection. 24. What is selenium Grid?    Selenium Grid is a tool used to run parallel tests across different machines and different browsers simultaneously which results in minimized execution time.25. What is difference between “htpps” and “htpp”?
Parameter HTTP HTTPS
Protocol It is hypertext transfer protocol. It is hypertext transfer protocol with secure.
Security It is less secure as the data can be vulnerable to hackers. It is designed to prevent hackers from accessing critical information. It is secure against such attacks.
Port It uses port 80 by default It was use port 443 by default.
Starts with HTTP URLs begin with http:// HTTPs URLs begin with https://
Used for It’s a good fit for websites designed for information consumption like blogs. If the website needs to collect the private information such as credit card number, then it is a more secure protocol.
Scrambling HTTP does not scramble the data to be transmitted. That’s why there is a higher chance that transmitted information is available to hackers. HTTPS scrambles the data before transmission. At the receiver end, it descrambles to recover the original data. Therefore, the transmitted information is secure which can’t be hacked.
Protocol It operates at TCP/IP level. HTTPS does not have any separate protocol. It operates using HTTP but uses encrypted TLS/SSL connection.
Domain Name Validation HTTP website do not need SSL. HTTPS requires SSL certificate.
( Secure Socket Layer)
Data encryption HTTP website doesn’t use encryption. HTTPS websites use data encryption.
Search Ranking HTTP does not improve search rankings. HTTPS helps to improve search ranking.
Speed Fast Slower than HTTP
Vulnerability Vulnerable to hackers It Is highly secure as the data is encrypted before it is seen across a network.
  26. How to handle alerts ?driver.switchTo().alert().accept();
driver.switchTo().alert().dismiss();
driver.switchTo().alert().getText();
27.How to switch window, if window name is not available?
Set&lt;String&gt; windows = driver.getWindowHandles(); //[parentid,childid,subchildId]
Iterator&lt;String&gt;it = windows.iterator();
String parentId = it.next();
String childId = it.next();
28.How to login by using URL?
We can do HTTP basic authentication URL with @ in password. We have to pass the credentials appended with the URL. The username and password must be added with the format − https://username:password@URL29.Describe TestNg in oneword?
Framework
30.D/B window handle and window handles?
driver.getWindowHandles() – It stores the set of handles for all the pages opened simultaneously.
driver.getWindowHandle() – It fetches the handle of the web page which is in focus. It gets the address of the active browser and it has a return type of String
31.what is parameterizing in testing?
Parameterization in Selenium is a process to parameterize the test scripts in order to pass multiple data to the application at runtime. It is a strategy of execution which automatically runs test cases multiple times using different values
32.what is Dataprovider in selenium?
DataProvider helps with data-driven test cases that carry the same methods but can be run multiple times with different data sets. It also helps in providing complex parameters to the test method
33. how to handle exeption in selenium
Try-catch: This method can catch Exceptions by using a combination of the try and catch keywords. Try indicates the start of the block, and Catch is placed at the end of the try block to handle or resolve the Exception. The code that is written within the Try/Catch block is referred to as “protected code.” The following code represents the syntax of Try/Catch block –
try   {
     // Some code
   }
catch(Exception e)
  {
     // Code for Handling the exception
  }
Multiple catch blocks: There are various types of Exceptions, and one can expect more than one exception from a single block of code. Multiple catch blocks are used to handle every kind of Exception separately with a separate block of code. One can use more than two catch blocks, and there is no limitation on the number of catch blocks. The code below represents the syntax of multiple catch blocks –
try   {
      //Some code
   }
catch(ExceptionType1 e1)
   {
     //Code for Handling the Exception 1
   }
catch(ExceptionType2 e2)
   {
     //Code for Handling the Exception 2
   }
34.Heirarchy of execution
@BeforeSuite.
@BeforeTest.
@BeforeClass.
@BeforeMethod.
@Test.
@AfterMethod.
@AfterClass.
@AfterTest.
95.return type getwindow and getwindow handles.
Return type of getWindowHandle() is String while return type of getWindowHandles() is Set&lt;String&gt;. The return type is Set as window handle is always unique.
1. WAP to print the below structure?
            * 
        *  * 
      * * * 
   * * * * 
* * * * * 
package Java_Programing;
public class Star_Pattern 
public static void main(String[] args)  {
      int row=5, i, j, space, spaceLimit;
      spaceLimit = (row*2) - 2;
      
      for(i=0; i&lt;row; i++)     {
         for(space=0; space&lt;spaceLimit; space++)
            System.out.print(" ");
         for(j=0; j&lt;=i; j++)
            System.out.print("* ");
         System.out.print("\n");
         spaceLimit = spaceLimit-2;
      }}}

2.  WAP to print the below structure?
* 
* * 
* * * 
* * * * 
* * * * * 
 package Java_Programing public class Star_Pattern {
 public static void main(String[] args){
 int i, j;
for(i=0; i&lt;5; i++    {
  
          for(j=0; j&lt;=i; j++)
             System.out.print("* ");
          System.out.print("\n");
       }
    }}
3. WAP to print the below structure?
* * * * * 
* * * * 
* * * 
* * 
* 
          
 package Java_Programing;
 
 public class Star_Pattern {
 
 public static void main(String[] args)
    {
       int i, j;
      
       for(i=5; i&gt;0; i--)
       {
  
          for(j=0; j&lt;i; j++)
             System.out.print("* ");
          System.out.print("\n");
       }
    }}
5. WAP to print the below structure?
* * * * * 
* * * * 
* * * 
* * 
* 
 package Java_Programing;
 
 public class Star_Pattern {
 public static void main (String args[])
    {
       int n = 5;
       for (int i = 1; i&lt;=n ; i++) {
          for (int j = i; j&lt;=n; j++) {
             System.out.print( "* ");
          }
          System.out.println();
      }
   }   }
6. WAP to find the alphabet with upper case and lower case, Digit and white space in the given string?
package Java_Programing;
import java.util.Scanner;
public class Count_character_in_string{
  public static void main(String[] args) {
  
  String str1;
      System.out.println("Enter an String :: ");
      Scanner sc = new Scanner(System.in);
      str1 = sc.nextLine();
      int count=0;
      int count1= 0;
      int count2 = 0;
      int count3 = 0;
      int count4 = 0;
    
      // Count of alphabet
    for (int i=0;i&lt;str1.length();i++)
    {
       if(Character.isLetter(str1.charAt(i)))
       count++;
    }
    
 // Count of Lower case alphabet
    for (int i=0;i&lt;str1.length();i++)
    {
       if(Character.isLowerCase(str1.charAt(i)))
       count1++;
    }
    
    // Count of Upper case alphabet
    for (int i=0;i&lt;str1.length();i++)
    {
       if(Character.isUpperCase(str1.charAt(i)))
       count2++;
    }
    
    // Count of Digits case alphabet
    for (int i = 0; i &lt; str1.length(); i++)
    {
    if (Character.isDigit(str1.charAt(i)))
    count3 ++;
    }
    
    // Count of White space
    for (int i = 0; i &lt; str1.length(); i++)
    {
    if (Character.isWhitespace(str1.charAt(i)))
    count4 ++;
    }
    
System.out.println("the number of toatl alphabets in the given string is:"+count);
System.out.println("the number of Lower case alphabets in the given string is:"+count1);
System.out.println("the number of Upper case alphabets in the given string is:"+count2);
System.out.println("the number of Digits case alphabets in the given string is:"+count3);
System.out.println("the number of Whitespace in the given string is:"+count4);
  }
}
7.  WAP to print the number whose sum is 7 in the given array?public class Main
{
    public static void main(String[] args) {
       int sum = 7;
       int arr[] = {1, 2, 3, 4, 5, 6};
       int n = arr.length;
       for(int i=0;i&lt;n;i++)
        for (int j=0;j&lt;i; j++) {
            if (sum == arr[i] + arr[j])
                System.out.println(arr[i] +"," + arr[j]);
        }
    }
}
8.  WAP to find the given year is leap year or not?
public class Main
{
    public static void main(String[] args) {
    int year =2020;
       if ( (year%400 == 0 )|| ((year% 4 == 0) &amp;&amp; (year%100 != 0)))
       System.out.println("leap Year");
       else 
       System.out.println("Not leap year");
       
    }
}
9. WAP to print the link present in the web page?
package Testing;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Test {
public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver","E:\\RAJAN KUMAR JHA\\Testing\\Selenium\\chrome\\chromedriver.exe");
WebDriver driver = new ChromeDriver();

driver.get( "https://www.google.co.in");
List&lt;WebElement&gt; all_links_webpage = driver.findElements(By.tagName("a")); 
System.out.println("Total no of links Available: " + all_links_webpage.size());
int k = all_links_webpage.size();
System.out.println("List of links Available: ");
for(int i=0;i&lt;k;i++)
{
if(all_links_webpage.get(i).getAttribute("href").contains("google"))
{
String link = all_links_webpage.get(i).getAttribute("href");
System.out.println(link);
}}}}10. WAP to swap two number without using third variable?11. WAP to reverse the string?
    class Reverse_String {
    public static void main(String[] args) {
        String str = "Rajan";
        String nstr = " ";
      char ch;
       
      for (int i=0; i&lt;str.length(); i++)
      {
        ch= str.charAt(i); //extracts each character
        nstr= ch + nstr; //adds each character in front of the existing string
      }
      System.out.println("Reversed word: "+ nstr);
    }
}12. WAP to count the string in the given String?class CountSubstringInString {
    public static void main(String[] args) {
       String string = "Rajan kumar jha";
      String word = "jha";
      
String temp[] = string.split(" ");
int count = 0;
for (int i = 0; i &lt; temp.length; i++) {
if (word.equals(temp[i]))
count ++;
}
System.out.println(word + " is present "+ count +" times in the strings." );
    }
}16. WAP to print the 1 to 100 without using for loop?public class PrintNumbers {
 
     public static void printNum(int num) {
        
        //If numbers is less than or equal to 100
        if(num &lt;= 100) {
           System.out.print(num + " ");
           
            //Increment and call printNum recursively
            printNum(num+1);
        }
    }
   
     public static void main(String[] args) {
        //Declare variable and assign a value 1
        int n = 1;
        
        //call printNum method
        printNum(n);
    }
    
}