Selamat Datang di Blog Saya. Blog ini dibuat untuk memenuhi tugas dari dosen saya tercinta Bapak Ir.Tri Djoko Wahjono , M.Sc . Kiranya Blog ini bisa menambah pengetahuan bagi kalian. Isi blog ini mengenai konsep bahasa pemrogramman. Dan blog ini di sponsori oleh Bina Nusantara Alam Sutera.
Posted by : Unknown Minggu, 14 Desember 2014

Name : Romy Hermawan
NIM    : 1801378902
Class : LD001
Lecturer: Ir. Tri Djoko Wahjono,M.Sc

REVIEW QUESTION:


6. What is unusual about Python’s design of compound statements?
Answer:
Python uses indentation to specify compound statements. For example,
if x > y :
x = y
print “case 1″
equally indent statements are grouped as one compound statement.

 7. Under what circumstances must an F# selector have an else clause?
Answer:
An F# selector have an “else” clause if the “if” expression does return a value.
 8. What are the common solutions to the nesting problem for two-way 
selectors?
Answer:
The else clause would be paired with the second then clause. The disadvantage of using a rule rather than some syntactic entity is that although the programmer may have meant the else clause to be the
alternative to the first then clause and the compiler found the structure syntactically correct, its semantics is the opposite.

Another way to avoid the issue of nested selection statements is to use an alternative means of forming compound statements.

 9. What are the design issues for multiple-selection statements?
Answer:
– What is the form and type of the expression that controls the selection?
– How are the selectable segments specified?
– How are the case values specified?
– How should unrepresented selector expression values be handled, if at all?
– Is execution flow through the structure restricted to include just a single selectable segment?

 10. Between what two language characteristics is a trade-off made when 
deciding whether more than one selectable segment is executed in one 
execution of a multiple selection statement?
Answer:
The C# switch statement differs from that of its C-based predecessors in two ways. First, C# has a static semantics rule that disallows the implicit execution of more than one segment. The rule is that every selectable segment must end with an explicit unconditional branch statement: either a break,
which transfers control out of the switch statement, or a goto, which can transfer control to one of the selectable segments (or virtually anywhere else).

As with C, if there is no break at the end of the selected segment, execution continues into the next segment.

PROBLEM SET:

6. Analyze the potential readability problems with using closure reserved words for control statements that are the reverse of the corresponding initial reserved words, such as the case-esac reserved words of ALGOL 68. For example, consider common typing errors such as transposing characters.
Answer:
The potential readability problem is the typing errors. It’s very possible to occur if we don’t type the code carefully.

7. Use the Science Citation Index to find an article that refers to Knuth (1974). Read the article and Knuth’s paper and write a paper that summarizes both sides of the goto issue.
Answer:

8. Q: In his paper on the goto issue, Knuth (1974) suggests a loop control
statement that allows multiple exits. Read the paper and write an operational
semantics description of the statement

Answer:
Operational semantics are a category of formal programming language semantics in which certain desired properties of a program, such as correctness, safety or security, are verified by constructing proofs from logical statements about its execution and procedures, rather than by attaching mathematical meanings to its terms (denotational semantics).

9. What are the arguments both for and against the exclusive use of Boolean expressions in the control statements in Java (as opposed to also allowing arithmetic expressions, as in C++)?
Answer:
The primary argument for using Boolean expressions exclusively as control expressions is the reliability that results from disallowing a wide range of types for this use. In C, for example, an expression of any type can appear as a control expression, so typing errors that result in references to variables of incorrect types are not detected by the compiler as errors. No , it would not be a good idea. Although this custom precedence sounds like increasing flexibility, requiring parentheses to show a custom precedence would impact in readability and writability of a program.

10. In Ada, the choice lists of the case statement must be exhaustive, so that there can be no unrepresented values in the control expression. In C++, unrepresented values can be caught at run time with the default selector. If there is no default, an unrepresented value causes the whole statement to be skipped. What are the pros and cons of these two designs (Ada and C++)?
Answer:
Ada was designed for military grade software development. The idea is that whenever you modify code in such a way that a new case emerges (for example adding a new value for an enumeration type), you are forced to manually revisit (and therefore re-validate) all the case statements that analyze it. Having a "default" is risky: you may forget that there is a case somewhere where the new case should not have been handled by the default.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

Diberdayakan oleh Blogger.

- Copyright © Binusian IT 2018(Concept of Programming Language) -Metrominimalist- Powered by Blogger - Designed by Romy Hermawan -