Consider the following code segment in C++. How many times for loop will be…

KVS TGT/PGT 2018Kendriya Vidyalaya Sangathan 2018

Consider the following code segment in C++. How many times for loop will be repeated? int main() { int f = 1; for (; f; ) cout << "f = " << f++ << "\n"; return 0; }

  1. A.

    10 times

  2. B.

    Not even once

  3. C.

    Repeated forever

  4. D.

    Only once

Attempted by 585 students.

Sign up free to check your answer

Sign up free

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…