A pyramid is one-third of a prism with the same base area $B$ and height $h$: $$V=\frac13Bh$$
Cone
A cone is one-third of a cylinder with the same base radius and height: $$V=\frac13\pi r^2h$$
Exam technique
Before substituting values, write the formula with symbols first (for example $V=\pi r^2h$).
Then check: do your units match (cm with cm, not m with cm)?
Only then calculate.
The Volume Of A Sphere From A Circumscribed Cylinder
A sphere is the set of points at distance $r$ from a center. Its volume formula is: $$V=\frac43\pi r^3$$
One classic way to understand this result comes from comparing a sphere to the smallest cylinder that just fits around it (a circumscribed cylinder):
cylinder radius $=r$
cylinder height $=2r$
The cylinder's volume is: $$V_{\text{cyl}}=\pi r^2(2r)=2\pi r^3$$
Explorations (attributed historically to Archimedes) show that the sphere's volume is two-thirds of this circumscribed cylinder: $$V_{\text{sphere}}=\frac{2}{3}V_{\text{cyl}}=\frac{2}{3}(2\pi r^3)=\frac{4}{3}\pi r^3$$
Analogy
Think of the circumscribed cylinder as the "tightest can" that can hold the sphere.
The sphere does not fill the can completely, it uses exactly two-thirds of the can's volume when the can's height is the sphere's diameter.
Measuring Volume By Water Displacement
Not all objects have a simple formula.
If a solid sinks in water (for example a golf ball), you can find its volume using a measuring cylinder.
Method (displacement):
Put the object in the cylinder and add water until it covers the object.
Record the water level (object + water).
Remove the object and record the new water level (water only).
The difference is the object's volume.
Because $1\text{ ml}=1\text{ cm}^3$, the difference in ml is directly the volume in cm$^3$.
Example
If the cylinder reads 86 ml with the ball and 44 ml without the ball, then the ball's volume is $86-44=42 \text{ ml} =42 \text{ cm}^3$.