Bird
0
0

What will be displayed after running this MATLAB code?

medium📝 Predict Output Q5 of 15
MATLAB - File I/O
What will be displayed after running this MATLAB code?
[folder, name, ext] = fileparts('D:/Projects/code.m'); disp(name);
A'code.m'
B'D:/Projects'
C'.m'
D'code'
Step-by-Step Solution
Solution:
  1. Step 1: Understand fileparts

    This function splits a full file path into folder, filename without extension, and extension.
  2. Step 2: Analyze the code

    Input path is 'D:/Projects/code.m'. The filename without extension is 'code'.
  3. Step 3: Output

    disp(name) prints 'code'.
  4. Final Answer:

    A -> Option D
  5. Quick Check:

    Filename without extension displayed [OK]
Quick Trick: fileparts returns name without extension in second output [OK]
Common Mistakes:
  • Confusing folder with filename
  • Expecting extension in the name variable
  • Assuming disp prints full path

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes