I have an old outdoor faucet that is leaking water. The switch of the water source is very old and hard to turn to stop the water supply to this faucet. I wonder if I can buy something to cap it to stop the leak, if I do that, will I risk water trap inside, and would it be risking bursting pipe in winter when the water freezes?
You could probably use a shutoff like this one as a temporary solution.
If it's still "temporary" when you winterize, I would remove it then.
Edit to add why it's temporary (as requested via comment).
Why is it a temporary solution? Its a quick way to stop the leak, but doesn't take freezing cycles into account. Outdoor valves are typically "frost free", and the portion of the valve that actually stops the water flow is either inside the heated area of the house, or deep underground. A long stem on the valve allows the user to turn the valve on or off. Diagrams of typical frost free valves appear below. When turned off the portion of the valve outside (or above the fiostline) is allowed to drain.
As you can see, using the above as a quick fix won't allow water to drain out of the valve body (or in the case of the underground type it won't provide vent to drain underground).
I would recommend fixing the leak. If it is an old faucet there are rebuild kits that make this very easy. If it is old enough that it is not a freeze resistant type (where the actual valve is well inside the house) you should probably replace it. There are plenty of videos online that will walk you through the process of rebuilding a valve with parts that cost a dollar or two from the home store.
If it is an old type of valve capping it will increase the risk of freezing and damage. If it is a freeze resistant valve capping it will defeat the freeze protection and likely cause it to burst. (For the same reason you should not leave hoses connected in winter)