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.
Answer: Option E
Solution(By Examveda Team)
In for loop the three statements parts are separated by two semicolons which are missing here.
Which control structure is used to repeatedly execute a block of code in C?
A. for loop
B. if statement
C. switch case
D. while loop
In C, what is the purpose of the 'break' statement within a loop?
A. Continue to the next iteration
B. Exit the program
C. Terminate the loop and exit it
D. Skip the current iteration
What is the purpose of the 'else' statement in C's 'if-else' control structure?
A. Execute the 'if' block
B. Execute the 'else' block
C. Execute both 'if' and 'else' blocks
D. Skip the 'if' block
Which control structure is used to make a decision between two or more alternatives in C?
A. switch case
B. for loop
C. if statement
D. while loop
Join The Discussion