Tag: technology

Questions Related to technology

  1. a. int arr[][] = new int[5][5];

  2. b. int []arr[] = new int[5][5];

  3. c. int[][] arr = new int[5][5];

  4. d. int[] arr = new int[5][];

  5. e. int[] arr = new int[][5];


Correct Option: A,B
  1. a. String str[];

  2. b. String str[5] = new String[5];

  3. c. String str[] = new String[] {"string1", "string2", "string3", "string4", "string5

  4. d. String str[] = {"string1","string2", "string3", "string4", "string5"};


Correct Option: A,C,D

6 What will happen when you compile the following code? 1. package sources; 2. public class firstjava { 3. public static void main(String args[]) 4. { 5. private int a[] ={ 4, 4 }; 6. public int b=1; 7. a[b]=b=0; 8. System.out.println("value of b & a[0] & a[1]" + b + a[0] +a[1]); 9. } 10. }

    1. Compilation error at line 2
    1. Runtime error at line 7.
    1. Compilation error at Line 7
    1. Compiles and prints 0 0 4
    1. Compiles and prints 0 4 0

Correct Option: A