Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Q7: Quiz#7: Control flow transformation
1. Q7: Control flow transformation
38: Quiz#7: Control flow transformation , Name: ___________________________
CS 340, Fall 2019, York College of Pennsylvania
41, 20 points, 2019-11-07 (at start of class)
On a blank piece of paper, do the following.
You will be given a small C program consisting of a one or more while loops and one or more if conditionals. Only the main routine will be present and only integer or double variables will be used.
Write an equivalent C program that uses labels and goto statements to remove the while and conditional statements. All other statements should retain their same relative position and same form.
All labels should have the form "
Lx" where "
L" is the upper case letter "
L" and "
x" is the next label in the sequence - as in the examples covered in class.
2. Relevant content
3. General comments
Here are some general comments.
Labels should be in the order used. Used means used as one would read any text, top to bottom, left to right, as in the examples.
The goto statements replace control structures such that no curly braces should appear in the converted program text (within the area of code to be converted).
No improvements were to be made on the negation of the conditionals.
4. Post-quiz question and solution
5. Scoring rubric
CS 340 - Q7 : Quiz#7: Control flow transformation
Your grade: _ / 20
[LATE] Late or redo penalty: _ / -20
unchanged code and in order: _ / 4
labels and in order used: _ / 4
goto and placement: _ / 4
if goto and placement: _ / 4
negated expressions: _ / 4
[CREDIT] Extra credit: _ / +4
Comments:
6. End of page