We consider electronic exchange and correlation effects in density-functional calculations of two-dimensional systems. Starting from wave function calculations of total energies and electron densities of inhomogeneous model systems, we derive corresponding exchange-correlation potentials and energies. We compare these with predictions of the local-spin-density approximation and discuss its accuracy. Our data will be useful as reference data in testing, comparing and parametrizing exchange and correlation functionals for two-dimensional electronic systems.