CNC Programming Interview Questions and Answers (G & M Codes)

CNC Programming Interview
author image Deepak choudhary

Deepak S Choudhary

Learn More in This Video

Subscribe to GaugeHow for More

Become the Engineer Industry is looking for

You Studied Engineering. Now Learn What gets you Hired.

Your Degree gave you the Theory. Employers want the tools — CAD, simulation, GD&T, CNC, Industry 4.0. GaugeHow gives you 40+ industry-focused courses so you walk into interviews ready, not nervous.

Become the Engineer Industry is looking for

You Studied Engineering. Now Learn What gets you Hired.

Your Degree gave you the Theory. Employers want the tools — CAD, simulation, GD&T, CNC, Industry 4.0. GaugeHow gives you 40+ industry-focused courses so you walk into interviews ready, not nervous.

CNC programming interviews almost always come down to one core test: can you actually read and write G-code and M-code, or do you just recognize the terms?

Interviewers ask you to explain specific codes, walk through a simple program, and troubleshoot a machine behaving unexpectedly all of which quickly separates real hands-on experience from textbook familiarity.

1. CNC Fundamentals

Interviewers open here to confirm you understand the basics of CNC control before testing specific codes.

1. What does CNC stand for, and how does it control a machine?

CNC stands for Computer Numerical Control, where a machine's movements are controlled by a program of coded instructions rather than manually operated handwheels.

The controller reads the program line by line and translates each instruction into precise axis movement, spindle speed, and tool changes.

2. What is the difference between G-code and M-code?

G-codes (preparatory codes) control geometric movement where and how the tool moves, like rapid positioning or linear interpolation.

M-codes (miscellaneous codes) control machine functions unrelated to direct tool movement, like turning coolant on, starting the spindle, or ending the program. Both work together within the same program to run a complete machining cycle.

3. What is the structure of a typical CNC program line (block)?

A block typically starts with a line number (optional on modern controls), followed by G-codes for motion type, coordinate values (X, Y, Z), feed rate (F), spindle speed (S), tool number (T), and any relevant M-codes, all read together as one complete instruction. Understanding how these elements combine in a single line is fundamental to reading or writing any CNC program.

4. What is the difference between Absolute and Incremental programming?

Absolute programming (G90) specifies every coordinate relative to a fixed origin point (usually the part zero), so each move states exactly where the tool should end up.

Incremental programming (G91) specifies each move relative to the tool's current position, describing how far to move rather than where to land. Mixing the two without realizing which mode is active is a common source of programming errors.

2. G-Code Fundamentals

5. What is G00, and when is it used?

G00 is Rapid Positioning, moving the tool at the machine's maximum traverse speed to a specified location without cutting. It's used for non-cutting moves, like repositioning between operations or approaching the workpiece, and should never be used while the tool is actually engaged in material.

6. What is G01, and how is it different from G00?

G01 is Linear Interpolation, moving the tool in a straight line at a programmed feed rate, used for actual cutting moves. Unlike G00's rapid, uncontrolled speed, G01 moves at a controlled rate specified by the F word, which is essential for producing an accurate, controlled cut rather than damaging the tool or part.

7. What do G02 and G03 do?

G02 and G03 command circular interpolation, moving the tool along a curved arc G02 for clockwise motion and G03 for counterclockwise motion, typically defined using either an R (radius) value or I/J/K center point offsets. These codes are essential for machining rounded features like fillets, bosses, or circular pockets.

8. What is the difference between G20 and G21?

G20 sets the programming units to inches, while G21 sets them to millimeters, and this needs to be specified correctly at the start of a program since the controller interprets every subsequent coordinate value according to whichever unit mode is active.

Programming in the wrong unit mode is a classic, avoidable cause of a part coming out drastically the wrong size.

9. What does G28 do, and why is it commonly used at the start or end of a program?

G28 sends the machine to its home or reference position, often used at the beginning of a program to establish a known starting point, or at the end to safely retract the machine before an operator approaches for part changeover.

It ensures the machine returns to a consistent, predictable location rather than leaving the tool wherever the last operation happened to finish.

10. What is Cutter Compensation (G40, G41, G42), and why is it useful?

G41 and G42 offset the toolpath to the left or right of the programmed part contour by the tool's actual radius, letting the programmer write the toolpath along the part's actual geometry rather than manually calculating an offset path for every tool size.

G40 cancels this compensation. It's especially useful because it lets an operator adjust for a slightly worn or differently sized tool without rewriting the entire program.

11. What is the difference between G54 through G59, and why does a machine need multiple work offsets?

G54 through G59 select different work coordinate systems, each storing a separate part zero location, which allows a machine to run multiple identical fixtures or multiple different parts in one setup without reprogramming the origin each time.

This is especially useful in production environments running several vises or fixtures across a single table simultaneously.

