linkedin-skill-assessments-quizzes
linkedin-skill-assessments-quizzes copied to clipboard
Go quiz with impossible question
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"
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.
No, the import statement import "github/gin-gonic/gin" is not correct in Go. It's missing the .com part in the domain.
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
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.
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.
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!
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