The camera should have a manual mode. A bulb mode is not required, unless one wants to shoot star trails. Besides this, you want two things: long exposure (around 30 seconds would be ideal) and a high ISO setting (at least 800).
Two things for fixed tripod astrophotography:
- an exposure of 20 to 30 seconds.
- an ISO of atleast 800. 1600 preferable, because that's probably the minimum if one wants to capture the Milky Way.
In newer DSLRs, you can use higher ISO settings and still get away without noise. But generally, the higher the ISO setting, the noisier the image.
Most newer digital cameras (not DSLRs) have a maximum exposure of only 15 seconds. Even this can capture sufficient detail provided the ISO is high enough. So if one wants to shoot nightscapes with an ordinary digital camera, he should try a camera with an exposure of around 30 seconds (longer exposure will result in stars becoming arcs), a high ISO setting and a large lens. Optical zoom is an advantage but not necessary. The Olympus SP-550UZ, for example, has an ISO of 1600 (without image degradation). It also has a comparatively large lens: link.
As a demonstration, this is an untouched, unprocessed 30 second exposure with a Sony Cybershot DSC-W1 (a 5.1MP camera with a small lens) at IS0 400 (the camera's maximum):

Of course, ambient lighting is important as well. If a P&S camera has a maximum ISO of only 800 but an exposure of 30 seconds, it will probably need a full or nearly full Moon to capture the landscape. (I've not tried such a camera yet, so this is just a guess).
If your digital camera allows the aperture to be controlled, use the lowest f-ratio (f/2.8).
Haroon, the D40 is a great camera, and you should have no problem taking 30 sec exposures at ISO 1600 from a dark site (the Northern areas, for example) with it.