Java Online Exam-Quiz2

Please enter your email:

1.

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

 
 
 
 

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

3.

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

 
 
 
 

4. Number of primitive data types in Java are?

 
 
 
 

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

 
 
 
 

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

 
 
 
 

7.

Select the valid statement to declare and initialize an array.

 
 
 
 

8.

Find the output of the following code.

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

9.

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

 
 
 
 

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

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

 
 
 
 

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

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

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

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

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

 
 
 
 

14.

When is the finalize() method called?

 
 
 
 

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

16.

What is the size of float and double in java?

 
 
 
 

Question 1 of 16

error: Content is protected !!