際際滷

際際滷Share a Scribd company logo
2
Most read
9
Most read
11
Most read
TRACE TABLES
Introduction to Trace Tables
 A tool for tracking variable values during program execution
 Helps understand program flow and identify errors
 Consists of variable names as column headings and values
in cells
 One row for each pass or iteration of the program
Components of a Trace Table
 Column headers: Variable names (identifiers)
 Rows: Each pass or iteration of the program
 Cells: Values of variables at each step
 Additional columns can include line numbers or conditions
 Why do you think tracking variables is important in
programming?
Creating a Trace Table: Step 1
 Identify all variables in the program
 Create column headers for each variable
 Add a column for line numbers if needed
 Example variables: count, sum, average
Creating a Trace Table: Step 2
 Go through the program line by line
 Update variable values in each row as they change
 Note any conditions or decisions made
 How might this process help in debugging a program?
TRACE TABLES in Computer Science and Technology.pptx
Example: Simple Counting Loop
 Program: Trace a program that counts from 1 to 5 and
prints the count.
 START
Declare count as integer
 count = 0
 While count < 5:
 print(count)
 count = count + 1
ENDWHILE
 STOP
 (continues until count = 5)
Example: Simple Counting Loop
Step 1 Count
1 0
2 1
3 2
4 3
5 4
Example: Calculating Average
 Program:Trace a program that finds the sum and average of
numbers from 1 to 4
 START
 Declare sum,count as integer
 sum = 0
 for i =1 to 4 do
 sum = sum + i
 average = sum / 3
 ENDFOR
 STOP
Example: Calculating Average
| i | sum | average
1 0 0
2 1 .33
3 3 1
4 6 2
X Y
TRACE TABLES in Computer Science and Technology.pptx
Common Mistakes to Avoid
 Forgetting to update all variables in each row
 Misinterpreting logical operations in truth tables
 Skipping steps in complex programs
 Not considering all possible input combinations
 What strategies can you use to avoid these mistakes?
Practice: Creating a Trace Table
 Let's practice together!
 Program:
 x = 5
 y = 0
 while x > 0:
 y = y + x
 x = x - 1
 Create a trace table for this program
 What is the final value of y?

More Related Content

Similar to TRACE TABLES in Computer Science and Technology.pptx (20)

PPTX
DA lecture 3.pptx
SayanSen36
PDF
Chapter 1
afifahnailah
PPT
Problem Solving Techniques
Ashesh R
PPT
Chapter 2.2 data structures
sshhzap
PPTX
Arrays in Java
Abhilash Nair
PDF
GE3151_PSPP_All unit _Notes
Guru Nanak Technical Institutions
PPT
Error Correction Techniques
Kelly Bauer
DOCX
Unit 2 Modeling of Programs A function maps inputs to out.docx
dickonsondorris
PDF
Python Programming Unit 2 - Introduction
priyanshi25121980
PDF
2 debugging-c
Subhashis Pradhan
PPTX
Presentation 1 on algorithm for lab progress
manjudarshan8543
PPTX
SYSTEM DEVELOPMENT
nhlamulo vincent rivele
PPTX
FDS Unit I_PPT.pptx
sayalishivarkar1
PPS
Learn C
kantila
PPTX
Problem Solving PPT 際際滷s Grade 10- 11students
chamm5
PPT
codingtechniques1.ppt
azida3
DOCX
PROBLEM SOLVING
shahzadebaujiti
PDF
Problem solving using computers - Unit 1 - Study material
To Sum It Up
PPTX
Algorithm.pptx
Koteswari Kasireddy
PPTX
Algorithm.pptx
Koteswari Kasireddy
DA lecture 3.pptx
SayanSen36
Chapter 1
afifahnailah
Problem Solving Techniques
Ashesh R
Chapter 2.2 data structures
sshhzap
Arrays in Java
Abhilash Nair
GE3151_PSPP_All unit _Notes
Guru Nanak Technical Institutions
Error Correction Techniques
Kelly Bauer
Unit 2 Modeling of Programs A function maps inputs to out.docx
dickonsondorris
Python Programming Unit 2 - Introduction
priyanshi25121980
2 debugging-c
Subhashis Pradhan
Presentation 1 on algorithm for lab progress
manjudarshan8543
SYSTEM DEVELOPMENT
nhlamulo vincent rivele
FDS Unit I_PPT.pptx
sayalishivarkar1
Learn C
kantila
Problem Solving PPT 際際滷s Grade 10- 11students
chamm5
codingtechniques1.ppt
azida3
PROBLEM SOLVING
shahzadebaujiti
Problem solving using computers - Unit 1 - Study material
To Sum It Up
Algorithm.pptx
Koteswari Kasireddy
Algorithm.pptx
Koteswari Kasireddy

Recently uploaded (20)

