DoAssignment study guide
A4.1 · Use support documentation to resolve syntax issues
Learn to use support documentation to resolve syntax issues through clear examples and targeted practice.
Ontario Grade 12 Computer Science
Programming Concepts and Skills
ICS4U A4.1 | Read the language’s rules, check your code, and make a focused correction
What you will learn
- Recognize a syntax issue as code that does not follow the programming language’s writing rules.
- Use relevant support documentation to check the rule behind a reported syntax issue.
- Make a small correction and explain why it follows the documented rule.
- Describe a code example’s preconditions, input, expected result, and reasoning without claiming that unrun code was tested.
1. Start with the reported location and the language
- Use the message and nearby code to locate the question.
- Check documentation for the language and version you are using.
- Do not assume a syntax correction also proves the program’s overall behaviour is correct.
2. Find and apply the relevant documentation rule
- Search for a rule or example that matches the code feature.
- Compare the code to the documented form before editing.
- Make a small correction and check it against the same rule.
3. Use documentation examples as patterns, not guesses
- Use the example to understand the writing pattern.
- Keep the correction connected to a documented rule.
- Describe an expected result as a reasoned expectation, not as a test result.
4. A repeatable classroom routine
- Identify, look up, compare, correct, and review.
- Explain why a correction matches the documented rule.
- Keep the work focused on syntax.
Worked example
A missing colon in a conditional
Python 3
score = 72
if score >= 60:
print("Ready")- Identify the constructThe line begins with `if`, so consult Python 3 documentation or course support material for conditional statement syntax.
- Compare and correctThe documented Python form places a colon after the condition. Add that punctuation mark and leave the indented statement in the block.
- State the expected resultPrecondition: `score` has a value that can be compared with 60. Input: the value of `score`. Reading the corrected code, if the value is 72, the condition is true and the expected output is `Ready`. This is a reasoned trace, not a claim that the code was run.
Worked example
A string that needs a closing quotation mark
Python 3
print("Welcome")- Find the relevant ruleThe code starts a string with a double quotation mark. Look up Python’s documentation or course material for string literals and check how a quoted string is written.
- Match the opening and closing marksThe string needs a closing double quotation mark before the closing parenthesis. Add the missing mark; do not change the intended word.
- Trace the expected outputPrecondition: the line is read as Python 3 code. Input: none. The corrected call asks Python to display the string, so the expected output is `Welcome`. This expectation comes from reading the code, not from an execution claim.
Worked example
A function call with a missing closing parenthesis
Python 3
print(8 + 5)- Locate the unfinished callThe opening parenthesis after `print` begins a function call. Consult documentation or course support material for the written form of a function call and compare the opening and closing punctuation.
- Complete the punctuationThe call needs a closing parenthesis after the expression. Add it at the end of the line. The correction addresses the visible unfinished call; it does not change the addition.
- Describe the expected resultPrecondition: the line is read as Python 3 code. Input: the two integer values 8 and 5 in the expression. Reading the corrected expression, their sum is 13, so the expected displayed output is `13`. This is a trace by inspection, not a report of execution.
Common mistakes and how to avoid them
Lesson summary
- A syntax issue means code does not follow the writing rules of its language.
- Use the message and nearby code to identify the relevant construct, then consult matching support documentation.
- Compare the code with the documented rule, make a focused correction, and explain why it fits.
- When describing an example, state its precondition, input, and expected output without claiming unperformed testing.
Check your understanding
Question 1
- Add a colon because it looks right, without checking a rule.
- Consult support documentation for Python conditional syntax, compare the line, and add the required colon.
- Rewrite the indented statement even though its syntax has not been identified as the issue.
- Assume the code is valid because the condition is understandable.
Show answer and explanation
Question 2
- String literals
- Conditional statements
- Function parameters
- Numeric comparison
Show answer and explanation
Question 3
- The program passed a test.
- The output is guaranteed for every possible input.
- The output is expected from reading the code; it has not been reported as tested.
- Documentation is unnecessary once an output is predicted.
Show answer and explanation
Key terms
- Syntax
- The writing rules that determine how code must be arranged and punctuated in a programming language.
- Support documentation
- Language references, help pages, or course materials that explain rules and show examples.
- Syntax issue
- Code that does not follow the writing rules required by its programming language.
- Trace
- A step-by-step reading of code to work out what it is expected to do for stated input.
Continue through ICS4U
View the complete ICS4U Ontario Grade 12 Computer Science curriculum and lessons
Tutor support for A4.1 · Use support documentation to resolve syntax issues
Working on A4.1 · Use support documentation to resolve syntax issues in ICS4U? Bring the question and your own attempt. In a live session, you can trace a small example and find the first step where the output differs from what you expected. Ask about the first step that does not make sense, then try a similar question yourself.
Explore coding tutoring · Request an eligible free 30-minute introduction. Your request is matched by subject and language; a tutor must accept before a time is confirmed.
برای مبحث A4.1 · کاربرد مستندات برای رفع خطای نوشتاری در درس ICS4U، سؤال و تلاش خود را همراه بیاورید. در جلسه میتوانید یک مثال کوچک را دنبال کنید و نخستین گامی را که خروجی با انتظار شما فرق دارد پیدا کنید. راهنمای معلم برنامهنویسی را ببینید یا جلسهٔ معارفهٔ رایگان ۳۰ دقیقهای درخواست کنید. زمان جلسه پس از پذیرش معلم قطعی میشود.
About this lesson and its review
Published by DoAssignment. This reviewed lesson follows Ontario Grade 12 Computer Science (ICS4U), expectation A4.1. It is a study resource, not an official curriculum publication.
Before publication, content is checked for structure, mathematical or chemical notation, calculations, course boundaries, and readability. Errors can still occur, so corrections are welcomed.