Is it plagiarism to use an online tutorial as the basis for completing a programming assignment? Let's suppose that you were assigned a programming project, which is considered from your teacher/professor, not easy. However, you manage to find an online tutorial, that guides you step-by-step through the process needed (so the source code you have written doesn't have much difference from the one on that tutorial). 

The final solution is based on this tutorial, but you have also added your own information, corrected some minor errors, etc. I don't know if this matters, but you know exactly what every single line of your code does, you are able to explain and answer complex questions, etc.

Is that considered plagiarism, and if yes, why? If not, how can somebody support that on a teacher/professor?
Using online material to learn is not plagiarism.

This is a great way to learn (e.g, worked examples and subgoal labeling) and is a common way for instructors to try to teach something. Am I plagiarizing every time I use a common design pattern? No.

However, copying and pasting code from online is. It gets a little fuzzy when working on simple assignments that can be found easily online because it could be weakly argued that you are recalling it from memory. I would definitely not be concerned about this, especially if you think you understand the code and were not trying to cheat.

If you're genuinely concerned, you could even discuss it with your instructor and they might realize that they are not spending enough time discussing a certain process or giving you enough practice material.

EDIT: Based on your clarification in the comments, if this is something more specific/arcane and not a tutorial on something general, then just cite it. I have done this in my programming courses before. I added a comment at the top of my code linking to the material I referenced and gave a very brief description of what it is and how I used it.