|
|
CS 215: UNIX C Programming
Review for Quiz 2
- The statements of a program found between
the two braces of a while loop are called
a(n) _______.
- square
- block
- area
- unit
- A while loop continues to execute (to loop) until
the test condition becomes _______.
- true
- false
- null
- equal
- Which one of the following assignment
statements is valid?
- 2000 = i + 2;
- i + 2 = 2,000;
- i = i + 2,000;
- i = 2 + 2000;
- With integer division, which is the
value of 5 divided by 4?
- 0
- 1
- 1.2
- 2
- What is the value assigned to the integer
variable, butter, given the statement
butter = 25.0 + 60.0 * 5/10;
- 0
- 32
- 42.5
- 55
- What is the value of the variable, score,
given the statement
score = -7 * 6 + (4 + 3 * (2 + 3));
- -23
- -7
- 6
- 61
- Which of the following means the same as the statement
x = x + 1;
- x++;
- x+;
- ++x;
- Both a and c are correct answers.
- What is the value of the variable, nextrun,
given the statements
y = 2;
n = 3;
nextrun = (y + n++) * 6;
- 21
- 26
- 30
- 36
- Which of the following is the postfix form of
the decrement operator?
- count --
- -- count
- count -
- - count
- Repeating a sequence of statements until some
condition is met is best known as ______.
- sequencing
- looping
- branching
- checking
- Using a test to decide between alternative sequences is best
known as _____.
- sequencing
- looping
- branching
- checking
- For a while loop to terminate its execution, the value
of the test expression must eventually become _____.
- equal to high
- equal to low
- true
- false
- All of the following are relational operators except which
one?
- >
- =
- <=
- !=
- The expression 5 > 2 is ___ and has a value of ___.
- true, 0
- true, 1
- false, 0
- false, 1
- Which of the following is (are) involved in setting
up a loop that is repeated a fixed number of times?
- A counter must be initialized.
- The counter must be compared with some
limiting value.
- The counter is incremented each time the loop is
traversed.
- All of the above are involved.
- Which part of the following for loop is the
initialization expression?
for(count = 1; count <= num; count++)
printf("Loop");
- count = 1
- count <= num
- count++
- printf("Loop");
- The for loop is a(n) ___-condition loop.
- early
- exit
- easy
- entry
- Which of the following statements means the same as
time /= 2.73;
- time = time + time/2.73;
- time = time/2.73;
- time = time + 2.73;
- time = time/2.73 + time/2.73;
- What is the minimum number of times the block within
a do-while loop will be executed?
- Minus one times.
- Zero times.
- One time.
- More than one time.
- Which of the following is used to reference the 5th element
of the array debt, which is declared as follows:
float debt[30];
- debt[4]
- debt[5]
- debt[6]
- Either a or b are correct.
- The statement in following general form is executed,
if the expression is found to be ____.
if (expression)
statement;
- false
- high
- true
- low
- Which of the following getchar() statements is valid?
- ch = getchar(c);
- ch = getchar(&c);
- ch = getchar();
- Both a and c are correct answers.
- Which of the following is equivalent to the expression
! (4 > 7)
- ! (4 <= 7)
- ! (4 < 7)
- 4 <= 7
- 4 < 7
- The general form of the conditional expression is
- expression1 : expression2 ? expression3
- expression1 ? expression2 : expression3
- expression1 ? expression2 ? expression3
- expression1: ?expression2 : expression3
- When a ___ statement is encountered in a loop, it causes the
rest of the iteration to be skipped and the next iteration of
the loop to be started.
- case
- goto
- break
- continue
- A ___ statement in a loop causes the remainder of the
iteration to be skipped and does not start the next
iteration of the loop.
- case
- goto
- break
- continue
- When a program needs to choose from one of several
alternatives, which statement is advised?
- case
- continue
- goto
- switch
- Which statement is usually the last statement for every case
in a switch statement?
- continue
- goto
- break
- jump
- In principle, how many goto statements should be placed in
every C program?
- 0
- 1
- 2
- There is no upper limit.
- All of the following are forms of jump statements except
which one?
- if
- goto
- continue
- break
- Which of the following operators is the logical OR operator?
- &&
- ||
- !
- !!
|