Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
35 Cards in this Set
- Front
- Back
Name the three iteration control stuctures employed by Java
|
While, Do/While, For loop
|
|
Which iteration control structure(s) will always execute the loop at least once ?
|
do/while
|
|
Whick iteration control structure(s) evaluate(s) the test expression before the loop is executed ?
|
while
|
|
Which iteration control structure(s) should be employeed when it can be determined in advance how many loop repetitions there should be ?
|
for
|
|
What will the following loop do ?
while (count < 10) System.out.println("Hello"); |
Infinite loop, since there is no increment.
|
|
Explain the difference between the execution of the Break and continue within a loop.
|
The break statement is used to immediately terminate a loop.
The continue statement is used to skip over a single loop iteration. |
|
What four things must be specified in a method header ?
|
modifier, return type, method name and parameter list
|
|
Three possible modifers for Java methods are...
|
private, public and protected
|
|
Explain the difference between a void method and a non-void method.
|
A non-void method returns a single value to the calling program.
A void method performs specific tasks or operates on class data. |
|
Explain the difference between and argument and a parameter.
|
Arguments are values/variables used within the method call. (variables r & h used in the method call)
A parameter is a variable in the method header used to accept a data item during a method call. (variables rate and hours) |
|
T or F
When a method does not have a return type, you must indicate this with the keyword null. |
False.
(keyword is void) |
|
When using an assignment operator to call a method, the method must include a(n) _________ statement.
|
Return
|
|
T or F
A variable defined in main () has visibility in all methods called by main(). |
False.
(Local to that method) |
|
What is a local variable ?
|
Only visible within that block.
|
|
What is meant by the scope of a variable or method ?
|
From where it can be accessed.
|
|
T or F
Variables should be defined as locally as possible and constants as globally as possible. |
True
|
|
What are the two things that make up a class declaration ?
|
data members & method members
|
|
What is the scope of a private class member ?
|
Accessible from w/in a class
|
|
What is the scope of a public class memeber ?
|
Accessible from outside class.
|
|
The concept of combining data with a set of operations that are dedicated to manipulating the data so tighly that outside operations cannot affect the data is called ____________.
|
Encapsulation
|
|
T or F
Only public members of a given class can access the pricate members of that class. |
True
|
|
Why are classes declared and objects defined ?
|
No memory is reserved for declared values, defined objects reserve memory for the value.
|
|
T or F
Utility methods are declared as private methods. |
True.
|
|
At the abstract level, a class can be described as a(n) ______ that defines the behavior of its objects.
|
ADT
|
|
At the implementation level, a class consists of ______ and _______ members.
|
Data; Method
|
|
T or F
THe abstract view of a vlass provides its inside view, showing the secrets of its data organization and mehod implementation. |
False.
(it's like a class diagram) |
|
What is meant by the term "behavior" relative to a class object ?
|
Methods
|
|
OOP provides an important feature called __________, which is a mechanism for deriving new classes from existing ones.
|
inheritance
|
|
A method that simply returns the value of a class data member is called a(n) ______ method.
|
get
|
|
What is the purpose of a constructor ?
|
Create & initialize an object.
|
|
A private method of a class is often called a(n) ________ method.
|
utility
|
|
T or F
A constructor never has a return type, not even a void. |
True
|
|
What operator is used to send a message to an object ?
|
dot operator (xxx.xxx)
|
|
Explain why you should use packages when developing Java programs.
|
To group similar functionality in one place.
|
|
A package called accounting must be sotred in a directory called _______.
|
Accounting
|