Does firing while aiming down the sights (or through a scope) affect Accuracy of the guns? Or is it not affected at all?
Accuracy is significantly improved when aiming down the sights in Borderlands 2; a Loading Screen tip even tells you/hints at this. Your bullet spread will be significantly reduced with any weapon, even the individual pellets from shotguns (no that does not make sense but yet it does happen). I'm not sure exactly how much, but it's very noticeable, I'd say it cuts bullet spread (the max distance of any bullet from the center of your aim) in half or so.
This seems to behave differently for different weapons; Sniper Rifles seem to have a much greater benefit from scoping (or perhaps a more significant detriment for firing from the hip). From the hip Snipers have wider spread than SMGs but will have much higher accuracy when zoomed in.
You can easily confirm this by watching your aiming reticle as you zoom in; it will shrink in size considerably as it fades from view, especially noticeable with a low-accuracy weapon (any shotgun).
However note that aiming down the scope will introduce a second effect; random weapon sway. All weapons (particularly Hyperion weapons) sway a bit when aiming. The amount of stability is a weapon stat not directly related to accuracy. Note that firing a Hyperion weapon decreases weapon sway, firing other weapons increases it. Weapon sway is different from accuracy though; accuracy is the spread of the pellets from the muzzle of the gun; sway actually moves the location of the muzzle (where the speedy kill-people things come out of the gun).