770
Exam Answer (programming.dev)
submitted 3 months ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 10 points 3 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] -3 points 3 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)]

[-] [email protected] 11 points 3 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.

this post was submitted on 24 Mar 2024
770 points (98.6% liked)

Programmer Humor

18388 readers
529 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS