Showing posts with label webdriver interview questions. Show all posts
Showing posts with label webdriver interview questions. Show all posts

Monday, August 27, 2018

no image

Java Interview Questions For Selenium Webdriver - Business Office 1

PART 1

1 : What is object inwards java?

Answer : Object Is an Instance of degree in addition to it has its ain dry soil in addition to behavior. In existent footing nosotros tin say, Dog is object of Animal degree which accept unlike dry soil similar breed, color, name, hungry, etc in addition to behaviour  like wagging tail, fetching, barking etc.

2 : What is class?

Answer : H5N1 degree is the pattern or nosotros tin tell template from which private objects are created.

3 : What is constructor?

Answer : Constructor is a code block simply similar a method which is used to initialize the dry soil of an object. It volition live on invoked at the fourth dimension of object creation to gear upwardly the value for object. VIEW DETAIL

4 : What is default constructor?

Answer : If at that spot is non whatsoever constructor inwards degree hence coffee compiler creates default constructor. It is no declaration constructor which initializes whatsoever uninitialized fields to their default values.

5 : Constructor returns whatsoever value?

Answer : Yes. It volition provide event of electrical flow degree (However nosotros tin non role provide type amongst constructor).
no image

Interview Questions Of Gist Coffee For Selenium Webdriver - Business Office 2

Part 2

6 : What is the divergence betwixt static in addition to non static variable?

Answer : Main differences are equally bellow.
  • Static variables are preceded past times static keyword. For non-static variable, at that spot is non whatsoever preceding keyword.
  • Memory is allocated for static variables at the fourth dimension of flat loading. Memory is allocated to non- static variables whenever an object is created.
  • Memory is allocated alone ane time to static variables on flat loading. Memory is allocated multiple fourth dimension whenever a novel object is created to non-static variables.
  • Static variable instance : Collage lift of students, Company lift of employees..
READ MORE close static in addition to non-static stuff.

7 : What is the divergence betwixt static in addition to non static(Instance) method?

Answer : Difference betwixt static in addition to non static method is equally bellow.
  • Method declared alongside static keyword is static method. If Method declared without static keyword in addition to therefore it is instance method.
  • No postulate of object to telephone telephone static methods. Object needed to call instance method.
  • Can non access non static materials within static methods directly. Opposite to it, We tin access static in addition to non static materials straight inside instance method.
READ MORE detail on static in addition to non-static stuff.


8 : What is inheritance inward java?

Answer : In Java, Inheritance provides machinery using which ane object of little flat tin start  all the properties in addition to behaviors of bring upwards object. It volition crate IS-A relationship. Main usage of inheritance inward coffee is for code re-usability in addition to  method overriding to laissez passer on run-time polymorphism. VIEW MORE item on inheritance.

9 : Multiple inheritance is supported inward coffee on flat level? If No.. Why?

Answer : No.. Multiple inheritance is non supported inward coffee inward instance of flat to simplify the linguistic communication in addition to cut the complexity.

10 : What is method overriding inward java?

Answer : Method overriding is a characteristic which allows a little flat or sub flat to render a specific implementation of a method which is already provided past times ane of its bring upwards classes or super class. It is used for runtime polymorphism. You tin read to a greater extent than close method overriding on THIS POST.

Sunday, August 26, 2018

no image

Core Coffee Interview Questions For Selenium Webdriver - Occupation 3

Part 3

11 : Why principal method is static?

Answer : As nosotros know, We tin access static materials without creating object of class. Because of static keyword amongst principal method, Java virtual machine tin bespeak telephone band it without creating object of class. This agency it volition render sort of rootage to outset execution of program.

12 : What is method overloading?

Answer : Method overloading is might to practise multiple methods amongst same inwards same degree but amongst dissimilar signatures (different input parameters together with types). Method names volition endure same but parameters volition endure dissimilar for all overloaded methods.

13 : What is constructor overloading?

Answer : Same every bit method overloading, Single degree tin bring multiple constructors amongst same advert every bit degree advert but all bring dissimilar signatures (different input parameters together with types) is called constructor overloading. READ MORE most constructor overloading.

14 : Can nosotros override static methods?

Answer : We tin declare static method amongst same signature inwards subclass but it volition non deport every bit overridden method. So response is No.. We tin non override static methods every bit they are business office of  class non object.. You tin override static methods but output volition endure dissimilar than the expected.

15 : How to contrary string inwards java?

Answer : StringBuffer degree has a method called reverse(). We tin piece of occupation it to contrary the string.
Example :

populace static void main(String[] args) {
// buffer string using StringBuffer class.
StringBuffer a = novel StringBuffer("I similar coffee real much.");
// piece of occupation reverse() method to contrary string
System.out.println(a.reverse());
}

Saturday, August 25, 2018

no image

Java Questions For Selenium Webdriver Interview

Part 5

21 : Explain System.out.println();

Answer :
  • System : is a concluding shape in  java.lang package.
  • out : is a static fellow member of arrangement class. It is an illustration of java.io.PrintStream. This current is already opened upward as well as reach to get got output data.
  • println : is a method of java.io.PrintStream .It is an overloaded method.

