Answer:
B - instance fields
Explanation:
Fields/variables declared within interfaces are by default final, public or static and hence will not be considered as an instance variable/field but a class variable. Although interfaces can be used to define instance methods, they will never have instance variables.
Answer:
Explanation:
The following code is written in Java it goes through the queue that was passed as an argument, loops through it and removes all the odd numbers, leaving only the even numbers in the queue. It does not add any more data structures and finally returns the modified queue when its done.
public static Queue<Integer> evens(Queue<Integer> queue) {
int size = queue.size();
for(int x = 1; x < size+1; x++) {
if ((queue.peek() % 2) == 0) {
queue.add(queue.peek());
queue.remove();
} else queue.remove();
}
return queue;
}
Answer:
When an instruction is sent to the CPU in a binary pattern, how does the CPU know what instruction the pattern means
Explanation:
When the CPU executes the instructions, it interprets the opcode part of the instruction into individual microprograms, containing their microcode equivalents. Just so you know, a full assembly instruction consists of an opcode and any applicable data that goes with it, if required (register names, memory addresses).
The assembly instructions are assembled (turned into their binary equivalent 0s and 1s, or from now on, logic signals). These logic signals are in-turn interpreted by the CPU, and turned into more low-level logic signals which direct the flow of the CPU to execute the particular instruction.