Java Online Exam-Quiz2

Please enter your email:

1. Find the output of the following code.

Public class Solution{
         Public static void main(String args[]){
                 Int i;
                 for(i = 1; i < 6; i++){ 
                     if(i > 3) continue;
                 }
                 System.out.println(i);
          }
}
 
 
 
 

2. Find the value of A[1] after execution of the following program.

int[] A = {0,2,4,1,3};
for(int i = 0; i < a.length; i++){
    a[i] = a[(a[i] + 3) % a.length];
}
 
 
 
 

3. Find the output of the following code.

Public class Solution{

Public static void main(String… argos){

Int x = 5;

x * = (3 + 7);

System.out.println(x);

 
 
 
 

4. How many objects will be created in the following?

String a = new String(“Interviewbit”);

String b = new String(“Interviewbit”);

Strinc c = “Interviewbit”;

String d = “Interviewbit”;

 
 
 
 

5. How many times will “Interviewbit” be printed.

Int count = 0;
do{
  System.out.println(“Interviewbit”);
  count++;
} while(count < 10);
 
 
 
 

6.

Find the output of the following code.

if(1 + 1 + 1 + 1 + 1 == 5){
  System.out.print(“TRUE”);
}
else{
  System.out.print(“FALSE”);
}
 
 
 
 

7.

Automatic type conversion is possible in which of the possible cases?

 
 
 
 

8. Find the output of the following program.

public class Solution{
       public static void main(String[] args){
               int[]  x = {120, 200, 016};
               for(int i = 0; i < x.length; i++){
                        System.out.print(x[i] + “ “);
               }                   
       }
}
 
 
 
 

9. Find the output of the following program.

public class Solution{

public static void main(String[] args)

{

byte x = 127;

x++;

x++;

System.out.print(x);       }}

 
 
 
 

10.

When is the finalize() method called?

 
 
 
 

11. Number of primitive data types in Java are?

 
 
 
 

12.

Where does the system stores parameters and local variables whenever a method is invoked?

 
 
 
 

13.

In which of the following is toString() method defined?

 
 
 
 

14.

Select the valid statement to declare and initialize an array.

 
 
 
 

15.

What is the size of float and double in java?

 
 
 
 

16. What does the following string do to given string str1.

String str1 = “Interviewbit”.replace(‘e’,’s’);

String str1 = “Interviewbit”.replace(‘e’,’s’);

 
 
 
 

Question 1 of 16

error: Content is protected !!