Chapter 8
what scheme functions implements a multiple selection statement?
COND
What common programming language borrows part of its design from Dijkstra's guarded commands ___
CSP
On what previous language was C's switch statement based?
ALGOL 68
What are the design issues for logically controlled loop statements? Should the control be pretest? Should the control be posttest? Should the logically controlled loop be a special form of a counting loop? All the above
All the above
i) for(exp1; exp2;exp3) { ...} ii) while (exp) { ...} iii) goto - label iv) do {...} while(exp) note: exp - legal expression Identify the Repetitive flow control mechanisms_____________ i,ii & iv ii,iv only i,ii only all the above
All the above
what is the definition of block
Block is a sequence of code delimited by either braces or the do and end reserved words.
Ada, Java, Ruby, and C#, only _____ ______ can be used as control expressions.
Boolean expressions
what is the differences between the break statement of C++ and that of java?
C++ has unconditional unlabeled exit with name break, while Java has unconditional la-beled exit with the same name. C++ can only break the loop in which the break scope it was in, while Java can break straight to any targeted loop.
Repetitive execution of statements or a group of statements can be controlled by initial, terminal and step size of the loop variables. These specific types of flow control statements are called ____________
Counter- Controlled Loops
under what circumstances must an F# selector have an else clause?
If the expression returns a value, it must have an else clause
A counter-controlled has three loop parameters: - ______ value of the loop variable - ______ value of the loop variable - _____ _____ the difference between sequential values of the loop variable
Initial,Terminal, and Step size
What contemporary language/s do not include a goto?
Java
Name two languages having loop exit statements that include a label. ______ ______
Java - break Perl - last
what is unusual about python 's design of compound statements?
Python uses indentation to specify compound statements.
_______, ______, and ______ allow either arithmetic or Boolean expressions are used control expressions.
Python, C99, and C++
what does the range function in python do?
Range function is to determine the range of the looping, the initial point and the end point of the looping.
how are iterators implemented in Ruby?
Ruby predefines several iterator methods, such as times and up to for counter-controlled loops, and each for simple iterations of arrays and hashes
_____________ provides the means of choosing between two or more execution paths in a program.
Selection statement
_________ allows the selection of one of any number of statements or groups.
Switch-case
what are the design issues for user located loop control mechanisms?
The design issues are whether the conditional mechanism should be an integral part of the exit or not & whether only loop body should be exited, or enclosing loops can also be exit-ed .
what is the differences between for statement of C++ and that of java?
The loop control expression in Java is restricted to Boolean, unlike that of C++, even though the syntax is similar.
_______________ statement transfers execution control to a specified location in the program without a selector expression.
Unconditional branching
In C89, _____ _____ are used as control expressions.
arithmetic expressions
The _____ of a loop is the collection of statements whose execution is controlled by an iter-ative statement.
body
What is an unlabeled loop exit in C, C++, Python, Ruby, and C#? ______
break
_______ statement/s helps you get out of the loop totally leaving the execution of remain-ing block.
break;
_______ statement/s helps you skip the rest of the loop execution and goes back to top of the loop.
continue;
_____ ______ provide these two capabilities: - Select from among alternative control flow paths. - Repeatedly execute sequences of statements.
control statements
A ______ ______ is a control statement and the collection of statements whose execution it controls.
control structure
A ______ loop has a loop variable in which the count is stored.
counter-controlled
which loop mechanism works on a protest loop statement _________
do -while loop
Which loop mechanism works on a pretest loop statement ______
for- loop and while -loop
The iterative statement and the associated loop body together form an _____ ______.
iteration construct
An ______ ______, or ______, causes a statement or collection of statements to be execut-ed zero, one, or more times.
iterative statement, or loop
One way to do so is to use an ______, a function that can visit each element of a data struc-ture.
iterator
The _____ construct allows the selection of one of any number of statements or statement groups.
multiple-selection
A _____ loop tests the condition for loop completion after the loop body is executed.
posttest
A _____ loop tests the condition for loop completion before the loop body is executed
pretest
A _____ ______ provides a way of choosing between two or more execution paths in a program (two ways).
selection statement
An ______ ______ ______, or goto, transfers control to a specified location in a program.
unconditional branch statement
what is a user defined iteration control?
user-defined iteration control is the one that issues a special call to the iterator, in which the iterator is called at the beginning of each iteration, and each time it is called, the itera-tor returns an element from a particular data structure in some specific order