Open In App

Top | MCQs on Array Data Strcuture with Answers | Question 15

What will do the following code?




void fun(int arr[], int n)
{
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            for (int k = i; k <= j; k++)
                cout << arr[k] << " ";
 
            cout << endl;
        }
    }
}

(A)



Prints the subsequence of the article.

(B)



Prints the elements of the array

(C)

Prints the subarray of the element.

(D)

None


Answer: (C)
Explanation:

The above code will print subarray of the elements.

Hence the correct option is(C).

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :
Uncategorized