When an oceanic plate goes under a continental plate are the resulting mountains a result of the melting and then rising of the oceanic plate or are the mountains formed by the continental plate being pushed up by the collision with the oceanic plate?
When the subducted oceanic plate slides beneath the continental crust, it causes crustal thickening and sometimes crustal folding. In addition to this, rising plumes of magma are created when the oceanic plate is forced down into the mantle. These are all orogenic (mountain building) processes. We also have mountains built by volcanoes.
The friction created by the subducted plate scraping the bottom of the plate above as it is being forced into the hot mantle, plus the fact that it carries water with it, causes partial melting of the plate and the rising of magma plumes, which also have a lifting effect. Water mixing with the magma makes it more fluid and more easily melted. These plumes often force their way through the upper plate and erupt as volcanoes, which is why volcanic arcs are created near subduction zones. The classic example of volcanic arcs is found around the Pacific rim, where subduction zones abound.
Adding to the answer, the cold and dense slab that pulls the oceanic crust behind it down into mantle may rip off and sink down, causing a "sudden" change in buoyancy of the anyway less dense overlying continental crust. That way we have mountain ranges that quite well mark the main subduction zones on earth.
Edit: ok, expanding a bit on the buoyancy thing:
In principle, continental crust has a density of ~2.7g/cm³, oceanic crust ~3. A search for "continental rifting" and start of a "Wilson cycle" will clarify how an ocean can start off. From an ocean ridge to a continental margin, oceanic crust cools, densifies and sinks into the partly molten and ductile upper mantle, the "asthenosphere". Thus ocean floor depth is a function of age, reaching up to 5.5km, in special cases more. The oceanic crust stays welded to the adjacent continent until it has cooled down and densified enough that it literally rips off(*) and starts to sink into the asthenosphere. While it does, it drags the rest of the oceanic crust behind it, and the eventually thick layers of sediments that had been deposited from the continent get sheared off to form an "accretionary wedge".
The sediment layer can be considerably thick, many km for instance on the jurassic (pretty old and deep) ocean floor under Lanzarote and Fuerteventura off the African coast, and elsewhere of course.
The sinking oceanic crust stays cooler and denser while sinking down through the mantle. Such zones have been identified by seismics under several mountain ranges. Eventually, the weight of the "dangling" cold and dense ex-ocean floor gets too high so that it rips off. The overlying continental crust, suddenly released from an enormous weight, starts to rise quickly, sediments become exposed, erosion kicks in, and voila, valleys deep & mountains high form, with pretty picturesque sediment packages and their contents, today whale bones, in future plastic :-/
Examples for slabs: several stages of detached slabs under the Alps, fragmented slabs under the Himalaya, under the Cordilleres, Andes, ...
(*) This explains also why oceanic crust has a maximum age, best consumed before :-)
Oh, and in some cases, fragments of the ocean floor can be deposited between sediments and stay afloat. When it is exposed, this is called an "ophiolite".
Hope that helps :-)