Speed and the sizes of tires/gears Does the speed of a normal mountain bike vary according to the diameter of the wheels? If it does, will a larger diameter increase the speed or decrease it?

Similarly, if the speed varies according to the size of the gears, will a larger gear (if possible) increase the speed? What are the demerits/disadvantages of such features?
For a single gear ratio turning at a constant cadence (revolutions per minute of one pedal), a larger wheel diameter will have traveled farther/faster. A larger wheel would increase top end speed, a smaller wheel decreasing it.

Gear ratios are gear ratios. For a given chainring tooth count moving at a given cadence, the smaller the gear in the rear the faster the wheel will turn. The larger the gear in the rear, the slower.

Basically, if you took a road bike that was designed for 700c wheels, and put 20" bmx wheels on it, it would be slower at a given cadence in all gears. The opposite would be true if you could increase the wheel size.