One Dimensional Array – Practical 1

Advertisements
Advertisements
Advertisements3
Advertisements4
Advertisements6
Advertisements66
  1. What is the output of the following code?

int[] numbers = {1, 2, 3, 4, 5};

System.out.println(numbers[3]);

Ans. 4.

2.

What is the output of the following code snippet?

int[] numbers = {1, 2, 3, 4, 5};

for(int i=0; i<numbers.length; i++)

System.out.print(numbers[i] + ” “);

}

Ans. 1 2 3 4 5.

Author: Lakshmi Prasanna Ponnala

Completed M.Tech in Digital Electronics and Communication Systems.

Leave a Reply

error: Content is protected !!

Discover more from ece4uplp

Subscribe now to keep reading and get access to the full archive.

Continue reading