hts.StevenWood.com

Activity 3-2

Home ] Up ] Activity 3-1 ] [ Activity 3-2 ] Activity 3-3 ][ Last Page ]

Labs
Check List

Investigating Math and Text Subroutines

Unit 3  Activity 2

Time:  240 minutes

Description

Students explore pre-defined mathematical and text subroutines made available by their programming software. Through a series of lab exercises, students practise using these pre-defined subroutines and reflect on how they could be used to help solve a larger programming problem.

Strand(s) & Learning Expectations  

Strand(s): 

A. Programming Concepts and Skills  B. Software Development  C. Computer Environments and Systems  D. Topics in Computer Science

Overall Expectations
A1. demonstrate the ability to use different data types, including one-dimensional arrays, in computer programs;
A2. demonstrate the ability to use control structures and simple algorithms in computer programs;
A3. demonstrate the ability to use subprograms within computer programs;
A4. use proper code maintenance techniques and conventions when creating computer programs.
B1. use a variety of problem-solving strategies to solve different types of problems independently and as part of a team;
B2. design software solutions to meet a variety of challenges;
B3. design algorithms according to specifications;
Specific Expectations
A1.1 use constants and variables, including integers, floating points, strings, and Boolean values, correctly in computer programs;
A1.3 use assignment statements correctly with both arithmetic and string expressions in computer programs;
A1.4 demonstrate the ability to use Boolean operators (e.g., AND, OR, NOT), comparison operators (i.e., equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to), arithmetic operators (e.g., addition, subtraction, multiplication, division, exponentiation, parentheses), and order of operations correctly in computer programs;
A2.1 write programs that incorporate user input, processing, and screen output;
A2.2 use sequence, selection, and repetition control structures to create programming solutions;
A2.3 write algorithms with nested structures (e.g., to count elements in an array, calculate a total, find highest or lowest value, or perform a linear search).
A3.1 demonstrate the ability to use existing subprograms (e.g., random number generator, substring, absolute value) within computer programs;
A4.1 demonstrate the ability to identify and correct syntax, logic, and run-time errors in computer programs;
A4.2 use workplace and professional conventions (e.g., naming, indenting, commenting) correctly to write programs and internal documentation;
A4.3 demonstrate the ability to interpret error messages displayed by programming tools (e.g., compiler, debugging tool), at different times during the software development process (e.g., writing, compilation, testing);
A4.4 use a tracing technique to understand program flow and to identify and correct logic and run-time errors in computer programs;
A4.5 demonstrate the ability to validate a program using a full range of test cases.
B1.1 use various problem-solving strategies (e.g., stepwise refinement, divide and conquer, working backwards, examples, extreme cases, tables and charts, trial and error) when solving different types of problems;
B1.2 demonstrate the ability to solve problems independently and as part of a team;
B1.3 use the input-process-output model to solve problems.
B2.1 design programs from a program template or skeleton (e.g., teacher-supplied skeleton, Help facility code snippet);
B2.2 use appropriate vocabulary and mode of expression (i.e., written, oral, diagrammatic) to describe alternative program designs, and to explain the structure of a program;
B2.3 apply the principle of modularity to design reusable code (e.g., subprograms, classes) in computer programs;
B3.1 design simple algorithms (e.g., add data to a sorted array, delete a datum from the middle of an array) according to specifications;
B3.2 solve common problems (e.g., calculation of hypotenuse, determination of primes, calculation of area and circumference) by applying mathematical equations or formulas in an algorithm;
B3.3 design algorithms to detect, intercept, and handle exceptions (e.g., division by zero, roots of negatives).
B4.4 use a test plan to test programs (i.e., identify test scenarios, identify suitable input data, calculate expected outcomes, record actual outcomes, and conclude ‘pass’ or ‘fail’) by comparing expected to actual outcomes;
B4.5 use a variety of methods to debug programs (e.g., manual code tracing, extra code to output the state of variables);

