Question: I recently bought a Nikon D5100. And along with this camera, I got the AF-S DX NIKKOR 18-55mm f/3.5-5.6G VR lens as kit. It's "G" type lens, right?

One of my friend suggested to buy a 50mm f/1.8D prime lens for a good aperture. I bought it too, and it's "D" type lens.

Main thing is I'm confused about what these "G" and "D" type lens means. I know it's a common question but I didn't find any solid answer.

Answer: 
Here is the description from Nikon's own web site:

**D-Type NIKKOR Lenses**
A D-type lens relays subject-to-camera-distance information to Nikon D-SLRs that feature 3D Color Matrix Metering (all versions), 3D Matrix Metering, 3D Multi-Sensor Balanced Fill-Flash and i-TTL Balanced Fill-Flash. Many D-Type lenses have an aperture control ring and can be used on older Nikon SLR cameras that allow for manual control of the aperture, as well as on D-SLRs—especially useful for adjusting aperture while recording D-Movies on higher end models. When used on a D-SLR, the aperture control ring needs to be locked at the smallest possible aperture (generally designated in orange), and the aperture control is maintained through the camera's command dial

**G-Type NIKKOR Lenses**
A G-type lens does not have an aperture control ring and are intended for use on Nikon D-SLRs that allow the lens aperture to be adjusted via the camera's command dial. Because G-type lenses relay subject-to-camera-distance information to the camera, where it is used to help determine ambient and flash exposure, they are also considered to be D-type lenses. The lack of an aperture control ring is perhaps the easiest way that you can tell if a lens is a G-Type NIKKOR or not. [The AF-S NIKKOR 24-120mm f/4G ED VR lens, shown above is an example of a G-Type lens. Note there is no aperture ring on that version of the lens, while there is an aperture ring on the AF version, above right.]

<http://www.nikonusa.com/en/Learn-And-Explore/Article/go35b5yp/which-nikkor-lens-type-is-right-for-your-d-slr.html>

To me the main different is that a G lenses are newer lenses where Nikon have removed the aperture ring.
The Nikon D5100 camera body does not have an in-built focus motor.

The G lenses are AF-S lenses which include a focus motor inside the lens - these lenses can be used with entry level camera bodies such as the D3100, D3200, D5xxx series.
AF-S lenses also do not include an aperture ring and will not be compatible with older Film cameras.

The D lenses are older lenses. These lenses would include an aperture ring and would be compatible with older Film cameras. 

Few D lenses are AF lenses which do not include an auto-focus motor inside the lens. If auto-focus is a requirement, these lenses require a camera, generally in the mid-to-high-pro-level body range which include a screw-drive focusing motor (auto-focus motor) inside the camera. These lenses will work on the entry level Nikon cameras but focusing will need to be done manually.

Few of the D lenses range also have AF-S. These lenses will be able to auto-focus on the entry level Nikon cameras including the D5100. The 300mm f/4D AF-S is an example of this which is currently available.

The D lenses are also somewhat cheaper compared to the G lenses. However, to use auto-focus on the D lenses with AF, you need to invest more on the higher level camera body - D7000 and above.

If you are currently using the 50mm 1.8D on your D5100 camera, you are probably using manual focus for taking your photographs.

List of Nikon F-mount lenses with integrated autofocus motor - Wiki Link - <http://en.wikipedia.org/wiki/List_of_Nikon_compatible_lenses_with_integrated_autofocus-motor>