Q.– Given the code fragment:
int[] array = {1, 2, 3, 4, 5};
And given the requirements:
1. Process all the elements of the array in the reverse order of entry.
2. Process all the elements of the array in the order of entry.
3. Process alternating elements of the array in the order of entry.
Which two statements are true?
A) Requirements 1, 2, and 3 can be implemented by using the standard for loop.
B) Requirement 2 can be implemented by using the enhanced for loop.
C) Requirements 1, 2, and 3 can be implemented by using the enhanced for loop.
D) Requirement 3 CANNOT be implemented by using either the enhanced for loop or the standard for loop.
E) Requirements 2 and 3 CANNOT be implemented by using the standard for loop.
⧪ please give your answer in a comment section.
int[] array = {1, 2, 3, 4, 5};
And given the requirements:
1. Process all the elements of the array in the reverse order of entry.
2. Process all the elements of the array in the order of entry.
3. Process alternating elements of the array in the order of entry.
Which two statements are true?
A) Requirements 1, 2, and 3 can be implemented by using the standard for loop.
B) Requirement 2 can be implemented by using the enhanced for loop.
C) Requirements 1, 2, and 3 can be implemented by using the enhanced for loop.
D) Requirement 3 CANNOT be implemented by using either the enhanced for loop or the standard for loop.
E) Requirements 2 and 3 CANNOT be implemented by using the standard for loop.
⧪ please give your answer in a comment section.
4 Comments
Option B D
ReplyDeletegood B is correct, not d
ReplyDeletea b
ReplyDeleteAD
ReplyDelete