Bird
Raised Fist0
CNC Programmingscripting~20 mins

Machine axes (X, Y, Z for milling) in CNC Programming - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Master of Machine Axes
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the resulting position after this move command?
Given the initial tool position at X0 Y0 Z0, what is the tool position after executing the command G01 X10 Y-5 Z3 F100?
CNC Programming
Initial position: X0 Y0 Z0
Command: G01 X10 Y-5 Z3 F100
AX0 Y0 Z0
BX10 Y-5 Z3
CX10 Y0 Z3
DX0 Y-5 Z3
Attempts:
2 left
💡 Hint
G01 moves the tool in a straight line to the specified coordinates.
🧠 Conceptual
intermediate
1:00remaining
Which axis controls the vertical movement in milling?
In a standard 3-axis milling machine, which axis moves the tool up and down?
AZ axis
BY axis
CX axis
DA axis
Attempts:
2 left
💡 Hint
Think about the 3D coordinate system: X and Y are horizontal directions.
📝 Syntax
advanced
1:30remaining
What error occurs with this CNC command?
What error will this CNC command produce? G01 X10 Y Z5
CNC Programming
G01 X10 Y Z5
ANo error, moves to X10 Y0 Z5
BRuntime error: tool collision
CSyntax error due to missing Y coordinate value
DWarning: feed rate missing
Attempts:
2 left
💡 Hint
Every axis coordinate must have a number after the letter.
🚀 Application
advanced
2:00remaining
How many unique positions does this program move through?
Given this CNC program snippet, how many unique positions does the tool move to?
G00 X0 Y0 Z0
G01 X5 Y5 Z-1
G01 X5 Y5 Z-1
G01 X10 Y0 Z-1
G00 X0 Y0 Z0
A2
B4
C5
D3
Attempts:
2 left
💡 Hint
Count unique coordinate sets ignoring repeated positions.
🔧 Debug
expert
3:00remaining
Why does this CNC program cause unexpected Z-axis movement?
This CNC program snippet causes the tool to plunge unexpectedly deep on the Z axis. What is the cause?
G00 X0 Y0 Z5
G01 X10 Y10 Z-5 F200
G01 X20 Y20 Z-10
G00 Z5
AZ coordinate in second G01 is lower than intended causing deep plunge
BG00 command moves too fast causing tool to crash
CMissing feed rate on the second G01 causes default slow plunge
DTool length offset not set causing wrong Z reference
Attempts:
2 left
💡 Hint
Look carefully at the Z values in each move command.

Practice

(1/5)
1. Which axis controls the up and down movement of the milling tool in CNC programming?
easy
A. Y axis
B. Z axis
C. X axis
D. A axis

Solution

  1. Step 1: Understand axis directions in milling

    The X and Y axes control horizontal movements, while the Z axis controls vertical movement.
  2. Step 2: Identify the axis for up and down movement

    The Z axis moves the tool up and down, controlling cutting depth.
  3. Final Answer:

    Z axis -> Option B
  4. Quick Check:

    Z axis = vertical movement [OK]
Hint: Remember Z is vertical, X and Y are horizontal [OK]
Common Mistakes:
  • Confusing X or Y for vertical movement
  • Thinking A axis is vertical
  • Mixing axis directions
2. Which of the following is the correct G-code command to move the tool in a straight line to X=10, Y=20, Z=-5?
easy
A. G02 X10 Y20 Z-5
B. G00 X10 Y20 Z-5
C. G01 X10 Y20 Z-5
D. G03 X10 Y20 Z-5

Solution

  1. Step 1: Identify G-code commands for movement

    G01 is used for linear (straight line) movement at controlled feed rate. G00 is rapid move, G02 and G03 are circular moves.
  2. Step 2: Match command with desired straight line move

    To move in a straight line to X=10, Y=20, Z=-5, use G01 with those coordinates.
  3. Final Answer:

    G01 X10 Y20 Z-5 -> Option C
  4. Quick Check:

    G01 = linear move [OK]
