Fichas
Test II
Fichas del conjunto (30)
- 1Why Is Repetition Needed? (3)Repetition allows efficient re-use of variables
Repetition allows processing of input when the
number of input items is not known
Repetition allows processing until a predefined
limit is met - 2while Looping Structure (2)-while (expression)
statement
-statement is called the body of the loop - 3eof is a member of what data typeistream
- 4They syntax for the function eof isistreamVar.eof()
Where istreamVar is an input stream variable such as cin - 5The general form of the for statement isfor (initial statement; loop condition; update statement)
statement - 6The initial expression, loop condition, and update expression are calledfor loop control expressions
- 7whats in XXX if the output is 10 9 8 7... 1 for (i=10; XXX; i--) {cout << i}i>=1
- 8what does the "break" statement doexits the loop early, skips the remainder of the switch structure
- 9what does a "continue" statement doit skips the remaining statements and proceeds with the next iteration
- 10What are the 3 ways a while loop can be controlledcounter, sentinel, EOF
- 11what is a sentinela value that marks the end of input data
- 12a program can proceed in what 3 waysin sequence, selectively, repetitively
- 13What is a relational operatorA condition is represented by a logical (Boolean)
expression that evaluates to true or false - 14The = symbol is pronounced as what"is"
- 15what is the solution to comparing floating point equalityuse a tolerance value, example: fabs(x-y) < 0.000001
- 16how are strings comparedcharacter by character, if two strings have different lengths and the comparison is equal until the end the shorter string is less, if a mismatch is encountered those characters are compared
- 17what are logical (boolean) operators!, &&, ||
- 18associativity of relational and logical operators isleft to right
- 19what defines the order in which relational operators are executedprecedence
- 20what is short circuit evaluationevaluation of a logical
expression stops as soon as the value of the
expression is known - 21what does this evaluate to and what is the correct way to write this 0 <= num <= 10true,
0 <= num && num <= 10 - 22what is one-way selectionif (expression)
statement
The statement is executed if the expression is true - 23what is two-way selectionif else etc.
- 24= in place of == is asilent killer, its not a syntax error it is a logical error, "is" versus "equivalent to"
- 25what predefined function is useful in stopping program execution when certain elusive errors occurassert
- 26how does the assert function workassert(expression);
if expression evaluates to false the program terminates - 27relational operators==, <, <=, >, >=, !=
- 28false always has a value of __ and true always has a __ value0, nonzero
- 29logical expressions evaluate totrue or false
- 30logical operators! (not), && (and), || (or)
Información
- Descripción
- GRE CSC EGR Fichas sobre Test II, creado por Brooks Johnson el 21/03/2023.
- Creado por
- Brooks Johnson
- Visitas
- 0
- Valoración