The first half of Futility introduces the hero John Rowland. Rowland is a disgraced former US Navy officer. Now an alcoholic fallen to the lowest levels of society, he's been dismissed from the Navy and works as a deckhand on the Titan. One April night the ship hits an iceberg, sinking somewhat before the halfway point of the novel.
The second half follows Rowland. He saves the young daughter of a former lover by jumping onto the iceberg with her. The pair find a lifeboat washed up on the iceberg, and are eventually rescued by a passing ship. But the girl is recovered by her mother and Rowland is arrested for her kidnapping. A sympathetic magistrate discharges him and rebukes the mother for unsympathy to her daughter's savior. Rowland disappears from the world.
In a brief final chapter covering several years, Rowland works his way up from homeless and anonymous fisherman to a desk job and finally, two years after passing his civil service exam, to "a lucrative position under the Government, and as he seated himself at the desk in his office, could have been heared to remark: 'Now John Rowland, your future is your own. You have merely suffered in the past from a mistaken estimate of the importance of women and whisky.' THE END" (1898 edition at Google Books).
A later edition includes a coda. Rowland receives a letter from the mother, who congratulates him and pleads for him to visit her, and the girl who begs for him. (External links: undated edition at titanic-titanic.com)

Question: How did Rowland finally get a lucrative Government job?
Answer: He took the civil service exam
Alternative answer: After passing his civil service exam