Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Question

How long the following loop runs?

	for(x=0;x=3;x++)
	
A Three times
B Four times
C Forever
D Never
Answer & Explanation
Option: [D]

The first statement of a for loop is initialize the loop counter, second is conditional statment and the third one is increment/decrement of the loop counter.

In the given expression the second statement is an assignment statement instead of condition.

So the for loop never execute.

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP
Assam Direct Recruitment Test Series

Computer Science Topics