Students:

  • are aware of mathematical functions (round, sqrt, sin, cos, tan, etc.);

  • are aware of spreadsheet applications;

  • write programs that accept input from users, process data using formulas, and display results;

  • are able to debug programs containing syntax and logic errors;

  • identify string as a variable data type;

  • recognize the ASCII table of values representing keyboard characters.

Planning Notes

  • Make connections to problem-solving strategies previously introduced.

  • Provide on-line and/or print resources for shared use by students.

  • Gather material about mathematical functions and built-in functions in items such as calculators, spreadsheets, and word processors for comparison.

Teaching/Learning Strategies

  • Introduce/review the “divide and conquer” problem-solving strategy; brainstorm large problems currently facing students (e.g., ISU completion) and how this task could be divided into smaller, more manageable sub-problems.

  • Facilitate discussion on how this strategy can be applied to programming (e.g., how it may help to tackle the daunting task of creating a major programming solution such as a spreadsheet application).

  • Present examples (in the form of handouts, overheads, or web-based presentation) of pre-defined subroutines provided in the programming language used.

  • Emphasize the important task of the programmer to research built-in tools available to them.

  • Students use on-line help and/or print resources to find and investigate usefulness of pre-defined mathematical subroutines, e.g., a pre-defined subroutine written to perform any/all of these tasks:

  1. round any value to a specified number of decimal places;

  2. find the square root of a value;

  3. generate a random integer between any lower/upper parameters specified;

  4. calculate payment for a bank loan (given the interest rate, term of loan, and principal amount).

  5. count the length of a string;

  6. produce a string of repeating characters (e.g., ten asterisks);

  7. change the case of characters in a string (lowercase/uppercase/proper);

  8. find the position of a specified character within a string;

  9. return a substring of a specified length from the beginning, end, or specified starting position of a longer string;

  10. return the position of a specified substring from within a longer string.

  • Demonstrate built-in subroutines of type function and subroutines of type procedure; ask students to identify differences between the two types of subroutines,

e.g.,

sqr(variable)

vs.

Circle (x, y), radius

 

length(variable)

 

Line (x, y)

  • Solicit responses from students and verify that functions return a value vs. procedures, which perform a series of steps but do not return a value. Demonstrate the use of variable tracking or desk tracing.

  • Students record new tools and strategies in a journal or notes.

  • Students complete as many lab exercises (Appendix 3.2.1) as possible in time allotted.

  • Use loops:

Assessment & Evaluation of Student Learning

Thinking/Inquiry X Application X Communication X Knowledge X

As Learning

Students will be given time to:

  • reflect on their progress/ understanding/areas of concern based on teacher/student/peer suggestions (e.g. after test take up)
  • journalize their reflections
  • reflect on the work of others

For Learning

The teacher will

  • observe student progress/performance
  • ask questions based on student work
  • check homework correctness/completion when appropriate
  • review formative quiz results

Of Learning

The teacher and students gather assessment information based on specific expectations outlined for this activity, including:

  • a formative assessment of the assigned work in the form of roving conferences;

  • a peer and self-evaluation of the students’ work, using a checklist of criteria created by the teacher and/or students (Appendix 3.2.4);

  • a summative assessment in the form of a quiz.

Accommodations

The following are ways in which the activity can be adapted to accommodate exceptional students’ needs:

  • provide print copies of subroutines and specific vocabulary new to students;

  • draw/chart investigation findings to assist students in multi-faceted task;

  • selectively pair/group students to assist with recording results (i.e., classifying and investigating);

  • provide “scaffolded” programs (i.e., program listings with subroutine headings, loop structures, etc. already included) to help struggling students;

  • use peer/mentor support for recording results and journal entries.

Resources

  • Installed help files and/or manuals for the programming language in use.

 

Source: Public and Catholic District School Board Writing Partnership Course Profile: Computer and Information Science, Grade 11, University/College Preparation ICS3U, Queen’s Printer for Ontario, 2001, adapted.

Home ] Up ] Activity 3-1 ] [ Activity 3-2 ] Activity 3-3 ][Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+