click below
click below
Normal Size Small Size show me how
Ch. 19 and 20
Java recursion and method redefining
| Question | Answer |
|---|---|
| Define Recursion. | the computer programming process, whereby a method calls itself |
| What happens to the computer if it is executing a recursive method that has no planned method of stopping? | The computer will eventually crash and an error will occur. |
| What are the 3 iterative control structures? | for, while, do...while |
| Define a stack. | the execution sequence of methods, and stores local method information. |
| What does LIFO stand for? | Last in First out |
| Where is every program statement stored? | The computer's memory |
| What handles program execution sequence? | Index Pointer |
| When you add information to a stack, what is that officially called? | Pushed |
| When a recursive call interrupts the execution of a method, what happens to the "unfinished business" at the end of the method? | It will be saved in a temporary stack until it can be used. |
| What data structure controls recursion? | Stack |
| What does a computer scientist mean when he/she refers to an elegant solution? | frequently the most natural and obvious solution to many computer science veterans |
| x is a String, what is displayed by this statement: System.out.println(x); ? | The string. |
| is the name of the ultimate superclass – the class that all other classes are derived from? | Object |
| If x is a primitive data type, what is displayed by this statement: System.out.println(x); ? | The value of the data |
| If x is a Java static array of double, what is displayed by this statement: System.out.println(x); ? | Memory addresses |
| method is checked by print and println to see how the information needs to be displayed? | toString |
| Why is it that every class has access to the toString method? | every class come from the object class |
| Is the toString method limited to displaying the value of only one field? | No |
| What method should be used to compare objects? | equals method |
| Why does operator == not work for objects? | It compares shallow values. |
| Do the implementations of the toString or equals methods have to be practical? | They can be impractical. |