A violin has shorter strings than a double bass, so it produces higher pitched sounds. The average length of a violin string is about 33 cm, while the average length of a double bass string is about 104 cm. This means that the violin strings vibrate at a higher frequency than the double bass strings, producing higher pitched sounds.
In addition to the length of the strings, the tension of the strings also affects the pitch of the sound. The tighter the strings are, the higher the pitch. Violin strings are typically tighter than double bass strings, which also contributes to the higher pitch of the violin.
Finally, the shape of the body of the instrument also affects the sound. The body of a violin is smaller and more resonant than the body of a double bass, which means that it produces a brighter, more focused sound.