Yes it can but you must make sure that there is enough grazing material to satisfy. Cows are natural grazers and you must be able to satisfy their immense appetites.
A heifer can live in a smaller yard, but it would be much more ideal for it to live on a pasture. It needs to graze and eat a lot of grass, and that is hard to accomplish with a small yard.
Cows don't tend to run around too much so they don't need a huge pasture. However, they do need some kind of room to walk around and exercise or they will develop feet problems and basically forget how to walk.
You could have a heifer in a small yard, but it wouldn't be a good idea. They are rather large animals and need space to move around and feed. Not to mention that in a small area there would be no cleanliness with all the feces.