7) First, here is one way of writing the pseudocode. The outer set of braces enclose everything that is repeated while the bear is still hungry. The inner set of braces enclose the "eat honey" action that is performed only if a beehive is in the tree.
repeat {
Locate next tree
Inspect tree for beehive
if( beehiveInTree ) {
Eat honey
}
} while( stillHungry )
Sleep
Here is the flowchart for the pseudocode.
Here is another way of writing the pseudocode, which puts the check for stilHungry at the top of the code:
repeat while( stillHungry ) {
Locate next tree
Inspect tree for beehive
if( beehiveInTree ) {
Eat honey
}
}
Sleep
The corresponding flowchart is:
8) Object code consists of machine-executable instructions that are basically numerical op-codes (numbers), along with data that the op-codes operate upon. A computer's CPU is designed to execute these op-codes directly. Source code, on the other hand, is understandable by humans, but must first be converted to object code (or byte code, as in Java) in order to be machine-executable.
9) Most manufacturers of CPUs (e.g. Intel, Motorola, Atmel) each produce products that execute different types of op-codes. Moreover, different processor models made by the same manufacturer may use different op-codes. Thus, the object code containing the op-codes for a Motorola processor must be different from the object code for an Intel processor, and a different compilers must be used to generate the specific object code for a specific CPU. Java bytecode is not specific to a particular CPU - the same bytecode is produced by the Java compiler regardless of the CPU. Instead, a slightly different version of the Java Virtual Machine is provided by Sun Microsystems for each type of computer hardware for which they wish to provide Java support. The JVM's is just a program that is designed to read the bytecode and then execute (one or more) CPU-specific op-codes.
10) Explained above in 9.