What is the output of the following code? [code]a=0;for i=[1:1] q=a-55; end[/code]

What is the output of the following code?
Code:
a=0;for i=[1:1]
q=a-55;
end
A. Syntactical Error
B. Declaration error
C. Output is suppressed
D. q=-55
 
Answer: c
Explanation: The expression for counter can be given within [] in the for statement. The output is suppressed due to the semi-colon after q=a-55. The output of the following code would’ve only been q=-55 if the output was not suppressed. There is no error in the above code.
 

Tìm kiếm

Back
Top