The major scale formula
Every major scale — in every key — is built from the same recipe of whole (W) and half (H) steps, starting from the tonic:
W – W – H – W – W – W – H
Learn that one pattern and you never have to memorise a key's notes again. You walk the pattern from any starting note and it hands you the scale — sharps, flats and all.
See it — C major, with the steps marked
It's two matching halves
Split the scale in the middle: C D E F and G A B C. Each is a tetrachord ("four notes"), and each has the same internal shape — W W H. A whole step joins them.
On the violin this is literally true: in G major the lower tetrachord (G A B C) and the upper tetrachord (D E F♯ G) use the same first-position hand shape — the lower one on the G string, the upper one on the D string, one string higher. The scale is one hand shape, stacked.
Build one on any note
Start on G and walk the formula:
G –(W)→ A –(W)→ B –(H)→ C –(W)→ D –(W)→ E –(W)→ F♯ –(H)→ G
The formula demanded an F♯: to make the step from the 7th degree up to the tonic a half step, plain F wasn't close enough — it had to be raised. Nobody had to tell you G major has one sharp; the recipe produced it.
Hear it — what happens if you break the recipe
Play C major, then play it again with the 7th degree lowered — B♭ instead of B. The last step is now a whole step, not a half, and the scale stops sounding "major" — it goes flat and folk-ish (that's actually a different scale, the Mixolydian mode, but that's for later).
Try it
Try
Build D major out loud, walking the formula from D: D –W→ E –W→ F♯ –H→ G –W→ A –W→ B –W→ C♯ –H→ D. Say "whole, whole, half…" as you go. You should find two sharps — F♯ and C♯. Then play it, first position: D E F♯ G on the D string, A B C♯ D on the A string.
The usual mistake
Learning each key's notes as a separate list to memorise. There's one recipe. If you can walk W-W-H-W-W-W-H from a starting note, you can spell any major scale — and later, work out its key signature — without looking anything up.