Where can I find answers to Exercises | Selenium Forum
M
Posted on 09/08/2016
e.g. Module 2 exercises

M
Replied on 10/08/2016

what are the question in module 2?


M
Replied on 10/08/2016

Selenium Training Module 2 Exercises
1) What will following lines print:

String x="We are learning";
String y="mistakes happen";
int z=1000;
System.out.println("Java is easy. "+x+" selenium and "+y+" "+z +" times");

2) Write a for loop to print even numbers bet ween 1 to 100

3) Write a for loop which prints numbers from 1 to 100 but if the number is divisible by 5, it prints 'divisble by 5 followd by that number'

4) Write a for loop to find the sum of first 100 numbers(1 to 100)

5) Write program to display following output

1
12
1234
12345
123456
1234567

6) Make an integer array. Write a for loop to print the integer array in reverse.

7) Print alternate elements of String array array

8) Find the greates number in a array

9) Find the least number in a array

10) Suppose there is an integer array holding following elements:
1,3,4,5,6,3,2,4,6,7,9,4,12,3,4,6,8,9,7,6,43,2,4,7,7,5,2,1,3,4,6,311,1

Write a program which prints which each number from array and the times it has been repeated in array
Fox eg
1- Repeated 3 times
4- Repeated 6 times


11) What will be the output of following program

public class Test {


public static void main(String[] args) {
int i=2;
f1(1);

}

public static void f1(int i)
{
f2(i+1);
}

public static void f2(int i)
{
f3(i+2);
}

public static void f3(int i)
{
System.out.println(i+3);
}


}


12) What will be the output of following:
public class Test {

public static void main(String[] args) {
int x=0;
while(true){
x = increment(x);

System.out.println("Value of x is --"+x);

if(x>10)
break;

}
}

public static int increment(int i){
return i+1;
}
}


13) What will be the output of following program

public class Test {


public static void main(String[] args) {
int i=2;
while(makeDecision(i)){

i=i*i;
System.out.println(i);
}

}

public static boolean makeDecision(int i)
{
if(i%3 != 0){
return true;
}else{
return false;
}
}


}


14) What will be the output of following:

public class Test {

public static void main(String[] args) {

String arr1[] = new String [3];
String arr2[] = new String [3];

arr1[0]="A";
arr1[1]="B";
arr1[2]="C";

arr2[0]="1";
arr2[1]="2";
arr2[2]="3";
printAll(arr2);
printAll(arr1);

}

public static void printAll(String str[]){
for(int i=0; i < str.length ; i++){
System.out.println(str[i]);
}
}

}


15) What will be the output of following:

What will be the output of following:
public class Test {

public static void main(String[] args) {
int a[][] = new int[10][5];
for(int i=0;i<10;i++){

for(int j=0; j<5; j++){
a[i][j]=i*j;
}
}

System.out.println(a[0][0]);
System.out.println(a[1][3]);
System.out.println(a[3][4]);
}


}


M
Replied on 11/08/2016

keep watching java videos these are pretty basic question. you'll learn to answer all of these as you watch the course. but sadly we don't have an answers to these question.