MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - Selection Examination - 2024-25 - MCQ - CALCUTTA PUBLIC SCHOOL

Q Give the output of the following code:

String[] words = {"Java", "is", "fun"};
System.out.println(words[0].length() + words[2].length());

Question ID
#23888
Subchapter
ICSE Computer Application - Class X - Selection Examination - 2024-25 - MCQ - CALCUTTA PUBLIC SCHOOL
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 8
  • B 6
  • C 5
  • D 7
Correct Answer: D

Explanation

Explanation:

 

words[0] = "Java" → words[0].length() = 4.

words[2] = "fun" → words[2].length() = 3.

Total: 

4

+

3

=

 

7

4+3=7.

Share This Question

Share this MCQ with your friends or study group.