Firstly, welcome to BH and thanks for the question!
In this case, although there are some visual differences, they do have the exact same Hebrew terms.
In Hebrew, the vowels are called Nikkud or Nekudot, and they play a very significant role in how we understand (and translate) a word. The Nekudot here are identical. You can see a list of Nekudot here. However, the Te'amim, or Cantillation notes are different. You can see a list here.
In Genesis 2:17, the verse shows:
In 1 Kings 2:42:
There are 2 visible differences between these, the sign under the first letter (if we read right-to-left, the direction that Hebrew text is read in), and the sign under the third to last letter. Both are differences in the Te'amim (and you are welcome to match them up to the list linked above).
- It should be noted that Te'amim can sometimes have an impact on the translation of the words, as they also show how to "break up" terms, as well as how to pronounce them, which can also change the tense of the words (past/present/future).
- Technically speaking, this term does not technically mean "surely die", but rather both Hebrew words are from the root of death. (See Young's literal translation here.) See here for a nice explanation of this phenomenon.