Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
How do you assign the number 15 to the second element of an array named 'nums'?
Remember that arrays start at index 0.
What will be the value of nums[0] after the assignment nums[0] = 10;?
Think about what you assign to the first index.
What is the index of the first element in an array?
Think about how many elements come before the first one.
Is it true that the index for accessing the third element of an array is 2?
Count the indices from 0 for clarification.
Create an array of 10 integers and write a method that assigns random values to each element. Then, retrieve and print the 5th element of your array.
Remember the array index starts at 0, so to access the 5th element use index 4.
Given an array of integers, write a method that returns the maximum number by accessing each element via its index.
Ensure to loop through the array starting from index 1 to compare values.
5 more questions in this section. Enroll free to practise them all.
Enroll free