The CPU, or central processing unit, is the hardware that takes most of the load when running a program. It will perform complex calculations and execute every instruction as the program continues.
The GPU, or graphics procession unit, is the hardware that could also play a major roll in calculating the instructions to execute a program, though this depends on how graphically intensive the program is. For example, games would use a lot more GPU power than say a simple calculator application.
A float data type can hold a decimal number.
Answer:
B - array; hash
Explanation:
Arrays store elements of the same data type in a list. Every element in the array is assigned a unique integer (starting at 0). You are able to access/process an element by using its assigned integer. Hashes are similar in the fact that they also store data. The difference is that each element is assigned an object type (instead of an integer), making it a collection of key pairs, as such you would typically not use this to process elements efficiently.
Answer:
public static int maxMagnitude(int a, int b){
int max;
if (a>b){
max = a;
}
else{
max = b;
}
return max;
}
The complete program calling the method is given in the explanation section
Explanation:
import java.util.Scanner;
public class ANot {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Please Enter two numbers");
int num1= in.nextInt();
int num2 = in.nextInt();
System.out.println("The largest magnitude number is: "+maxMagnitude(num1,num2));
}
public static int maxMagnitude(int a, int b){
int max;
if (a>b){
max = a;
}
else{
max = b;
}
return max;
}
}
The maxMagnitude() method uses if/else statement to compare two ints and return the larger one