Sie sind auf Seite 1von 4

Java Questions –

1. Can we override static methods?


 No

2. Can we declare interface methods as private?


 No

3. Can we have duplicate elements in sets?


 No

4. Can we have nested try blocks?


 Yes

5. Is Static variable is Thread Safe (Support multi-threading)?


 No

6. Can we overload the static method?


 Yes

7. Can we use "this" within static method?


 No

8. Can we instantiate the class which has private constructors?


 No

9. Can we change access modifiers (Visibility) of inherited class?


 No

10. Can we create a null as a key for a map collection?


 Yes

Selenium Questions -

11.How to switch to a new window


 driver.switchTo().window()

12. How to take screenshots in Selenium WebDriver


 File scrFile =
((TakeScreenshot)driver).getScreenshotAs(outputType.FILE);

13.How do you verify if the checkbox/radio is checked or not ?


 driver.findElement(By.xpath("xpath of the checkbox/radio
button")).isSelected();

14.How do you simulate browser back and forward?


 driver.navigate().back();
 driver.navigate().forward();

15.How to add implicit wait in selenium


 driver.manage().timeouts().implicitlyWait(TimeOut,
TimeUnit.SECONDS);
Q&A of Shyam’s Interview :

Questions on API testing-

1. How you are going to validate success response for Get method ?

 First validate status code for request, 200 success code will get in Get request. With the help
of response will validate all object from response using Json path.

2. Which tool you are using for API automation testing?

 RestAssured library using for API automation

3. In RestAssured how you are validating Json response with schema, which method you are
using from RestAssured library ?

 Json validator method we can use to validate json response.

4. How to write Json Path?

 Suppose there is get request for Employee records and we want to use Json path to verify
Address then we can drill down till ‘Address’ object

$.Emp.address

5. If response contain Array object then how will write Json Path to fetch 10th record.

 $.emp[10].address

6. Difference between POST and PUT, and PATCH method

 Post is for adding and PUT is for Updating. Patch is for partial updates.

8. Suppose we want to delete record, which steps need to be follow?

 Call DELETE verb method similar to individual GET.

Questions on Java-

1. Can you write Java program to find out second largest number from Integer Array?

We can get them into a sorted array and take second element from the array.

2. Write down program to write count occurrence of each character in string ?

 Public class FindOccr {

Public ocure(String str1) {


HashMap hm = new HashMap();

Int I = str.lenght();

For (j=0; j<=I; j++) {

Int n =1;

If(!hm.containsKey(Str.CharAt(j))

hm.Put(Str.charAt(j), 1);

else

hm.Put(Str.charAt(j), hm.get(Str.charAt(j)) + 1);

3. Method Overloading and Method Overriding in java


a. He was able to explain the concept.
4. Can we create object of Abstract Class ?

 We can not create object of abstract class.

5. How we can access methods from abstract class

 We need to extend Abstract class and create object of abstract class, so using that object we
can access Abstract class method.

6. How we can access method from Interface ?

 We need to Implement interface with class and using object of that class we can access that
method from Interface.

Questions on API testing-

1. How you are going to validate success response for Get method ?

 First validate status code for request, 200 success code will get in Get request. With the help
of response will validate all object from response using Json path.

2. Which tool you are using for API automation testing?


 RestAssured library using for API automation

3. In RestAssured how you are validating Json response with schema, which method you are
using from RestAssured library ?

 Json validator method we can use to validate json response.

4. How to write Json Path?

 Suppose there is get request for Employee records and we want to use Json path to verify
Address then we can drill down till ‘Address’ object

$.Emp.address

5. If response contain Array object then how will write Json Path to fetch 10th record.

 $.emp[10].address

6. Difference between POST and PUT, and PATCH method

 Post is for adding and PUT is for Updating. Patch is for partial updates.

8. Suppose we want to delete record, which steps need to be follow?

 Call DELETE verb method similar to individual GET.

Questions on Java-

1. Can you write Java program to find out second largest number from Integer Array?
We can get th

Das könnte Ihnen auch gefallen