JAVA MTA EXAM QUESTIONS AND
ANSWERS
What is the order of precedence? - Correct Answers -PEMDAS
int amount = 30,000
double rate = .10
int licensing = 1,000
double total= amount+licensing*rate
print(total)
The output is 30,100, but should be 33,100, how do you fix this? - Correct Answers -
(amount+licensing)*rate+amount
How do you print to user? - Correct Answers -system.out.print("");
What is %? - Correct Answers –modulus
You have the var double price = 39.99- what is it when you convert it into an integer? -
Correct Answers -39- rounded down
You have the var double price = 39.99- what is it when you convert it into a byte? -
Correct Answers -39- rounded down!
.isEmpty() - Correct Answers -returns boolean whether the variable is empty or not
What does it mean when a variable is NULL? - Correct Answers -it doesn't have a value
at all- non-existent
What does it mean when a variable is UNDEFINED? - Correct Answers -it's a variable
that has been declared but defined
What does modulus do? (%) - Correct Answers -returns remainder after division
How do you create a scanner? - Correct Answers -Scanner in = new
Scanner(System.in);
What does next() do? - Correct Answers -returns the scanner value on the next line
ANSWERS
What is the order of precedence? - Correct Answers -PEMDAS
int amount = 30,000
double rate = .10
int licensing = 1,000
double total= amount+licensing*rate
print(total)
The output is 30,100, but should be 33,100, how do you fix this? - Correct Answers -
(amount+licensing)*rate+amount
How do you print to user? - Correct Answers -system.out.print("");
What is %? - Correct Answers –modulus
You have the var double price = 39.99- what is it when you convert it into an integer? -
Correct Answers -39- rounded down
You have the var double price = 39.99- what is it when you convert it into a byte? -
Correct Answers -39- rounded down!
.isEmpty() - Correct Answers -returns boolean whether the variable is empty or not
What does it mean when a variable is NULL? - Correct Answers -it doesn't have a value
at all- non-existent
What does it mean when a variable is UNDEFINED? - Correct Answers -it's a variable
that has been declared but defined
What does modulus do? (%) - Correct Answers -returns remainder after division
How do you create a scanner? - Correct Answers -Scanner in = new
Scanner(System.in);
What does next() do? - Correct Answers -returns the scanner value on the next line