Programming langauge help
crazybob3
Concepts of Programming Languages C ha p t er 8 - S t a t e me n t -L e ve l Co n tro l S t r u ct u re s - R ev i ew
What is the definition of control structure?
A control structure is a control statement and the collection of statements whose execution it controls
What is the definition of block?
A block is sequence of code, delimitated by either braces or the do and end reserved words.
What are the design issues for all selection and iteration control statements?
Selection statements: o What are the form and type of the expression that control the selection? o How are the then and else clauses specifies? o How should the meaning of the nested selectors be specified?
Iteration control statement: o What are the type and scope of the loop variable? o Should it be legal for the loop variable or loop parameters to be changed in the
loop, and if so, does the change affect loop control? o Should the loop parameters be evaluated by only once or once for every iteration?
What is unusual about Phyton designs of compound statement?
Many languages use braces to form compound statements, which serve as the body of then and else clause. In Phyton, the then and else clauses are statement sequences, rather than compound statements. The complete selection statement is terminated in these languages with reserved words. Phyton uses indentation to specify compound statements.
What are the common solution to the nesting problem for two way selector?
The common solution to the nesting problem is to use alternating means of forming a compound statements.
What are the design issues for multiple selection statement?
What is the form and type of the expression that controls the selection? How are the selectable segments specified? Is the flow through the structure restricted to include just a single selectable segment? How are the case values specified? How should unrepresented selectors expressions values be handled, if at all?
What is unusual about the C’s multiple selection statement?
The C switch statement has virtually no restrictions on the placement of the case expressions, which are treated as if they were normal statement labels. This laxness can result in highly complex structure within the switch body.
On what previous language does the C multiplier selection statement based on?
ALGOL
Explain how C# switch statement is safer than that of C?
C# has a static semantics rule that disallows the implicit execution of more than one segment. Every segment must end with an explicit unconditional branch statement which transfer control out of the switch statement, or a goto, which can transfer control to one of the selectable segments
What is a pretest loop statement? what is a posttest loop statement?
Pretest - The test for loop completion occurs before the loop body is executed Posttest – The test occurs after the loop body is executed