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

PYQ Infosys Hiring Test 2025

What will be the output of the following code?

#include <iostream>
using namespace std;
int main ()
{
    int x = 0, y = 1;
    for (; y; cout << ++x << y++ << " ")
    {
        x = y++ <= 15;
    }
    return 0;
}
  1. A.

    31,71,41,60,21

  2. B.

    22 23 44 55

  3. C.

    21 31 51 61

  4. D.

    Infinite loop

Attempted by 79 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…