Chosen Solution
All of sudden, while I was working, my screen got frozen and started showing some rectangular shape boxes with green vertical lines in it. For the first time, when I pressed on power button, it started beeping (3 times or so) continuously. Wait for 3-5 seconds and again started beeping. After half an hour, I again pressed power button. This time it gets boot up and works properly. The Second time when I experienced same rectangular boxes with vertical lines in it, my MacBook got restarted by itself. I don’t know what is the issue with it. Sharing the link for image and video reference.
I would also inspect the fan and the heatsink making sure the fan blades and the fin areas are clean if not your CPU could have over heated. Install a good thermal monitoring app like TG Pro so you can monitor things. You may also need to clean and repast your CPU chip which holds the graphics engine in this series. I would also check when it happens, does the image look like on an external display? If the image is the same then your issue is within either the RAM or the logic board its self. Try a fresh set of SO-DIMM’s to see if its a bad RAM. Otherwise you could have a bad socket. If the image on the external is clean and you still see the blocks on the internal then the internal display needs replacing.