Each of the following has at least one error, either intent, or an error that may be caught by the compiler or both). What is the error? Assume all the variables you see are defined and initialized.
a) for(int i = 0; i <10; i++);
sum = sum +x;
b) if (x > 0)
x = 3
else
x =4;
c) if(x = 0) x = MAXINT;
d) if x > 0 x = 3;
e) if (x>0) then x =3;
a) Not wrong, but the semicolon is probably an intent error. b) Semicolon
missing in the yes_clause. c) The = probably should be ==. d) needs parenthese
to be correct C++. e) C++ does not use “then” as a keyword. If we blindly fix the
syntax, whatever the ”then” might be, there needs to be a semicolon after it, and
the sequence then; x=3; should probably be in curly braces. Actually, there no
way to guess what the programmer might mean here. There is a good chance the
programmer is a refugee from Pascal, and then should be deleted.
You might also like to view...
A stateful packet inspection firewall examines each packet, and denies or permits access based not only on the current packet, but also on data derived from previous packets in the conversation
Indicate whether the statement is true or false.
David Trueheart's last name is marked as misspelled on slides in his presentation. His name appears on several slides. When he uses the Spelling command and his last name appears in the Spelling pane, which of the following commands is the best choice for resolving this?
What will be an ideal response?
Briefly describe the information displayed on a Gantt chart in an automated project management application.
What will be an ideal response?
List nodes normally are not necessarily stored in contiguous memory. Rather, they’re ________ contiguous.
a. physically b. approximately c. comparably d. logically