MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - 2022 PYQ

Q

Give the output of the following code :


String A = "56.0", B = "94.0";
double C = Double.parseDouble(A); 
double D = Double.parseDouble(B); 
System.out.println((C+D));

Question ID
#23971
Subchapter
ICSE Computer Application - Class X - 2022 PYQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 100
  • B 150.0
  • C 100.0
  • D 150
Correct Answer: B

Explanation

150.0

Reason — parseDouble() method returns a double value represented by the specified string. Thus, double values 56.0 and 94.0 are stored in C and D, respectively. Both C and D are added and 150.0 (56.0 + 94.0) is printed on the screen.

Share This Question

Share this MCQ with your friends or study group.