One way we can determine if the given function is linear, is to graph it. The function y=5 is comprised of infinitely many points. In all of these points, x can be any value, and y must always be 5. For example, (-4,5),(0,5), and (2,5) will all be points of the function.
From the graph we can see that y=5 is a horizontal line. All horizontal lines have a slope of 0. As such, it is a linear function.