Java Online Exam-Quiz2

Please enter your email:

1. 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];
}
 
 
 
 

2.

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

 
 
 
 

3. 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”;

 
 
 
 

4. 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);

 
 
 
 

5. Number of primitive data types in Java are?

 
 
 
 

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. 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);       }}

 
 
 
 

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.

What is the size of float and double in java?

 
 
 
 

10. 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);
          }
}
 
 
 
 

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

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

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

 
 
 
 

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

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

13.

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

 
 
 
 

14.

When is the finalize() method called?

 
 
 
 

15.

Select the valid statement to declare and initialize an array.

 
 
 
 

16.

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

 
 
 
 

Question 1 of 16

error: Content is protected !!