Week 12

1 Which of the following are generally true about "goto" statements?
1) They can jump forward to a location later in the current code block.
2) They can jump backward to a location earlier in the current code block.
3) They can jump between threads of execution in the same process.
4) They can jump between threads of execution in different processes.
5) None of the above
2 What technique(s) were developed, starting in the 1960s, to aid the development of correct and reliable programs?
1) Object-based programming
2) Object-oriented programming
3) Object-relational programming
4) Structured programming
5) None of the above
3 The drawbacks presented by the use of "goto" statements were most notably questioned by
1) Alan Turing
2) Edsger Dijkstra
3) C. A. R. Hoare
4) Vinton Cerf
5) None of the above
4 The idea of language constructs adhering to a single entry and single exit point semantics is called
1) Ravioli programming
2) Object-oriented programming
3) Structured programming
4) Object-relational programming
5) None of the above
5 Structured programming provides
1) Information hiding.
2) Single entry and single exit point semantics.
3) Type and subprogram grouping (modularity).
4) Single inheritance.
5) None of the above
6 Which of the following are properties of the if-then-elsif-else-end statement?
1) It is ambiguous.
2) Other if-then-elsif-else-end statements can be nested within the "then", "elsif", and "else" parts.
3) The control flow is always textually forward.
4) No more than one of the statement blocks will be executed.
5) None of the above
7 In a if-then-elsif-else-end statement, multiple other statements may be appear within the
1) "then" portion.
2) "elsif" portion.
3) "else" portion.
4) None of the above
8 In the EBNF for the if-then-elsif-else-end statement,
1) The "then" portion must be present.
2) The "elsif" portion may only occur 0 or 1 times.
3) The "elsif" portion may occur 0 or more times.
4) The "else" portion must be present.
5) None of the above
9 Which of the following are properties of the case statement?
1) It is ambiguous.
2) The expression given may be any primitive type (e.g., from Java or C++).
3) No statements are shared by multiple "when" clauses except through duplication of the statement.
4) Nesting of case statements is not allowed.
5) None of the above
10 The case statement is
1) Semantically equivalent to the if-then-elsif-else-end statement, with each being able to implement the semantics of the other in a given program.
2) More efficient than the if-then-elsif-else-end statement in some circumstances.
3) Unable to implement all of the semantics possible with the if-then-elsif-else-end statement.
4) Not a structured programming compliant construct.
5) None of the above
11 In the EBNF for the case statement,
1) One or more expressions ("expr") may be given.
2) Zero or more "when" sections can be given.
3) The "otherwise" section must be present.
4) Both the "when" and "otherwise" portions must contain one or more statements.
5) None of the above
12 Which of the following are properties of the while-loop-end statement?
1) It is ambiguous.
2) Nesting of while-loop-end statements is allowed.
3) The control flow is always textually forward.
4) The loop must execute at least once.
5) None of the above
13 Which of the following are properties of the loop-until statement?
1) It is ambiguous.
2) Nesting of loop-until statements is allowed.
3) The control flow is always textually forward.
4) The loop must execute at least once.
5) None of the above
14 Which of the following are properties of the for-loop-end statement?
1) It is ambiguous.
2) Nesting of for-loop-end statements is allowed.
3) The control flow is always textually forward.
4) The loop must execute at least once.
5) None of the above
15 The generalized for-loop-end statement
1) Can iterate over collections (using iterators that yield a sequence of values).
2) Must start counting from 0 for index values.
3) Must incremement by 1 for index values.
4) Can simultaneously count over multiple index values.
5) None of the above
16 Which of the following are properties of the generalized loop-end (with exit/break) statement?
1) It is ambiguous.
2) They can completely replace the use of all other types of looping (e.g., while-loop-end, loop-until, for-loop-end).
3) The loops can be "named", reducing the need for "loop escape flags" by programmers.
4) The exit/break statements may appear anywhere in the loop.
5) None of the above
17 The use of multiple exit/break statements within a loop
1) Is not allowed.
2) Is confusing and violates the principle of structured programming.
3) In combination with the "when" clause improves readability over placing exit/break within an if-then-elsif-else-end statement.
4) Can lead to spaghetti code.
5) None of the above
18 The "loop and a half" problem (where some of the loop's logic must be repeated either before or after the loop)
1) Is just part of programming, and cannot be circumvented.
2) Is best handled by the use of the for-loop-end statement.
3) Is best handled by the use of the loop-until statement.
4) Can often be eliminated by the use of an exit/break statement within a generalized loop-end.
 
19 An example violation of the principle of structured programming occurs when
1) A "return" statement in a subprogram appears in the middle of the subprogram text.
2) Multiple "exit" statements appear within a loop.
3) A subprogram's "return" statement appears within a loop.
4) Multiple "return" statements appear within a subprogram.
5) None of the above
{"name":"Week 12", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"1 Which of the following are generally true about \"goto\" statements?, 2 What technique(s) were developed, starting in the 1960s, to aid the development of correct and reliable programs?, 3 The drawbacks presented by the use of \"goto\" statements were most notably questioned by","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker