13. Consider the error message below. What might generate it? Exception in threa
ID: 3912435 • Letter: 1
Question
13. Consider the error message below. What might generate it? Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor (Scanner.java:819) at java.util.Scanner.next (Scanner.java: 1431) at java.util.Scanner.nextInt (Scanner.java: 2040) at java.util.Scanner nextInt (Scanner.java:2000) at Ex1.main (Ex1.java: 12) (a) a missing semicolon on line 12 (b) attempting to print out a variable that has not been initialized (c) attempting to convert a string of all letters into an integer (d) an insufficient amount of data to meet the specification 14. In which of the following statements is type casting used? The variable num has been declared as int and the variable result has been declar ed as double a) numint) result (b) result -num; result 2; dy result 4.0/ 2.0, 15. Which of the following lines of code uses a unary operator? (a) result = result / 10.0; (b) num- num % 10; (c) total 100 25 2; (d) )currTemp +75;Explanation / Answer
Please find the answers below:
13. C.. Here trying to convert string in integer that's why input mismatch error came
14. A.. Int cannot assign value of double except using type cast like (int) result
15. D is using unary + operator
1. Static is reserved keyword in java
2. Only C is not valid as it is double value remaining A B D are valid integer
3. All are valid for double literals
4. Only A is invalid remaining B C D are valid character literals
5. Only B is invalid, Remaining A C D are valid literals
9.
1. class is missing before Typo
2. larry is not initialized
3. "" is missing in sysout
4. Math.sqrt(100) return type is double and assigned to int
5. ch = '%' cannot assign as ch define as final
10.
double x=10,y=20,pi=2;
pi = 3.14;
y = x - Math.pow(3, y)/(5*pi) + Math.pow(x, 3);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.