22 : Write programme to print fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21,... 

Answer :
public shape fibonaccci {   world static void main(String[] args) {   int f1 = 0;   int f2 = 1;   int amount = 0;   for(int i=0; i<=21;){    System.out.println(f1);    amount = i+f2;    f2=i;    f1=sum;    i=f1;   }  } }

23 : Write programme to larn lawsuit of 52+42-32+22-1 

Answer :
public shape SquareSum {   world static void main(String[] args) {      int amount = 0;     for (int i=5;i>=1;i--){          if(i%2!=0){     if(sum<(i*i)){      amount = (i*i)-sum;     }else{      amount = sum-(i*i);     }        }else{         amount = sum+(i*i);    }       }   System.out.println(sum);  } }

24 : What is supply type of testng @DataProvider musical note method? 

Answer : It volition supply double object array “Object[][]”.

25 : int x=10 as well as y=20. Swap both variable values without using whatever temp variable.

Answer :
public shape swapNumbers {   world static void main(String[] args) {      int x = 10;   int y = 20;      System.out.println("Before swapping x = " + x + " as well as y = " + y);    x = x + y;   y = x - y;   x = x - y;    System.out.println("After swapping x = " + x + " as well as y = " + y);  } }

no image

Interview Questions On Coffee For Selenium

Part 6

26 : What is local variable inwards java?
Answer : Local variable is declared within method or constructor too it is express for that method or constructor only. View more detail on local variable inwards java.