Hint: G01 means straight line move, G00 is rapid move [OK]
Common Mistakes:
  • Using G00 for cutting moves
  • Confusing G02/G03 with linear moves
  • Omitting Z coordinate
3. What will be the final position of the tool after executing the following commands?
G01 X5 Y5 Z0
G01 X10 Y5 Z-3
G01 X10 Y10 Z-3
medium
A. X=10, Y=10, Z=-3
B. X=10, Y=5, Z=-3
C. X=5, Y=5, Z=-3
D. X=10, Y=10, Z=0

Solution

  1. Step 1: Trace each G01 command's effect on position

    First move: X=5, Y=5, Z=0. Second move: X=10, Y=5, Z=-3. Third move: X=10, Y=10, Z=-3.
  2. Step 2: Identify final coordinates after last command

    The last command sets position to X=10, Y=10, Z=-3.
  3. Final Answer:

    X=10, Y=10, Z=-3 -> Option A
  4. Quick Check:

    Final position = last command coordinates [OK]
Hint: Last G01 command sets final position [OK]
Common Mistakes:
  • Ignoring Z coordinate changes
  • Mixing up command order
  • Assuming position resets
4. Identify the error in this CNC code snippet:
G01 X15 Y10
G01 Z-2
G01 X20 Y15 Z-2
medium
A. Missing Z coordinate in first line causes unexpected Z position
B. Z coordinate cannot be negative
C. G01 cannot be used multiple times consecutively
D. X and Y coordinates must be integers

Solution

  1. Step 1: Analyze the first G01 command

    The first line moves X and Y but omits Z, so Z stays at previous value (unknown or last set).
  2. Step 2: Understand impact of missing Z coordinate

    Omitting Z means the tool may not move vertically as expected, causing potential errors in cutting depth.
  3. Final Answer:

    Missing Z coordinate in first line causes unexpected Z position -> Option A
  4. Quick Check:

    Omitting axis coordinate keeps previous value [OK]
Hint: Always specify Z if vertical position changes [OK]
Common Mistakes:
  • Thinking negative Z is invalid
  • Believing G01 can't repeat
  • Assuming coordinates must be integers
5. You want to mill a square pocket 10 units wide and 10 units long, starting at X=0, Y=0, and cutting down 2 units deep. Which sequence of commands correctly moves the tool to mill the pocket edges at depth?
hard
A. G00 Z-2 G01 X10 Y0 G01 X10 Y10 G01 X0 Y10 G01 X0 Y0 G01 Z0
B. G01 X0 Y0 G01 X10 Y0 G01 X10 Y10 G01 X0 Y10 G01 X0 Y0 G01 Z-2 G01 Z0
C. G00 Z-2 G01 X10 Y0 G01 X10 Y10 G01 X0 Y10 G01 X0 Y0 G00 Z0
D. G01 X0 Y0 Z-2 G01 X10 Y0 Z-2 G01 X10 Y10 Z-2 G01 X0 Y10 Z-2 G01 X0 Y0 Z-2 G01 Z0

Solution

  1. Step 1: Set cutting depth before horizontal moves

    To cut at depth, Z must be set to -2 before moving in X and Y axes.
  2. Step 2: Move tool around square edges at constant depth

    Commands must keep Z at -2 while moving X and Y to mill the pocket edges.
  3. Step 3: Retract tool after finishing

    Return Z to 0 to lift the tool safely after cutting.
  4. Final Answer:

    G01 X0 Y0 Z-2 G01 X10 Y0 Z-2 G01 X10 Y10 Z-2 G01 X0 Y10 Z-2 G01 X0 Y0 Z-2 G01 Z0 -> Option D
  5. Quick Check:

    Set Z depth first, move XY at depth, then retract [OK]
Hint: Set Z depth before XY moves, retract after [OK]
Common Mistakes:
  • Moving XY before setting Z depth
  • Using rapid moves (G00) for cutting
  • Changing Z during XY moves
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard