MCQ
Single Best Answer
Easy
QThe statement used to find the total number of Strings present in the string array String s[] is:
ID: #24270
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER
48 views
Question Info
#24270Q ID
EasyDifficulty
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPERTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option A
Explanation
Let's carefully analyze:
We have a string array String s[]. We want the number of elements in the array.
-
(a)
s.length→ ✅ Correct. For arrays in Java,.lengthwithout parentheses gives the number of elements. -
(b)
s.length()→ ❌ Incorrect.length()is used for String objects, not arrays. -
(c)
length(s)→ ❌ Not valid in Java. -
(d)
len(s)→ ❌ Python syntax, not Java.
Answer: (a) s.length
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic