File - Munoz AHISD

advertisement
APCS Exposure Java
Name: KEY
Exercises 05.01-04
Date:
Period:
1.
What does program flow follow?
The sequence of written program statements
2.
Programs in what computer language require control structures?
Java and all other program languages
3.
What are the 3 general types of control structures?
Simple sequence, selection and repetition
4.
How does Simple Sequence work?
Program statements are written in the sequence that they should be executed.
5.
What are 2 synonyms for Selection?
Decision making and branching
6.
What are the 3 types of Selection?
One-way, two-way and multiple-way
7.
Selection control structures use a special _____________ statement.
condition
8.
In one-way selection, when does the program flow branch off?
If the condition is true
9.
In one-way selection, what happens if the condition is false?
The program flow continues without change in program sequence.
10.
In two-way selection, what happens if the condition is false?
The program executes the else statement.
11.
Explain Multiple-Way Selection.
A variable value is compared against multiple values. When a match occurs, the statement with the
match is executed.
12.
Explain Repetition.
Repetition repeats the same statement or statements as long as some condition is valid.
13.
What do Selection and Repetition control structures have in common?
They both use conditional statements.
14.
What is the essence of understanding, and using, control structures?
Use the correct control structure for the correct purpose.
Exposure Java 2012, APCS Edition
Exercises 05.01-04
Page 1
06-22-12
15.
What is a conditional statement?
A statement that is true or false
16.
Most conditional statements will require what?
A logical or Boolean operator
17.
All conditions must be placed inside what?
Parentheses
18.
What kind of operator is required to make an expression evaluate to true or false?
A logical or Boolean operator
19.
List the 6 relational operators.
==
>
<
>=
<=
!=
20.
Java does not use “=” to test for equality? What does it use instead?
==
21.
What kind of operator is “=”?
An assignment operator
22.
What library is the Scanner class located in?
the java.util library
23.
Why is a prompt necessary for program input?
Without the prompt the program user has no clue what is happening and certainly does not know what
type of input is required.
24.
What does the nextLine method do?
The nextLine method "reads" in an entire string of characters from the keyboard until the <Enter> key
is pressed.
25.
Look at program Java0503.java. This program gives the impression that it will find the sum of 2
entered numbers. Why does it not work?
Since the numbers were entered as Strings, they were concatenated instead of added.
26.
Look at program Java0504.java. How does this program cure the problem of the previous one?
It used nextInt to enter int values.
27.
What method is used to enter real number information?
nextDouble
Exposure Java 2012, APCS Edition
Exercises 05.01-04
Page 2
06-22-12
Download