3. M-Code Fundamentals

12. What does M00 do, and when would a programmer use it?

M00 is a Program Stop, pausing the program completely and requiring the operator to manually press cycle start to continue. It's typically used to allow a manual inspection, tool check, or part flip mid-program, giving the operator a deliberate checkpoint before the machine proceeds.

13. What is the difference between M03, M04, and M05?

M03 starts the spindle rotating clockwise, M04 starts it rotating counterclockwise, and M05 stops spindle rotation entirely. Choosing the correct direction matters for operations like left-hand or right-hand tooling, and forgetting to include a spindle start command is a common beginner mistake that stalls a program immediately.

14. What does M06 do, and what typically needs to happen before it's called?

M06 executes a tool change, and it's typically preceded by a T-word specifying which tool number should be loaded next. On most machines, the spindle should be stopped and the tool retracted to a safe position before an M06 is called, since a tool change while the spindle is engaged or the tool is near the part risks a serious crash.

15. What is the difference between M08 and M09?

M08 turns coolant on, and M09 turns coolant off. Coolant plays a critical role in tool life and surface finish for many operations, so forgetting an M08 before a demanding cut can lead to premature tool wear or a poor finish, even if the rest of the program is written correctly.

16. What does M30 do, and how is it different from M02?

M30 ends the program and resets the controller back to the beginning, often also rewinding the program tape or memory pointer for the next cycle. M02 also signals the end of the program but doesn't automatically reset in the same way on many controls, meaning the exact behavior can differ slightly between machine builders and control types.

4. Turning-Specific Programming

17. What is G96, and how is it different from G97?

G96 activates Constant Surface Speed control, automatically adjusting spindle RPM as the tool moves to different diameters to maintain a consistent cutting speed at the tool tip.

G97 instead holds spindle speed at a fixed RPM regardless of diameter. G96 is especially useful on facing operations where the diameter changes continuously as the tool moves toward center.

18. What is a Canned Cycle, and can you give an example used in turning?

A canned cycle is a pre-programmed sequence that condenses a complex, repetitive machining operation into a single line of code, rather than requiring the programmer to write out every individual pass manually. G71, a rough turning canned cycle, is a common example it automatically generates multiple roughing passes to remove material down to a specified finish contour.

19. What is the difference between Diameter Programming and Radius Programming on a lathe?

Diameter programming specifies the X-axis position as the actual part diameter, which is the more common default on most modern turning centers. Radius programming instead specifies X as the distance from centerline.

Programming in the wrong mode produces a part exactly half or double the intended size, which is why confirming the machine's active mode before programming is essential.

20. Why is Tool Nose Radius Compensation especially important in turning operations with tapers or radii?

A lathe tool's cutting edge isn't a perfect point it has a small radius —and without compensation, that radius introduces dimensional error specifically on angled or curved surfaces, even though straight facing and turning cuts might look fine without it.

Activating tool nose radius compensation lets the control automatically account for this geometry, producing an accurate contour regardless of the specific insert's nose radius.

5. Milling-Specific Programming

21. What is the difference between Climb Milling and Conventional Milling?

Climb milling cuts in the same direction as the cutter's rotation relative to the feed, generally producing a better surface finish and longer tool life on rigid setups.

Conventional milling cuts against the direction of rotation, which is sometimes preferred on older, less rigid machines to avoid the cutter pulling into the material aggressively. Modern rigid CNC machines usually favor climb milling for most operations.

22. What is a Canned Cycle used for drilling, and how does G81 work?

G81 is a simple drilling canned cycle that condenses the repetitive rapid-to-position, feed-to-depth, and rapid-retract sequence into a single line, rather than requiring separate G01 commands for every hole.

It's especially efficient when drilling a pattern of many identical holes, since only the X/Y coordinates need to change for each subsequent hole.

23. What is a Bolt Hole Circle, and how would you program one?

A bolt hole circle is a pattern of equally spaced holes arranged around a circle, and many controls support a dedicated canned cycle or macro specifically for generating this pattern automatically from just the circle's center, radius, number of holes, and starting angle.

Without this feature, a programmer would otherwise need to manually calculate the X/Y coordinates for every individual hole using trigonometry.

24. How does GD&T on a drawing influence how you'd program a milling operation?

GD&T callouts like position, flatness, or perpendicularity define exactly which datums and tolerance zones matter for a given feature, which directly informs how a programmer sequences operations and chooses fixturing to actually hold those requirements.

Ignoring the GD&T intent and machining purely to a basic dimension can produce a part that technically hits the nominal size but still fails the drawing's actual geometric requirement. GaugeHow's GD&T and Engineering Graphics course is a strong companion for understanding how drawing callouts should shape a machining strategy.

6. Tool Offsets, Compensation, and Work Coordinates

25. What is a Tool Length Offset, and why is it necessary on a milling machine?

