Yes, in general, electrical outlets are installed next to a stud. However, apartments may have some different things going on: There may be metal studs. These are much harder to find by knocking.