JAVA MTA Exam with precise |! |! |! |! |!
detailed solutions |!
What is the order of precedence? - Correct answer ✔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
|! |! |! |! |! |! |! |! |! |! |! |! |! |! |!
answer ✔(amount+licensing)*rate+amount
|!
How do you print to user? - Correct answer ✔system.out.print("");
|! |! |! |! |! |! |! |! |!
What is %? - Correct answer ✔modulus
|! |! |! |! |! |!
What does modulus do? (%) - Correct answer ✔returns remainder after
|! |! |! |! |! |! |! |! |! |! |!
division
How do you create a scanner? - Correct answer ✔Scanner in = new
|! |! |! |! |! |! |! |! |! |! |! |! |!
Scanner(System.in);
, What does next() do? - Correct answer ✔returns the scanner value on the
|! |! |! |! |! |! |! |! |! |! |! |! |!
next line
|!
What is an InputMismatchException? - Correct answer ✔when the the input
|! |! |! |! |! |! |! |! |! |! |!
data type is incorrect or out of range
|! |! |! |! |! |! |!
What is getMessage? - Correct answer ✔displays details of an exception
|! |! |! |! |! |! |! |! |! |!
What is IO Exception? - Correct answer ✔occurs when a file being read from
|! |! |! |! |! |! |! |! |! |! |! |! |! |!
doesn't exist |!
What are the two types of exceptions? - Correct answer ✔checked and
|! |! |! |! |! |! |! |! |! |! |! |!
unchecked?
What are checked exceptions? - Correct answer ✔a type that is checked at
|! |! |! |! |! |! |! |! |! |! |! |! |!
compile time |!
What are unchecked exceptions? - Correct answer ✔it is not checked in
|! |! |! |! |! |! |! |! |! |! |! |!
compile time |!
What does getStackTrace do? - Correct answer ✔returns an array of stack
|! |! |! |! |! |! |! |! |! |! |! |!
trace elements
|!
detailed solutions |!
What is the order of precedence? - Correct answer ✔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
|! |! |! |! |! |! |! |! |! |! |! |! |! |! |!
answer ✔(amount+licensing)*rate+amount
|!
How do you print to user? - Correct answer ✔system.out.print("");
|! |! |! |! |! |! |! |! |!
What is %? - Correct answer ✔modulus
|! |! |! |! |! |!
What does modulus do? (%) - Correct answer ✔returns remainder after
|! |! |! |! |! |! |! |! |! |! |!
division
How do you create a scanner? - Correct answer ✔Scanner in = new
|! |! |! |! |! |! |! |! |! |! |! |! |!
Scanner(System.in);
, What does next() do? - Correct answer ✔returns the scanner value on the
|! |! |! |! |! |! |! |! |! |! |! |! |!
next line
|!
What is an InputMismatchException? - Correct answer ✔when the the input
|! |! |! |! |! |! |! |! |! |! |!
data type is incorrect or out of range
|! |! |! |! |! |! |!
What is getMessage? - Correct answer ✔displays details of an exception
|! |! |! |! |! |! |! |! |! |!
What is IO Exception? - Correct answer ✔occurs when a file being read from
|! |! |! |! |! |! |! |! |! |! |! |! |! |!
doesn't exist |!
What are the two types of exceptions? - Correct answer ✔checked and
|! |! |! |! |! |! |! |! |! |! |! |!
unchecked?
What are checked exceptions? - Correct answer ✔a type that is checked at
|! |! |! |! |! |! |! |! |! |! |! |! |!
compile time |!
What are unchecked exceptions? - Correct answer ✔it is not checked in
|! |! |! |! |! |! |! |! |! |! |! |!
compile time |!
What does getStackTrace do? - Correct answer ✔returns an array of stack
|! |! |! |! |! |! |! |! |! |! |! |!
trace elements
|!