Tool length offset accounts for the fact that different tools have different lengths, letting the control automatically adjust the Z-axis position so each tool reaches the correct depth without needing the program itself rewritten for every individual tool's physical length. Without accurate tool length offsets, a tool change would produce a completely wrong depth, and potentially a serious crash.

26. What's the difference between Machine Zero and Part Zero (Work Zero)?

Machine zero is a fixed reference point built into the machine itself, established during machine setup and unrelated to any specific part. Part zero (or work zero) is a point the programmer defines relative to the actual workpiece, usually stored in a work offset like G54, and it's what all the part's programmed coordinates are actually measured from.

27. How would you verify a new CNC program is correct before running it on an actual part?

Start with a dry run or graphical simulation to check for obvious toolpath errors or collisions, then run the first article with reduced feed rate and single-block stepping, checking dimensions with actual measuring instruments at key points before letting the program run to full completion unattended.

Skipping this verification step on a brand-new program is one of the fastest ways to scrap an expensive piece of material or damage a tool. GaugeHow's Engineering Metrology & 3D Measurement course covers the measurement side of confirming a first article actually matches the intended dimensions.

7. CAM, Troubleshooting, and Safety

28. What is the relationship between CAM software and the actual G-code that runs on the machine?

CAM software generates toolpaths based on a 3D CAD model and selected machining strategies, then translates those toolpaths into the specific G-code and M-code syntax (a post-processor) required by a particular machine's controller.

Understanding both sides how CAM builds a toolpath and how the resulting code actually reads helps a programmer troubleshoot when the two don't quite match expectations. GaugeHow's Fusion 360 course covers CAM toolpath generation alongside the CAD modeling side of the workflow.

29. If a program runs but produces an out-of-tolerance part, what would you check first?

Start with tool offsets and wear compensation values, since an incorrect or outdated offset is one of the most common causes of a program that runs without error but still produces a wrong dimension.

From there, check for tool deflection, fixture repeatability, and whether the correct work coordinate system was actually active, since any of these can quietly produce a consistent, repeatable dimensional error.

30. What safety practices are essential when running or editing a CNC program on the shop floor?

Always verify the correct work offset and tool table before the first cycle, keep hands and tools clear of the work envelope during operation, use single-block and reduced feed rate when testing a new or edited program, and never bypass machine guards or interlocks to save time.

GaugeHow's CNC Programming course covers these safety fundamentals alongside the core G-code and M-code programming skills this list has walked through.

Frequently Asked Questions

Do I need to memorize every G-code and M-code for a CNC programming interview?

No interviewers generally focus on the most commonly used codes covered here, along with your ability to explain what a code does and when you'd use it, rather than testing exhaustive recall of every possible code across every control brand. Deep familiarity with the core set matters more than trying to memorize everything.

Are G-codes and M-codes the same across every CNC machine brand?

The core codes covered here (G00, G01, M03, M06, and similar) are fairly standardized across most Fanuc-style controls, but specific canned cycles, macro syntax, and some M-codes can vary between machine builders like Haas, Mazak, or Siemens. Mentioning which specific control you have experience with is a useful detail to include in your interview answers.

Is manual G-code writing still relevant if most programming happens through CAM software today?

Yes even with CAM generating the bulk of a toolpath, being able to read, verify, and hand-edit the resulting G-code is essential for troubleshooting, making quick shop-floor adjustments, and catching a post-processor error before it causes a costly mistake.

Interviewers specifically test manual code knowledge because it reflects whether you truly understand what's happening, not just what button to click in software.

What's the most common mistake candidates make in a CNC programming interview?

Confusing similar codes, like G00 and G01, or forgetting to mention safety checks such as verifying tool offsets and running a dry simulation before full-speed production. Interviewers listen closely for this kind of practical, safety-conscious detail as a sign of real shop-floor experience.

Conclusion

CNC programming interviews reward candidates who can move fluidly between code-level detail and practical shop-floor judgment explaining exactly what G01 or M06 does, while also knowing to verify tool offsets and run a dry simulation before trusting a new program.

Get comfortable walking through a simple program block by block, know the difference between the commonly confused code pairs like G90/G91 and G96/G97, and be ready to describe how you'd troubleshoot an out-of-tolerance part step by step.

Review this list carefully before your interview, and you'll be prepared for almost any G-code or M-code question thrown your way.

Want to build stronger, hands-on CNC programming skills before your interview?

Explore GaugeHow's CNC Programming course for a full walkthrough of G-codes, M-codes, and machine setup, pair it with Fusion 360 for CAM toolpath generation, GD&T and Engineering Graphics for drawing interpretation, or Engineering Metrology & 3D Measurement for verifying your finished parts.

If you're just getting started, GaugeHow's Free Course is a no-cost way to explore the platform, or browse the full course catalog to find the right fit for your next role.