Here you go. All is answered on the Nikon web site and in the online owner's manual.
Google: d3100 lens compatibility, d3100 flash compatibility
Nikon | Imaging Products | Lens Compatiblity - Nikon D3100
[TABLE="class: table-A01-group, width: 676"]
[TR]
Compatible lenses
[TD="class: last-cell"]" AF-S and AF-I: All functions supported.
" Type G or D AF NIKKOR without built-in autofocus motor: All functions except autofocus supported. IX NIKKOR lenses not supported.
" Other AF NIKKOR: All functions supported except autofocus and 3D color matrix metering II. Lenses for F3AF not supported.
" Type D PC NIKKOR: All functions supported except autofocus and some shooting modes.
" AI-P NIKKOR: All functions supported except autofocus and 3D color matrix metering II.
" Non-CPU: Autofocus not supported. Can be used in exposure mode M, but exposure meter does not function.
Note: Electronic rangefinder can be used if lens has a maximum aperture of f/5.6 or faster.
[/TD]
[/TR]
[TR]
[/TR]
[/TABLE]
[TABLE="class: table-A01-group, width: 676"]
[TR]
Flash control
[TD="class: last-cell"]" TTL: i-TTL balanced fill-flash and standard i-TTL flash for digital SLR using 420-pixel RGB sensor are available with built-in flash and SB-900, SB-800, SB-600, or SB-400 (i-TTL balanced fill-flash is available when matrixor center-weighted metering is selected)
" Auto aperture: Available with SB-900/SB-800 and CPU lens
" Non-TTL auto: Supported flash units include SB-900, SB-800, SB-80DX, SB-28DX, SB-28, SB-27, and SB-22S
" Distance-priority manual: Available with SB-900 and SB-800
[/TD]
[/TR]
[/TABLE]
Also, any flash that you can mount and that can be set manually will work on nearly all cameras with a flash shoe mount. However exposure information being passed between camera and flash is non-existent with all but specifically designed flashes.