PDF
Chardham Yatra Package From Your City.pdf
EpicYatra
PPTX
...........................................
TarannumJindal1
PDF
Top 7 Things to Do in Dubai for First-Time Indian Visitors
teamridge77
PDF
top-notch taxi services for an unforgettable Amritsar tour- new chandigarh tr...
New chandigarh Travels
PDF
Travel Portal Development APIs: Features, Benefits
Travel Portal Development
PDF
Pune to Nashik Cab | Pune to Nashik Taxi
Cab Bazar
PDF
Chardham Yatra by Helicopter 2025: Whats New?
EpicYatra
PDF
Corporate Visa Support for Global Events 2025 Complete Assistance Guide
ajitmanewgblindia
DOCX
PACAYA SAMIRIA NATIONAL RESERVE PERU WORLD
DeanT800
PDF
Rajasthan Like Never Before: Best Rajasthan Tour Packages for Every Budget & ...
Rajasthan Tours India
DOCX
NAUTA TOURIST ATRACTIONS LIVES AND TRIPS.docx
DeanT800
PDF
Affordable Chandigarh to Manali Cab Service 24/7 Available
GtbTravels34
PDF
Chennai to Bangalore Cab | Chennai to Bangalore Taxi
Cab Bazar
PDF
Delhi to Mussoorie Cab | Delhi to Mussoorie Taxi
Cab Bazar
PPTX
amrit udyan rashtrapati bhawan travel presentation
sachdevaa284
DOCX
Preparation for Langtang Valley Trek.docx
Haven Holidays Pvt. Ltd.
PPTX
Travel Instructional Presentation 2.0.pptx
guadalupealvarez401
PDF
Corporate Visa Sponsorship Letter Format Guide with Sample 2025
ajitmanewgblindia
PDF
Wayanad The Best Kept Secret of Kerala Tourism.pdf
GoGeo Holidays
PPT
beauty of sri lanka places and other related things.ppt
KulanjithDeAlwis1
Chardham Yatra Package From Your City.pdf
EpicYatra
...........................................
TarannumJindal1
Top 7 Things to Do in Dubai for First-Time Indian Visitors
teamridge77
top-notch taxi services for an unforgettable Amritsar tour- new chandigarh tr...
New chandigarh Travels
Travel Portal Development APIs: Features, Benefits
Travel Portal Development
Pune to Nashik Cab | Pune to Nashik Taxi
Cab Bazar
Chardham Yatra by Helicopter 2025: Whats New?
EpicYatra
Corporate Visa Support for Global Events 2025 Complete Assistance Guide
ajitmanewgblindia
PACAYA SAMIRIA NATIONAL RESERVE PERU WORLD
DeanT800
Rajasthan Like Never Before: Best Rajasthan Tour Packages for Every Budget & ...
Rajasthan Tours India
NAUTA TOURIST ATRACTIONS LIVES AND TRIPS.docx
DeanT800
Affordable Chandigarh to Manali Cab Service 24/7 Available
GtbTravels34
Chennai to Bangalore Cab | Chennai to Bangalore Taxi
Cab Bazar
Delhi to Mussoorie Cab | Delhi to Mussoorie Taxi
Cab Bazar
amrit udyan rashtrapati bhawan travel presentation
sachdevaa284
Preparation for Langtang Valley Trek.docx
Haven Holidays Pvt. Ltd.
Travel Instructional Presentation 2.0.pptx
guadalupealvarez401
Corporate Visa Sponsorship Letter Format Guide with Sample 2025
ajitmanewgblindia
Wayanad The Best Kept Secret of Kerala Tourism.pdf
GoGeo Holidays
beauty of sri lanka places and other related things.ppt
KulanjithDeAlwis1
Ad

TRACE TABLES in Computer Science and Technology.pptx

  • 2. Introduction to Trace Tables A tool for tracking variable values during program execution Helps understand program flow and identify errors Consists of variable names as column headings and values in cells One row for each pass or iteration of the program
  • 3. Components of a Trace Table Column headers: Variable names (identifiers) Rows: Each pass or iteration of the program Cells: Values of variables at each step Additional columns can include line numbers or conditions Why do you think tracking variables is important in programming?
  • 4. Creating a Trace Table: Step 1 Identify all variables in the program Create column headers for each variable Add a column for line numbers if needed Example variables: count, sum, average
  • 5. Creating a Trace Table: Step 2 Go through the program line by line Update variable values in each row as they change Note any conditions or decisions made How might this process help in debugging a program?
  • 7. Example: Simple Counting Loop Program: Trace a program that counts from 1 to 5 and prints the count. START Declare count as integer count = 0 While count < 5: print(count) count = count + 1 ENDWHILE STOP (continues until count = 5)
  • 8. Example: Simple Counting Loop Step 1 Count 1 0 2 1 3 2 4 3 5 4
  • 9. Example: Calculating Average Program:Trace a program that finds the sum and average of numbers from 1 to 4 START Declare sum,count as integer sum = 0 for i =1 to 4 do sum = sum + i average = sum / 3 ENDFOR STOP
  • 10. Example: Calculating Average | i | sum | average 1 0 0 2 1 .33 3 3 1 4 6 2
  • 11. X Y
  • 13. Common Mistakes to Avoid Forgetting to update all variables in each row Misinterpreting logical operations in truth tables Skipping steps in complex programs Not considering all possible input combinations What strategies can you use to avoid these mistakes?
  • 14. Practice: Creating a Trace Table Let's practice together! Program: x = 5 y = 0 while x > 0: y = y + x x = x - 1 Create a trace table for this program What is the final value of y?