• @[email protected]
    link
    fedilink
    103 months ago

    This is quite a cheap answer but maybe it’s just pseudo code. We had exercises in university about pseudo code with examples that intentionally broke all syntax systems and conventions to show that not everything has to be executable that you write down in a theoretical computer science homework

    • @[email protected]
      link
      fedilink
      -33 months ago

      It’s a shitty question. It’s implied by the fact that “24” is wrong that the answer is “6”, the length of the string “Monday”.

      In some languages dot access on objects could give you the properties of the object type (things pertaining to a “day” object) but this would still be ambiguous since a day’s length can be measured in many different ways.

      In others, it would require you to call length as a function (.length()) or not be available at all, or require you to pass the object into another function [ length_in_seconds(day_x)]

      • @Matty_r
        link
        113 months ago

        I think the question is fine, but we have to assume they covered this type of method prior to the exam, where .length would result in the character count of a String.