0% found this document useful (0 votes)
15 views

Python Review Questions, CH. 3-4 PDF

Uploaded by

nukacolatruck
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Python Review Questions, CH. 3-4 PDF

Uploaded by

nukacolatruck
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Starting out with Python Review Questions

Chapter 3:

1) A decision structure can execute a set of statements only under certain


circumstances.

2) A single alternative decision structure provides one alternative path of


execution.

3) A Boolean expression has a value of either True or False.

4) The symbols >,<, and == are all relational operators.

5) A dual alternative decision structure tests a condition and then takes


one path if the condition us true, or another path if the condition is
false.

6) You use an if statement to write a single alternative decision structure.

7) You use an if-else statement to write a dual alternative decision


structure.

8) and, or, and not are logical operators.

9) A compound Boolean expression created with the and operator is true


only if both of its subexpressions are true.
10) A compound Boolean expression created with the or operator is
true if either of its subexpressions is true.

11) The not operator takes a Boolean expression as its operand and
reverses its logical value.

12) A flag is a Boolean variable that signals when some condition


exists in the program.

TRUE OR FALSE
1. False
2. False
3. False
4. True – A decision structure can be nested inside another decision
structure.
5. True – Same as #9 above

Chapter 4:

1) A condition-controlled loop uses a true/false condition to control the


number of times that it repeats.

2) A count-controlled loop repeats a specific number of times.

3) Each repetition of a loop is known as an iteration.

4) The while loop is a pretest type of loop.

5) An infinite loop has no way of ending and repeats until the program
is interrupted.
6) The -= operator is an example of an augmented assignment
operator.

7) An accumulator variable keeps a running total.

8) A sentinel is a special value that signals when there are no more


items from a list of items to be processed. This value cannot be
mistaken as an item from the list.

9) GIGO stands for garbage in, garbage out.

10) The integrity of a program’s output is only as good as the


integrity of the program’s input.

11) The input operation that appears just before a validation loop is
known as the priming read.

12) Validation loops are also known as error traps.

TRUE OR FALSE

1.True - A condition-controlled loop always repeats a specific number of


times.

2.True – The while loop is a pretest loop.

3.True – The following statement subtracts 1 from x: x = x – 1

4.False

5.True – In a nested loop, the inner loop goes through all of its iterations for
every single iteration of the outer loop

6.False- you multiply, not add

7.False

You might also like