1.Can these 2 doctors perform surgery?
Any LICENSED physician can exercise the duties of any specialty, including performing surgical procedures. However, you are unlikely to be hired by a group or hospital or get operating rights at a hospital without completing a surgical residency and becoming licensed specifically by the American College of Surgeons. So typically neither performs "surgery" in their scope of practice although both perform small procedures (skin biopsies, etc.). In addition, family practice residencies include a component of surgical training that often allows these doctors to perform a wider scope of office procedures. In contrast, an internal medicine residency is a requisite pathway into specialties such as cardiology and gastroenterology that perform a number of their own procedures such as vascular catheterizations, implantation of medical devices, endoscopy, colonoscopy, etc.
2.Do these types of doctors check every person(from newborn to elderly)?
Family practice training includes both pediatrics and adult medicine, although the component of pediatrics training is geared towards outpatient management and only minimally towards inpatient care of the child. The focus on adult management is similar. Internal medicine focuses on more thorough and advanced management of the adult (18+) only, enabling the trainee to become better versed in hospital level acute care and somewhat less reliant on specialists than the family practitioner at the diagnostic level of care. Pediatrics is the under 18 counterpart of internal medicine. A combined Internal Medicine/Pediatrics residency includes both parts with the greater focus on specialty and hospital care of people from 0-115 (if they make it to 115, you should probably just leave them alone).
3.Can both check the male(penis) and female body parts(OB/GYN)
All practitioners are educated in the care of the whole human body, male and female. You can't get out of examining either. Family practice residency does include a specific component of training in OB/Gyn that Internal Medicine does not, however. Family practitioners can choose to include obstetrics (delivering babies) as a part of their practice.
4. Which is better to have and has a better future in medicine
Seeing as how there is a huge shortage of primary care physicians, both.