When teaching students (especially in code, but this can apply to any subject), how do you prevent near verbatim answers that match your examples?
For example, I tell students how to find a document by ID in an array of documents. I show them the code
foundDocument = documentArray.find(singleDocument => singleDocument._id = id). I then ask students to find a fruit in
fruitArray. The answer I'll get is
foundDocument = fruitArray.find(singleDocument => singleDocument._id = id), which works, but not the ideal answer.
Some notes based on the content discussion and answers so far:
This is sort of for a project. I teach both one off weekend classes and long term coding mentorship and this comes up in both. The goal of the weekend class is to build a website by the end. The goal of the mentorship is for the singular student to have built an MVP of their product.
The array example above was the simplest and shortest example I could think of to demonstrate my issue. I also see this happen where whole files get copied and the students expects something different to happen.
What I'm hoping to prevent is the pattern matching that students sometimes do but they don't fully understand the why of what they are doing. I've also seen (and done this myself) often in the STEM fields. You find a formula that works and re apply it but not understand what you're doing.