HCLTech
Interview Questions and Answers
Q1. what are the different http codes used in rest assure?
Different HTTP codes used in Rest Assured
200 - OK: Request was successful
201 - Created: Request was successful and a new resource was created
400 - Bad Request: Request was invalid
401 - Unauthorized: Request requires user authentication
404 - Not Found: Requested resource was not found
500 - Internal Server Error: Server encountered an unexpected condition
Q2. Write a program to print 2 nd highest number from array with using sorting?
Program to find 2nd highest number in array without sorting.
Iterate through array to find highest and second highest numbers
Initialize variables to store highest and second highest numbers
Compare each element with highest and second highest numbers
Q3. What are main concepts of OOPS in java?
Main concepts of OOPS in Java include inheritance, encapsulation, polymorphism, and abstraction.
Inheritance: Allows a class to inherit properties and behavior from another class. Example: class B extends class A.
Encapsulation: Bundling data and methods that operate on the data into a single unit. Example: private variables with public getter and setter methods.
Polymorphism: Ability of a method to do different things based on the object it is acting upon. Example: method overl...read more
Q4. write a program to add value into hashmap?
Program to add values into a hashmap in Java.
Create a new HashMap object.
Use the put() method to add key-value pairs into the hashmap.
Keys must be unique, values can be duplicated.
Example: HashMap
map = new HashMap<>(); map.put("A", 1);
Q5. Write a code using rest assure for status code
Code using Rest Assured for checking status code
Import Rest Assured library
Use given() method to specify the base URI
Use when() method to specify the HTTP method and endpoint
Use then() method to validate the status code
Q6. how to handle frames in selenium
Frames in Selenium are handled using switchTo() method to navigate between frames within a webpage.
Use driver.switchTo().frame() method to switch to a frame by index, name, or WebElement
To switch back to the default content, use driver.switchTo().defaultContent()
Nested frames can be handled by switching to parent frame first before switching to child frame
Example: driver.switchTo().frame(0); // Switch to frame by index
Q7. how to handle windows
Handling windows in automation testing involves identifying and interacting with different types of windows that appear during test execution.
Use window handles to switch between different windows
Identify windows using unique attributes like title or handle
Interact with windows by sending keys or clicking on elements within the window
Q8. Oppps concept in selenium
In Selenium, OOPs concept refers to using Object-Oriented Programming principles like inheritance, encapsulation, polymorphism, and abstraction.
Selenium supports OOPs concepts like inheritance, where one class can inherit properties and methods from another class.
Encapsulation is achieved in Selenium by using access modifiers to restrict access to certain methods and variables.
Polymorphism allows Selenium to perform different actions based on the object being tested.
Abstracti...read more
Q9. oops concept in selenium
In Selenium, OOPs concepts like inheritance, polymorphism, encapsulation, and abstraction can be implemented using classes and objects.
Selenium supports object-oriented programming principles like inheritance, where one class can inherit properties and methods from another class.
Polymorphism can be achieved in Selenium by using method overloading or overriding.
Encapsulation is implemented in Selenium by hiding the internal details of a class and exposing only necessary method...read more
Interview Process at null
Top Automation Test Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month