Bird
0
0

What will be the output of this MATLAB code?

medium📝 Predict Output Q4 of 15
MATLAB - String Handling
What will be the output of this MATLAB code?
s1 = "Test";
s2 = "test";
result = strcmpi(s1, s2);
disp(result);
A0
B1
CError
DNaN
Step-by-Step Solution
Solution:
  1. Step 1: Understand strcmpi

    strcmpi compares two strings ignoring case differences.
  2. Step 2: Analyze the strings

    "Test" and "test" differ only in case, so strcmpi returns true (1).
  3. Final Answer:

    1 -> Option B
  4. Quick Check:

    Case-insensitive match returns 1 [OK]
Quick Trick: strcmpi ignores case, returns 1 if equal [OK]
Common Mistakes:
  • Assuming strcmpi is case-sensitive
  • Expecting 0 because of case difference

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes