A method is declared as: public static int[] generateSequence(int n) { ... }. Which return statement is valid inside this method?
Creates and returns an int array of size n.
Why this answer
Option C is correct because the return type is int[], and new int[n] creates an array of ints, which matches. Option A returns a primitive int, not an array. Option B returns a reference to an int array, but the assignment is wrong because the method returns a reference; the local variable is unnecessary but valid if assigned.
Actually, 'return new int[n]' is correct; 'int[] result = new int[n]; return result;' is also correct. But among options, C is clearly correct. Option D returns an empty array but that is also valid, but C is more typical.
Need to choose one best. Let's refine: Option C is correct because it directly creates and returns an int array. Option D is also correct but the question asks for a valid statement; both would be valid.
To make a single correct, we can say only C is presented as correct. Actually let me adjust options so only one is fully correct.