Posts

Showing posts from February, 2022

Path for chromedriver

While setting path for chromedriver in the set property, we need to give path for chromedriver and also add chromedriver.exe at the end.  For eg: C:/users/programs/workspace/chromedriver/chromedriver.exe But if we are setting path in the environment variables for chromedriver, we just need to give path of the directory where chromedriver is kept. Advantage of this is you need not write this statement System. Setproperty("webdriver.chrome.driver","<chromedriver path>") For eg : C:/users/programs/workspace/chromedriver/ Note: In this case you first need to set the path and then restart the system otherwise eclipse would not be able to recognise the path and will throw an error.In cmd if you write chromedriver.exe, it will execute automatically

interview questions basic auth

What is basic auth?

interview questions on testing

What are disadvantages of postman? Limited testing area Good for restful API tests but not well desighned for soap api tests Low script reusability Unable to reuse pre written scripts or add more requests. New scripts need to be created for each project Constrained integration The tool does not support much in integration capabilities it becomes an obstacle in connecting postman with existing systems and collaborating within the team What is the kind of testing you will do tu ven you just have to check one feature? Feature testing : The feature test is the testing of features just like an actual user. Like how the actual user will use the feature. What is difference between put and post? What is 502 response code mean? Smoke testing vs sanity testing? What is a constructor? Types of constructor? What is inheritance?Give example What is a class? Give example What is difference between class and object?

Greatest of 3 numbers (3 methods)

package beginer; public class LargestOf3Nums { public static void main(String[] args) { int n1,n2,n3,temp; n1=1; n2=3; n3=2; if (n1>n2) { if(n1>n3) { System.out.println("n1 is greatest"); }else { System.out.println("n3 is greatest"); } }else { if(n2>n3) { System.out.println("n2 is greatest"); }else { System.out.println("n3 is greatest"); } } //2nd method int a,b,c; a=20; b=10; c=30; if(a>b&& a>c)  { System.out.println("a is greatest"); }  else if(b>a&&b>c)  { System.out.println("b is greatest"); } else { System.out.println("c is greatest"); } //3rd method int d,e,f,largest; d=10000;e=28600;f=33300; // largest=d>e?d:e; int largest_new=d>e?d:e>f?d>e?d:e:f; System.out.println(largest_new); } }

Sum of digits in a number

package ProgramsPractice; import java.util.Scanner; public class SumOfDigits { public static void main(String[] args) { Scanner aa=new Scanner(System.in); System.out.println("Enter number: "); int num=aa.nextInt(); int sum=0; while(num!=0) { int remainder=num%10; sum+=remainder; num/=10; } System.out.println(sum); } } 

Calculate number of Even or odd digits in java

 package ProgramsPractice; import java.util.Scanner; public class EvenOrOdd { public static void main(String[] args) { Scanner sd=new Scanner(System.in); System.out.println("Enter the number: "); int input_num= sd.nextInt(); String num_st=Integer.toString(input_num); System.out.println(num_st); char[] nums= num_st.toCharArray(); int count_even=0; int count_odd=0; for (int i=0;i<nums.length;i++) { if (nums[i]%2==0) { count_even++; }else { count_odd++; } } System.out.println(count_even); System.out.println(count_odd);                     //2 2nd method Scanner sd=new Scanner(System.in); System.out.println("Enter the number: "); int input_num= sd.nextInt(); int count_even=0; int count_odd=0; while(input_num!=0) { int r=input_num%10; if(r%2==0) { count_even++; }else { count_odd++; }...

Calculate no of digits

 package ProgramsPractice; import java.util.Scanner; public class noOfDigits { public static void main(String[] args) { int count=0; Scanner n = new Scanner(System.in); System.out.println("Enter the number: "); int num=n.nextInt(); while (num!=0) { num/=10; count++; } System.out.println(count); } }

String is palindrome or not

 package ProgramsPractice; import java.util.Scanner; public class StringPalindrome { public static void main(String[] args) { Scanner rs= new Scanner(System.in); System.out.println("Enter string: "); String str=rs.next(); String org_str=str; char[] a= str.toCharArray(); int length= a.length; String rev=""; for (int i=length-1;i>=0;i--) { rev=rev+ a[i]; } // System.out.println(rev); // System.out.println(str); if(str.equals(rev)) { System.out.println("palindrome"); }else { System.out.println("not a palindrome"); } } }

Number is Palindrome or not

 package ProgramsPractice; public class Palindrome { public static void main(String[] args) { int num=132341; int input=num; int rev=0; while(num!=0) { rev= rev*10+num%10; num/=10; } System.out.println(rev); System.out.println(num); if(rev==input)  System.out.println("palindrome"); else { System.out.println("not a palindrome"); } } }

Reverse a string (in 3 ways)

 package ProgramsPractice; import java.io.StringBufferInputStream; import java.nio.charset.Charset; public class ReverseString { public static void main(String[] args) { // 1.string concatenation String s="amazon"; int length=s.length(); System.out.println(length); String rev=""; for(int i=length-1;i>-1;i--) { rev= rev+ s.charAt(i); } System.out.println("Reversed String is "+ rev); //2. using characterarray String p="amazon"; int length=p.length(); char[] arr=p.toCharArray(); String rev=""; for(int i=length-1; i>=0;i--) { rev=rev+arr[i]; } System.out.println(rev); //3. using string bufferclass String str="Shiva"; StringBuffer sb= new StringBuffer(str); System.out.println(sb.reverse()); } }

Reverse a Number using algorithm

 package ProgramsPractice; import java.util.Scanner; public class ReverseAnumber_algo { public static void main(String[] args) { Scanner ss=new Scanner(System.in); System.out.print("Enter a number: "); int input = ss.nextInt(); int rev=0; while(input!=0) { rev=rev*10+input%10; input/=10; } System.out.println(rev); } }

Reverse a number Java Program

 package ProgramsPractice; import java.util.Scanner; public class ReverseANumber { public static void main(String[] args) { //This will accept the input from the user during runtime Scanner sc=new Scanner(System.in); System.out.print("Enter a number: "); int input =sc.nextInt(); //input number gets stored here int new_var=input; //Count number of digits int digits=0; while(input!=0) { digits++; input/=10; } System.out.println("Entered number is: "+new_var); System.out.println("Number of digits are: "+digits); int Rev_num=0; for(int i=1;i<=digits;i++) { Rev_num+=(int) ((new_var%10)*(Math.pow(10, digits-i))); new_var/=10; } System.out.println("Reverse Number is: "+Rev_num); } }

Convert "t3i5k2vvhg3" to "tikvvhg3523"

from pickletools import int4 old_string = "t3i5k2vvhg3" # newstrig=3523tikvvhg new_string = "" print ( type ( old_string [ 1 ])) for i in old_string : if not i . isdigit (): new_string += i for i in old_string : if i . isdigit (): new_string += i print ( new_string )