Real Time Automation Interview Questions - Part 8
In continuation with the latest series of Real Time Automation Interview Questions, we present you the part 8 of the course structure. Click on below links for previous parts.
Real Time Automation Interview Questions - Part 8
- What does means Public Static Void main(variable, value)?
- Public/ Private/ protected/ default - Access specifier
- Static - modifier
- Void - return type
- Main - Class name
- What are the open source frameworks supported by Selenium Webdriver?
- TestNG, JUnit, Cucumber, Robot Framework, Appium, Protractor
- How to get color of webelement using Selenium Webdriver?
- First get the locator of webelement
- String color = object.getCssValue("background-color");
- String Hexback color = color.fromString(color).asHex();
- It will give you RGB codes , you need to convert them into back color using HEX function.
- How to reverse an Integer?
- int num = 12345;
- int rev = 0;
- while(num!=0) {
- rev = rev * 10 + num % 10;
- num = num/10;
- }
- Sysout(rev);
- }
- How to reverse a String?
- String str = "ABC";
- int len = str.length();
- String rev = "";
- for(int i = len - 1; i>=0; i--)
- {
- rev = rev + str.charAt(i);
- }
- Sysout(rev);
- How will you print length of String without using length method?
- String str = "ABC";
- Method 1 -
- int i = 0;
- for(char c :str.toCharArray()) {
- i++;
- }
- System.out.println("Length of the string is :: "+ i);
- Method 2-
- Sysout(str.toCharArray().length);
- Sysout(str.lastIndexOf());
- Link - https://Java2blog.com/find-length-of-string-without-using
- How to swap two numbers without using a third variable?
- public static void swapNumbers(int a, int b) {
- b = b + a;
- a = a - b;
- b = b - a;
- }
- Write down syntax of iterator function?
- Iterator<String> it = studentList.iterator();
- while(it.hasNext()) {
- System.out.println(it.next());
- }
- How to reverse any array?
- public class reverse array {
- public static void main(String[] args) {
- int[] Array = {7,8,5,6};
- for(int k = Array.length - 1; k>=0; k--)
- {
- System.out.print(Array[k] + "");
- }
- }}
- How to find additional element in list while comparing 2 lists?
- If we have 2 lists L1 and L2, first we remove all element of L2.
- L1.removeAll(L2);
- Sysout(L1); you will get additional element.
Comments
Post a Comment