6.2.1

Inputs & Outputs

Test yourself

Thinking Ahead

Problem-solving in computer science involves planning for inputs, outputs, and conditions, using tools like caching and reusable components.

Illustrative background for Identifying inputs and outputsIllustrative background for Identifying inputs and outputs ?? "content

Identifying inputs and outputs

  • When solving a problem in computer science, it is important to first identify what goes into the system and what comes out.
  • Inputs are the data that the program receives.
  • Outputs are the results that the program produces.
    • In a simple calculator program, the inputs would be numbers and operations like addition or subtraction.
    • The outputs would be the results of these calculations.
Illustrative background for Determining preconditionsIllustrative background for Determining preconditions ?? "content

Determining preconditions

  • Preconditions are the conditions that need to be true before a program or algorithm can run correctly.
  • These are important because they help ensure that the program works as expected.
    • In a program that divides two numbers, a precondition might be that the second number (the divisor) cannot be zero.
  • Without this check, the program could crash or give incorrect results.
Illustrative background for CachingIllustrative background for Caching ?? "content

Caching

  • Caching is a technique used to speed up computer processes by storing frequently accessed data in a faster memory location.
    • This can reduce the time it takes to retrieve data from a slower storage medium, such as a hard drive.
  • A good example of caching is web browsers storing parts of a webpage so that when the user revisits the page, it loads faster.
  • The drawback of caching is that the stored data can become outdated, leading to incorrect results if the data is not refreshed.
Illustrative background for Reusable program componentsIllustrative background for Reusable program components ?? "content

Reusable program components

  • Reusable program components are parts of a program that can be used in multiple places without rewriting the code.
  • These components make coding more efficient and reduce errors because programmers can rely on tried and tested code.
  • A function that calculates the area of a rectangle could be reused whenever this calculation is needed.
    • This saves time and ensures consistency.

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Ahead

6.3Thinking Procedurally

6.4Thinking Logically

6.5Thinking Concurrently

7Problem Solving & Programming

8Algorithms

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium