Bird
0
0

When using fileparts in MATLAB, what happens if the input path has multiple dots in the filename, like 'archive.tar.gz'?

hard📝 Conceptual Q10 of 15
MATLAB - File I/O
When using fileparts in MATLAB, what happens if the input path has multiple dots in the filename, like 'archive.tar.gz'?
Afileparts treats '.gz' as the extension and 'archive.tar' as the name
Bfileparts treats '.tar.gz' as the extension
Cfileparts treats '.archive' as extension
Dfileparts returns an error for multiple dots
Step-by-Step Solution
Solution:
  1. Step 1: Understand fileparts extension extraction

    fileparts considers only the last dot and following text as extension.
  2. Step 2: Analyze example 'archive.tar.gz'

    Extension is '.gz', name is 'archive.tar'.
  3. Final Answer:

    fileparts treats '.gz' as extension and 'archive.tar' as name -> Option A
  4. Quick Check:

    fileparts uses last dot for extension [OK]
Quick Trick: fileparts extension is after last dot only [OK]
Common Mistakes:
  • Assuming multiple-dot extensions are fully captured
  • Expecting error on multiple dots
  • Confusing name and extension parts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes