What will be the output of the below code? #include <iostream> using namespace…

2025

What will be the output of the below code?

#include <iostream>
using namespace std;

int main()
{
    int arr[2] = {1, 2};

    cout << 0[arr] << ", " << 1[arr] << endl;

    return 0;
}

Answer: A. 1, 2

  1. A.

    1, 2

  2. B.

    Syntax error

  3. C.

    Run time error

  4. D.

    None of these

Attempted by 192 students.

Show answer & explanation

Correct answer: A

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…