The Help Center is actually a useful resource in this particular instance. It describes not only what questions are on topic here, but also which questions are off topic.
Notably, both questions suffer from this particular issue:
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself.
For Question #1, the only thing we have to go off of is an image. Images aren't useful to us since they don't allow any prospective answerer the ability to copy and paste the problem into their own environment and make an attempt at a solution. What's worse, the image only contains a stack trace. No code for us to go off of? No way that we can answer the question.
For Question #2, there's an equally similar problem. The asker posted only their code and asked if it was working. Well...we can't debug code without data, so their question was both looking for debugging help (since they were unsure if it was working or not) and horribly broad, since "working" was ill defined by the OP.