Local Variable Example :
public flat JavaVariable {   world void Calc() {   // Local Variables.   int sum;   int item1 = 5;   int item2 = 7;   amount = item1 + item2;   System.out.println("Sum is : " + sum);  }   world static void main(String args[]) {   JavaVariable j = novel JavaVariable();   j.Calc();  } }



27 : What is a Instance Variable inwards java?
Answer : Instance Variable is declared parallel to method or constructor inwards class. It is visible for all methods too constructors of that class. View more detail on instance variable inwards java.

Instance Variable Example :
public flat JavaVariable {  //Instance Variable.  int sum;   world void Calc() {   // Local Variables.   int item1 = 5;   int item2 = 7;   amount = item1 + item2;   System.out.println("Sum is : " + sum);  }   world static void main(String args[]) {   JavaVariable j = novel JavaVariable();   j.Calc();  }

28 : What is a Class Variable inwards java?
Answer : Class variable is declared alongside static keyword inwards flat parallel to methods too constructor. Class variable is initialized solely ane time at the kickoff of execution too destroyed on cease of program. Class variable is too known every bit static variable. View more detail on flat variable inwards java.

Class Variable Example :
public flat JavaVariable {  //Class Variable  static String sumType = "Basket";   //Instance Variable.  int sum;   world void Calc() {   // Local Variables.   int item1 = 5;   int item2 = 7;   amount = item1 + item2;   System.out.println(sumType + " Sum is : " + sum);  }   world static void main(String args[]) {   JavaVariable j = novel JavaVariable();   j.Calc();  }

29 : What is the deviation between instance variable too flat variable?
Answer :

Instance Variable :
  • It is unique to each illustration of the class.
  • Declared without static modifier.
  • Memory allocation, loading too initialization is done at piece of job time.
Static Variable :
  • It is shared past times all instances of the class.
  • Declared alongside static modifier.
  • Memory allotment is done at compile time, loaded at charge fourth dimension too they are initialized at flat initialization time.
30. What is access modifier inwards java?
Answer : Access modifiers allows us to gear upwards access levels for variables, methods, classes too constructors inwards java. We tin command access levels using access modifiers inwards java. View more details on dissimilar access modifiers inwards java.

Friday, August 24, 2018

Java Programming Interview Questions

Java Programming Interview Questions

Part 7

31 : What is default value of local variable.
Answer : There is non whatsoever default value of local variable. You must accept to initialize it. View more details on local variables inwards java.

32 : Java back upwards constructor inheritance?
Answer : No, Constructor inheritance is non supported inwards java. View more details on constructor inwards java.

33 : Which is super shape of all other classes inwards java?
Answer : java.lang.Object is  super shape of all other classes inwards java.

34 : What is Encapsulation?
Answer : Encapsulation is procedure of packing code together with information together In to a unmarried Unit. View more details on Encapsulation in java.

35 : Write a plan to opposite a string without using opposite function.
Answer : Program to opposite a string without using opposite business office inwards coffee is every bit bellow.

package JAVAExamples;  populace shape StringReverse {  populace static void main(String[] args) {     //String to reverse.   String str = "This Is String.";   String revstring = "";    for (int i = str.length() - 1; i >= 0; --i) {    //Start getting characters from terminate of the string.    revstring += str.charAt(i);   }    System.out.println(revstring);  } }

Output : .gnirtS sI sihT
no image

Java Questions For Selenium Interview

Part 8

36 : What is the difference betwixt the Constructor together with Method?
Answer : Main departure betwixt the Constructor together with Method is equally bellow.

Constructor :
  1. Name of the constructor must live on same equally cast name.
  2. Constructor must non accept whatever supply type.
  3. It is used to initialize the set down of an object.
  4. It is non possible to telephone phone constructor directly. Constructors called implicitly when the novel keyword creates an object.
Method :
  1. Method elevate tin live on any.
  2. Method must accept supply type.
  3. It is used to let on demeanor of an object.
  4. Methods tin live on called directly.
Read to a greater extent than on Constructor together with Method.

37 : What are the unlike types of types of constructors inwards java?
Answer : Mainly in that place are ii types of constructors available inwards java.
  • Default Constructor : Constructor without parameter is called default constructor.
package JAVAExamples;  populace cast City {  //Default Constructor  City()  {   System.out.println("City is created");  }    populace static void main(String args[]){     City c=new City();    }   }
  • Parameterized constructor : Constructor amongst parameter is called Parameterized constructor.
package JAVAExamples;  populace cast City {  int id;  String name;   // parameterized Constructor  City(int i, String n) {   id = i;   elevate = n;  }   void display() {   System.out.println(id + " " + name);  }   populace static void main(String args[]) {   City c1 = novel City(1, "New York");   City c2 = novel City(2, "London");   c1.display();   c2.display();  } }
Output :
1 New York
2 London

38 : Write a programme for Fibonacci serial inwards Java ?
Answer : Program for Fibonacci serial is equally bellow.

package JAVAExamples;  populace cast FibonacciSeries {  populace static void main(String args[]) {   int x1 = 0, x2 = 1, x3, i, cnt = 15;   // To impress 0 together with 1   System.out.print(x1 + " " + x2);    // loop starts from 2 equally 0 together with 1 are already printed.   for (i = 2; i < cnt; ++i) {    x3 = x1 + x2;    System.out.print(" " + x3);    x1 = x2;    x2 = x3;   }  } }

39 : Write a programme to impress below given pattern.

1  1 2  1 2 iii  1 2 iii iv  1 2 iii iv 5

Answer : Program to impress to a higher house designing is equally bellow.

package JAVAExamples;  populace cast Pattern {   populace static void main(String[] args) {   for (int a = 1; a <= 5; a++) {    for (int x = 1; x <= a; x++) {     System.out.print(x+" ");    }    // To impress novel line.    System.out.println();   }  } }

40. What is the departure betwixt “this” together with “super” keywords inwards Java?
Answer : Difference is equally bellow.
  1. “this” keyword is used to shop electrical current object reference while “super” keyword is used to store super cast object inwards sub class..
  2. “this” is used to access methods of the electrical current class while “super” is used to access methods of the base of operations class.
  3. this() used to telephone phone constructors inwards the same cast whereas super() is used to telephone phone super cast constructor.
Read more on “super” keyword.
no image

Java Questions Too Answers For Selenium

Part 9

41 : In java, What is provide type of principal method?
Answer : Main method doesn't bring whatever provide type. It is void.

42 : Can We Overload principal method inward java?
Answer : Yes, Java degree tin bring whatever seat out of principal methods as well as hence it is possible to overload principal method. But when you lot run program, It volition non execute overloaded principal method. Always It volition execute exclusively world static void main(String[] args) method.

43 : Can nosotros declare degree equally protected?
Answer : No, You tin non declare degree equally protected.

44 : Write a programme to take given grapheme from string.
Answer : Program to take given grapheme from string is equally bellow.

package JAVAExamples;  world degree RemoveChar {    world static String removeChar(String str, char c) {      if (str == null)          provide null;      provide str.replaceAll(Character.toString(c), "");  }    world static void main(String[] args) {   System.out.println(removeChar("chicago", 'c'));  } }

45 : How to convert string from upper to lower as well as lower to upper case?
Answer : You tin use toUpperCase as well as toLowerCase methods to convert string from lower to upper as well as upper to lower case.
no image

Interview Questions Inwards Coffee For Selenium

Part 10

46 : What is Polymorphism?
Answer : Polymorphism is might using which nosotros tin usage reference variables or methods which behaves differently inwards dissimilar programmatic context. Best illustration of polymorphism is human. We behaves differently amongst dissimilar people inwards dissimilar environment. Our behaviour volition hold upward dissimilar when nosotros reckon to boss in addition to reckon to friend. Read more on Polymorphism inwards java.

47 : What is the advantages of Polymorphism?
Answer : Main payoff of polymorphism is code reusabilty. You tin dynamically provide dissimilar implementations through polymorphism. So it volition trim your travel book inwards damage of treatment in addition to distinguishing diverse objects.

48 : What is a package?
Answer : Influenza A virus subtype H5N1 bundle is a namespace which allows developer to organizes a grouping of related classes in addition to interfaces. Conceptually it is but similar folder which contains dissimilar types of files. It is slow to continue things organised past times keeping related classes in addition to interfaces into packages.

49 : What is string inwards java?
Answer : In Java programming, String is object which is prepared past times sequence of characters.java.lang bundle has String shape to usage in addition to manipulate strings. Read more on string inwards java.

50 : What is StringBuffer inwards java?
Answer : StringBuffer assistance us to usage mutable(modifiable) string inwards java. That agency nosotros tin alter the string if nosotros purpose StringBuffer.
<< PREVIOUS || NEXT >>