Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
26 Cards in this Set
- Front
- Back
_____ ______ 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 _____ ______ provides a way of choosing between two or more execution paths in a program (two ways).
|
selection statement
They take the form: if control_expression then clause else clause |
|
In C89, _____ _____ are used as control expressions.
|
arithmetic expressions
The result of the expressions are compared to zero. |
|
_______, ______, and ______ allow either arithmetic or Boolean expressions are used control expressions.
|
Python, C99, and
C++ |
|
Ada, Java, Ruby, and C#, only _____ ______ can be used as control expressions.
|
Boolean expressions
|
|
The _____ construct allows the selection of one of any number of statements or statement groups.
|
multiple-selection
|
|
An ______ ______, or ______, causes a statement or collection of statements to be executed zero, one, or more times.
|
iterative statement, or loop
|
|
The _____ of a loop is the collection of statements whose execution is controlled by an iterative statement.
|
body
|
|
The iterative statement and the associated loop body together form an _____ ______.
|
iteration construct
|
|
A _____ loop tests the condition for loop completion before the loop body is executed
|
pretest
while() loop |
|
A _____ loop tests the condition for loop completion after the loop body is executed.
|
posttest
|
|
A ______ loop has a loop variable in which the count is stored. It also has three loop parameters:
- ______ value of the loop variable - ______ value of the loop variable - _____ _____ — the difference between sequential values of the loop variable |
counter-controlled
Initial Terminal Step size remember for loop |
|
Fortran 95 Do Statement
|
Do 10 Count = 1, 10
.... 10 Continue |
|
In Fortran 95 when is the loop count determined? If the loop control variables are modified, which will it modify the loop count?
|
Loop Count is determined at the start of the loop from the initial value, terminal value and step size. The loop variable can be modified but it will not change the loop iteration count.
|
|
Format of an Ada loop statement.
|
for variable in [reverse] descrete_range loop
... end loop; |
|
Restrictions on the Ada for statement
|
- The loop variable cannot be assigned a value in the loop body.
- The discrete range is evaluated only once. Variables used to specify the range can be changed within the loop without affecting the number of iterations. - It is not legal to branch into the loop body. |
|
Perl and Ruby have two pretest logical loops. What are the reserved words used to define them.
|
Perl and Ruby have two pretest logical loops, while and until. The until statement is similar to the while statement, but performs the opposite test on the control expression. Perl also has do/while and do/until posttest loops.
|
|
What is a unlabeled loop exit in C, C++, Python, Ruby, and C#.
|
break
|
|
Name two languages having loop exit statements that include a label.
|
Java - break
Perl - last |
|
One way to do so is to use an ______, a function that can visit each element of a data structure.
|
iterator
|
|
Describe the PHP array iterator.
|
- The current function returns the element that is currently being pointed to by the internal pointer.
- The next function moves current to the next element. - The prev function moves current to the previous element. - The reset function sets current to the array’s first element. |
|
Describe the Java Iterator interface methods.
|
- next returns the next element in the collection.
- hasNext returns true if there is at least one more unvisited element. - remove removes the current element from the collection. |
|
Describe the new for statement introduced in Java 5.
|
called the "foreach"
for (String myElement : myList) { … } It's likely that the Java language designers did not want to introduce new keywords to the language. |
|
Describe the C# foreach statement.
|
String[] strList = {"Bob", "Carol", "Ted", "Beelzebub"};
… foreach (String name in strList) { Console.WriteLine("Name: {0}", name); } |
|
An ______ ______ ______, or goto, transfers control to a specified
location in a program. |
unconditional branch statement
|