java Quiz
Sign in to Google to save your progress. Learn more
1. Which of the following is FALSE about arrays on Java
1 point
Clear selection
2. Predict the output?// file name: Main.java                 public class Main {                                                            public static void main(String args[]) {                              int arr[] = {10, 20, 30, 40, 50};                                        for(int i=0; i < arr.length; i++)       {             System.out.print(" " + arr[i]);                     }    }}
1 point
Clear selection
3.                                                                                              class Test {                                                                            public static void main(String args[]) {                              int arr[2];                                             System.out.println(arr[0]);                System.out.println(arr[1]);                                                       }}
1 point
Clear selection
4. class Test {   public static void main(String args[]) {     int arr[] = new int[2];       System.out.println(arr[0]);     System.out.println(arr[1]);   }}
1 point
Clear selection
5. class Test{    public static void main (String[] args)     {        int arr1[] = {1, 2, 3};        int arr2[] = {1, 2, 3};        if (arr1 == arr2)             System.out.println("Same");        else            System.out.println("Not same");    }} *
1 point
6. import java.util.Arrays;class Test{    public static void main (String[] args)     {        int arr1[] = {1, 2, 3};        int arr2[] = {1, 2, 3};        if (Arrays.equals(arr1, arr2))            System.out.println("Same");        else            System.out.println("Not same");    }} *
1 point
Java Data Types
1. class Main {      public static void main(String args[]) {               int t;               System.out.println(t);     }   }
1 point
Clear selection
2. Predict the output of following Java program.class Test {     public static void main(String[] args) {       for(int i = 0; 0; i++)       {           System.out.println("Hello");           break;       }     } }
1 point
Clear selection
3. Predict the output of the following program.class Test{    public static void main(String[] args)    {        Double object = new Double("2.4");        int a = object.intValue();        byte b = object.byteValue();        float d = object.floatValue();        double c = object.doubleValue();         System.out.println(a + b + c + d );     }}
1 point
Clear selection
4. Which of the following statements is/are TRUE regarding JAVA ? (a) Constants that cannot be changed are declared using the ‘static’ keyword. (b) A class can only inherit one class but can implement multiple interfaces.
1 point
Clear selection
Next
Clear form
Never submit passwords through Google Forms.
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy