Syntax Logic Errors your name Click here for
- Slides: 11
Syntax &Logic Errors [your name]
Click here for more help Complete the definition for each key term: Syntax and Logic Errors Term Syntax Error Learning Objectives: I am able to identify the technical terms used for programming errors I am able to explain the need for testing when identifying logic errors I am able to use a trace table to identify potential errors in a program Logic Error Execution/ Runtime Error Dry Run Trace Table Definition
Investigate Why Learn to Identify Errors? What are the impacts to the developer and user if there are errors in the code? ** write your answer here **t Being able to identify errors in your program is not only good for your exam it can help improve your own code too. Click here in presentation mode to see learning objectives & key terms
Practice Dry Run A dry run is the process of a programmer manually working through their code to trace the value of variables (with no software involved) If a programmer found that the value is not what it should be, they are able to identify the section of code that resulted in the error. What would the trace table below look like after you dry run this algorithm using the data: 12, 40, 5 a = 1000 b = 0 FOR i = 0 TO 3 DO temp = INPUT IF temp < a THEN a = temp END IF IF temp > b THEN b = temp END IF NEXT I temp a b Click here in presentation mode to see learning objectives & key terms
Evaluate Trace Tables How does a Trace Table help you look for programming errors? ** write your answer here **t Trace tables enable programmers to trace the value of variables as each line of code is executed. The values of the variables are displayed in a table making it easier for the programmer to identify any potential risk or errors that might stop the code running as required. Click here in presentation mode to see learning objectives & key terms
Identify Breakpoints When a programmer creates code they can add something called a breakpoint. A breakpoint is a point in the program where the code will stop executing. When a breakpoint is set and triggered the program will display the value of the variables at that point only. Add a breakpoint to a program that you have already created. What did it do to the code when you ran it? ** add a screen capture here**t Why is it useful to add breakpoints into the code when identifying programming errors? ** write your answer here **t Click here in presentation mode to see learning objectives & key terms
State Types of Error Syntax: An error in spelling or grammar or something wrong with the structure of the code Logic: An error in the logic of the code resulting in an unexpected output Execution: A error that is caused by asking a program to do something that is impossible State the type of error you would get in the following examples: Input You used the keyword Repeat but spelt it Repleat You wanted to do (TIME + UNIT) / 7 in a program but you wrote TIME + UNIT / 7 You ask the program to access an item in array 11 when there are only 10 arrays Type of Error
Describe Documentation It is common practice for programmers and testers to track testing using internal documentation. Newer styles of iterative development put less emphasis on rigorous test documentation, but it is still considered important. Describe what types of documentation is recommended to track testing. Why is documentation so important in a team? ** write your answer here **t Click here in presentation mode to see learning objectives & key terms
Exam Question Practice Complete each of the questions on the following slides, then check your answers here
Exam Question 1 Give one reason the following code would result in an error and state the type of error. Row_data = [‘cats’ , ‘dogs’, ‘rabbits’] Def output_data(): for row_num in range(0, len(row_data)): print(str(row_num) + “…” + row_data[row_num]) Output_data() Print (row_num) [2 marks]
Exam Question 2 Barry thinks there are some errors in his code as it fails to return the expected values. He decides to use a Trace Table to assist in identifying and fixing these errors. Explain what a trace table is and how it can be used to effectively trace potential logical programming errors. [4 marks]
- Your score: 1 click here to start playing
- Clever click
- Click clever click safe
- Click clever click safe
- Click clever click safe
- Common logic errors
- How old is what's your name
- Syntax directed definition and syntax directed translation
- Click here to add text
- Click here buttons
- Click here for instructions
- Click here