You can remember the meaning of 检察官 with this easy mnemonic:
A public prosecutor's job is to check (检), research (察), and make official (官) decisions about whether or not one goes to jail.
Using mnemonics to remember the meaning of Chinese characters like can have an enormous impact on how long to learn Mandarin it takes.