linkedin-skill-assessments-quizzes icon indicating copy to clipboard operation
linkedin-skill-assessments-quizzes copied to clipboard

Go quiz with impossible question

Open jordan-bonecutter opened this issue 1 year ago • 6 comments

I'm submitting an ISSUE: please check one with "x"

  • [ ] New question{'s}
  • [ ] New assessment
  • [x] Missed questions/answers
  • [ ] Request for new quiz/answers/...
  • [ ] Documentation issue or request for ...
  • [ ] ...

The following question:

Q6. Which is the only valid import statement in Go?

  • [ ] ­
      import "github/gin-gonic/gin"
  • [ ] ­
      import "https://github.com/gin-gonic/gin"
  • [ ] ­
      import "../template"
  • [x] ­
      import "github.com/gin-gonic/gin"

Import in GoLang

has 2 correct answers. Technically, the first one is also correct for a package named github (go mod init github). Inside this package there could be a subdirectory gin-gonic/gin. This could then be imported with the given import statement.

jordan-bonecutter avatar Dec 02 '23 20:12 jordan-bonecutter

No, the import statement import "github/gin-gonic/gin" is not correct in Go. It's missing the .com part in the domain.

haxkd avatar Dec 12 '23 09:12 haxkd

No, I can do:

go mod init github

Then I can make the subdirectory:

gin-gonic/gin

Now the code in that directory will be importable with github/gin-gonic/gin

jordan-bonecutter avatar Dec 12 '23 14:12 jordan-bonecutter

While that's a clever way to make the specific case work, that won't always be valid, and if its not always valid, it's invalid - think about a tautology from discrete mathematics.

chrishalbert avatar Jan 01 '24 22:01 chrishalbert

While that's a clever way to make the specific case work, that won't always be valid, and if its not always valid, it's invalid - think about a tautology from discrete mathematics.

You can say the same about the correct answer. If the owner takes the repository down it will no longer be a valid import. Both are circumstantial.

jordan-bonecutter avatar Jan 02 '24 02:01 jordan-bonecutter

Today it is valid though. If the day comes that the repository is renamed/archived, yes, you will then be correct at that point in time. If you argued this question on an exam, I think the professor would give you at least partial credit, but I think its pretty cut and dry here. Appreciate the outside the box thinking though!

chrishalbert avatar Jan 02 '24 02:01 chrishalbert

Today it is valid though. If the day comes that the repository is renamed/archived, yes, you will then be correct at that point in time. If you argued this question on an exam, I think the professor would give you at least partial credit, but I think its pretty cut and dry here. Appreciate the outside the box thinking though!

IMO a bad question. It requires knowing that this repository exists to properly answer. And again, today my answer is correct. No difference

jordan-bonecutter avatar Jan 02 '24 02:01 jordan-bonecutter