The Code That Almost Failed — 5th Grade Reading Comprehension Worksheet
"The Code That Almost Failed" is a short fiction passage written for 5th graders, followed by 6 comprehension questions that focus on problem and solution. A team of students working on a coding competition project must fix a bug under pressure just before the deadline. Print the passage and questions, or download the PDF with the answer key on the last page — it is free for home, classroom and homeschool use.
Make your worksheet
Free to print for home, classroom and homeschool use. The answer key prints on page 2.
The Code That Almost Failed
Grade 5 · Fiction · problem and solution
Read the passage carefully. You may underline parts that help you answer.
The regional coding competition gave teams eight hours to build a working app, and Jasmine's team of three had spent the entire time creating a program that helped users track their recycling habits. With only thirty minutes left, everything seemed ready. Jasmine clicked the button to run their final test, expecting to see the success message they had seen dozens of times before.
Instead, the screen filled with red error messages. Jasmine's stomach dropped. Somewhere in the thousands of lines of code, something had broken, and none of them could figure out what had changed since the last successful test. Her teammate Derek suggested scrapping the newest feature entirely, but Jasmine worried that would mean losing points for incomplete functionality that judges expected to see.
With twenty minutes remaining, the team's third member, Priya, calmly suggested checking the code line by line instead of panicking, starting with whatever had been changed most recently. They discovered that Derek had accidentally added a comma in the wrong place while making a small edit ten minutes earlier, causing the entire program to misread a crucial section of code. It was a tiny mistake, but it had been enough to break everything.
With only twelve minutes left on the clock, Jasmine carefully deleted the extra comma while Derek and Priya double-checked her work. They ran the test again, and this time, the success message appeared on the screen. The team submitted their project with just under three minutes to spare. Although they did not win first place, the judges praised their app's design, and Jasmine realized that staying calm and working through problems methodically had saved their project when panic nearly ruined it.
Answer the questions. Use details from the passage.
Answer Key
The Code That Almost Failed
Check a finished worksheet
Snap a photo of this completed worksheet. Our AI helper spots missed problems and suggests what to practice next. For best results, use the same worksheet shown above.
How to teach problem and solution in fiction text
- 1
Read it once for enjoyment
Let your reader go through "The Code That Almost Failed" straight through without stopping. The first pass is about getting the story or the topic, not about the questions.
- 2
Read it again with a pencil
On the second read, underline names, numbers, dates and any sentence that answers a question. Marking the text is the habit that lifts comprehension scores.
- 3
Answer with evidence
For each question, ask “which sentence proves that?” Short answers should quote or paraphrase a line from the passage.
- 4
Check with the answer key
Compare answers together. For any miss, go back to the paragraph instead of just correcting the letter.
Common mistakes kids make
- Answering from memory instead of rereading — teach kids to point at the line that proves it.
- Picking the first choice that sounds familiar; familiar words often appear in the wrong answer too.
- Skipping the problem and solution question because it needs more than one detail. Have them list two details first, then answer.
- Writing one word for a short-answer question. Ask for a full sentence that restates the question.
Tips for parents and teachers
- Read aloud together the first time if fluency is still developing.
- Cover the questions while reading so kids read the whole passage, not just for answers.
- Keep sessions to 15 minutes — one passage a day beats five on Sunday.
Grade alignment
This worksheet supports Common Core standard RL.5.1, typically taught in 5th grade. Use it for practice, homework, review or a timed check of fluency.
Related worksheets
The Shortcut
5th grade
Free printable 5th grade reading comprehension worksheet: "The Shortcut". A boy who takes a forbidden shortcut through the woods learns an important lesson about honesty and consequences. Includes 6 questions and an answer key.
Open worksheetThe Transcontinental Railroad: Connecting a Nation
5th grade
Free printable 5th grade reading comprehension worksheet: "The Transcontinental Railroad: Connecting a Nation". An informational passage explains how the Transcontinental Railroad was built and how it changed travel and trade across the United States. Includes 6 questions and an answer key.
Open worksheetThe Last Chess Piece
5th grade
Free printable 5th grade reading comprehension worksheet: "The Last Chess Piece". A determined chess player learns a lesson about patience and strategy from an unexpected opponent. Includes 6 questions and an answer key.
Open worksheetThe Electric Grid: Powering Our Lives
5th grade
Free printable 5th grade reading comprehension worksheet: "The Electric Grid: Powering Our Lives". An informational passage explains how electricity travels from power plants to homes through the electric grid. Includes 6 questions and an answer key.
Open worksheetThe Tide Pool Explorer
5th grade
Free printable 5th grade reading comprehension worksheet: "The Tide Pool Explorer". A curious girl discovers the delicate balance of life in a tide pool during a family beach trip. Includes 6 questions and an answer key.
Open worksheet5th Grade Reading Comprehension Worksheets
5th grade
Free printable 5th grade reading comprehension worksheets with fiction and nonfiction passages, point-of-view questions, and answer keys.
Open worksheetReading Comprehension Worksheets
Grades 1-5
Printable reading comprehension worksheets with fiction and nonfiction passages for grades 1-5, including comprehension questions and answer keys.
Open worksheetFrequently asked questions
What reading level is "The Code That Almost Failed"?
It is written for 5th grade readers, so it fits most kids in grade 5 and works as review for grade 6 or a challenge for grade 4.
Does this worksheet include an answer key?
Yes. Turn on the answer key option and the answers print on the page after the questions, with model answers for the short-answer items.
Is this reading worksheet free to print?
Yes, every passage on KGD Sheets is free to print and download as a PDF for home, classroom and homeschool use.
How many questions come with each passage?
This passage has 6 questions, mixing multiple choice with short written answers so kids practice both formats.
Can I use this passage for a reading test?
Yes. Print it without the answer key for testing, then print the key for grading. The questions follow the same style as state reading assessments.
What skill does this passage practice?
The questions center on problem and solution, plus vocabulary in context and finding evidence in the text.