Q50
What's wrong in the following statement, provided k is a variable of type int? for(k = 2, k <=12, k++)
A.
The increment should always be ++k .
B.
The variable must always be the letter i when using a for loop.
C.
There should be a semicolon at the end of the statement.
D.
The variable k can’t be initialized.
E.
The commas should be semicolons.
AnswerAnswer: Option E
Solution
Answer: Option E
Solution:
In for loop the three statements parts are separated by two semicolons which are missing here.