Program design questions and answers
Questions
Q1. What is an ‘algorithm’?
Q2. Explain what is meant by pseudo-code being ‘language-independent’?
Q3. What is meant by top-down programming?
Q4. What are the benefits of top-down programming?
Q5. State two other possible names for a ‘module of code’.
Q6. What is meant by unit testing?
Q7. Define ‘integration testing’.
Q8. What is the flowchart symbol for a decision?
Q9. What is the flowchart symbol for a subroutine?
Q10. What is the flowchart symbol for the input or output of data?
Answers
Q1. An algorithm is a description of the solution to a problem e.g. using a flowchart or other diagram, pseudo-code or sentences.
Q2. Pseudo-code once written should be easy to convert into any language by programmers of that language.
Q3. Top-down programming is when you break a complex problem down into smaller and smaller sub-problems. You keep doing this until each sub-problem cannot be broken down further because each one describes just one function or job. You then write a function or procedure for each sub-problem.
Q4. Top-down programming designs promote teamwork as harder modules can be given to more experienced programmers. They make programs easier to understand, make programs easier to debug, mean that functions can be put into libraries and reused in future (saving time and money), mean that a project’s progress can be monitored more easily and promotes easier program maintenance.
Q5. A module of code might be referred to as a subroutine, a function or a procedure.
Q6. Unit testing is when you test a function or procedure in isolation from other functions or procedures. You may have to use dummy data or ‘stubs’ to facilitate testing.
Q7. Integration testing is when you ‘glue’ functions and procedures together to see if they work with each other as intended.
Q8. The flowchart symbol for a decision is a diamond shape: