{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


HW1_AnswerKey_GradingComments - types 1 Answers which...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Answer1: Grading Comments: Most of the class got the diagram right.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Answer2: The number of basic blocks can exceed the number of program statements when individual program statements contain internal control flow. There are several cases in which this occurs in Java, C, and C++: Short-circuit evaluation of conditions. For example, the single expression ( a < 10 || b < 10 || c < 10 || d < 10 ) is broken into four different basic blocks, with the last test (d < 10) executed only if all three of the prior tests evaluate to False. Conditional expressions like a < 10 ? 20 : 30, which might be nested to any depth, e.g., a < 10 ? (b < 10 ? 30 : 20) : 10). Complex statements like the head of a for loop, which contains a loop initialization expression, a loop continuation test, and a loop increment expression, all of which appear in different basic blocks. Grading Comments: All the correct and partially correct answers were categorized broadly into three
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: types:- 1. Answers, which mentioned all the scenarios namely: Short-circuit operators, nested Conditional expressions and complex statements like “for” loop followed by an explanatory example got full credits of 5 marks. Considerable percentage of class has got this completely correct. 2. Answers, which captured all the scenarios but lacked an example, received 4 or 4.5 marks (based on explanation). The answers which gave an example but missed one scenario also fall in this category. 3. Answers, like “ single statement can be broken into several blocks ” or “complex predicates can require division into separate basic blocks” without any further details and examples have received 3 or 2 (based on explanation). Answers which mentioned that the number of basic blocks cannot exceed the number of program statements have not received any credit....
View Full Document

{[ snackBarMessage ]}

Page1 / 2

HW1_AnswerKey_GradingComments - types 1 Answers which...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online