Skip to main content

Section 1.5 More About Programs

A program is a sequence of instructions that specifies how to perform a computation. The computation might be something as complex as rendering an html page in a web browser or encoding a video and streaming it across the network. It can also be a symbolic computation, such as searching for and replacing text in a document or (strangely enough) compiling a program.
The details look different in different languages, but a few basic instructions appear in just about every language.
Get data from the keyboard, a file, or some other device.
Display data on the screen or send data to a file or other device.
math and logic
Perform basic mathematical operations like addition and multiplication and logical operations like and, or, and not.
conditional execution
Check for certain conditions and execute the appropriate sequence of statements.
Perform some action repeatedly, usually with some variation.
Believe it or not, that’s pretty much all there is to it. Every program you’ve ever used, no matter how complicated, is made up of instructions that look more or less like these. Thus, we can describe programming as the process of breaking a large, complex task into smaller and smaller subtasks until the subtasks are simple enough to be performed with sequences of these basic instructions.
Check your understanding

Checkpoint 1.5.1.

    A program is:
  • a sequence of instructions that specifies how to perform a computation.
  • It is just step-by-step instructions that the computer can understand and execute. Programs often implement algorithms, but note that algorithms are typically less precise than programs and do not have to be written in a programming language.
  • something you follow along at a play or concert.
  • True, but not in this context. We mean a program as related to a computer.
  • a computation, even a symbolic computation.
  • A program can perform a computation, but by itself it is not one.
  • the same thing as an algorithm.
  • Programs often implement algorithms, but they are not the same thing. An algorithm is a step by step list of instructions, but those instructions are not necessarily precise enough for a computer to follow. A program must be written in a programming language that the computer knows how to interpret.
You have attempted of activities on this page.