Lab Packet 1

a compound statement that contains variable declarations is

a block

variables defined inside a set of braces are said to be ____ to that block of code

local

write the loop condition to continue a while loop as long as x is negative

while (x < 0)

A loop that iterates one too many or one too few times is said to be

off by one

<< is called the

insertion operator

Is << used for input or output?

output

what is the correct conditional statement to determine if x is between 19 and 99?

if (19 < x < 99)

The braces for a loop define the _____ of the loop

body

A _____ loop always executed the loop body at least once, regardless of the loop condition

do while

if-else statements that are inside other if-else statements are said to be

nested

Each time a loop body executed is known as an

iteration

a switch statement variable must be

integer bool char enum

the code following the ___ case is executed if none of the other cases are matched in a switch statement

default

the stream that is used for output to the screen is called

cout

the stream that is used for input from the keyboard is called

cin

a loop that always executes the loop body at least once is known as a ____ loop

do while

when must we use braces to define the body of a conditional expression?

when there's more than one condition

>> is known as the

extraction operator

int myValue; is called a

variable declaration

a ___ expression is an expression that can be thought of as being true or false

bool

the compiler always pairs an else with

a preceding if

in a compound logical and (&&) expression, the evaluation of the expression stops once one of the terms of the expression is false. this is known as ___ evaluation.

short circuit

____ is a type whose values are defined by a list of constants of type int

enum

each repetition of a loop body is called an

iteration

which of the following is not a valid identifier: total3, myInt, myInteger, return

return

what is the value of x after the following statements:
int x;
x = 15/4;

3

what is the value of x after the following statements:
int x;
x = 15%4;

3

what is not a good reason for choosing a certain loop control?

if the loop is in a function

which of the following as the highest precedence? : &&, -, ++, ||

++

the body of a do while loop aways executes at least once

t

the integer 0 is onsidered true

f

all switch statements can be converted into nested if-else statements

t

if x has the value of 3 and y has the value of -2 and w is 10, is the following condition true or false?
if (x < 2 && w < y)

f

the opposite of less than is greater than

f

after the following code fragment, x has the value of 3:
int x = 3;

t

in an enumerated data type, different constants may not have the same value

f

the body of a while loop may never execute

t

all nested if else statements can be converted to switch statements

f

a bool expression may evaluate to more than 2 values

f

a break statement in your switch stops your program

f

it is illegal to make function calls inside a switch statement

f

loops are used when we need our program to make a choice between two or more things

f

a semicolon by itself is a valid c++ statement

t

every line a program should have a comment

f

it is legal to declare more than one variable in a single statement

t

variable names may begin with a number

f

if there is a break in the innermost loop in a set of nested loops the break statement causes all enclosing loops to exit

f