Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
CompTIA · Tech+ FC0-U71

Programming concepts and logic

Tech+ FC0-U71 · Lesson 13 of 18 · 1:42:05

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Tech+ FC0-U71 exam (CompTIA Tech+). In this lesson: identifiers, variables, and constants, arrays and functions, objects (properties, attributes, methods), and planning code with pseudocode, flowcharts, sequence, branching, and loops, with Oakhaven Library, a fictional public library with three branches, as the running example. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

The reading challenge

This summer, Oakhaven's coding club writes a small program for the reading challenge: it counts the books that each teen reads, and awards a badge at ten books. Even a program this small uses names, lists, functions, and decisions. This lesson walks through the building blocks of a program, and the ways that programmers plan and explain their code.

Identifiers, variables, and constants

An identifier is the name that a programmer gives to something in the code, like a value or a function. A variable is a named value that can change while the program runs: books read starts at zero, and grows by one with each book. A constant is a named value that never changes once it is set, like the badge goal of ten books. Using a constant means that the goal is written in one place, so changing it later takes one edit. Good identifiers describe what they hold, so books read is clearer than x.

Arrays and functions

An array stores a list of values under one name, like the titles of every book that a teen has read. Each value sits at a numbered position, called an index, and in most languages, the first index is zero. A function is a named block of code that does one job, like adding a book to a teen's list. A function can take inputs, called parameters, and it can return a result. Once written, a function can be called from anywhere in the program, so the same code is never copied twice.

Objects

An object groups the data and the actions of one thing in the program, like a book. The properties, or attributes, of an object are the data that describe it: a book's title, its author, and whether it is checked out. The methods of an object are the actions that it can perform, like check out, or return. Object-oriented methods organize a whole program around objects, with each kind of object defined once, and as many objects as needed made from that definition. The club's program has one definition of a teen reader, and one object for each teen who joins.

Planning and documenting code

Pseudocode describes the steps of a program in plain language, shaped like code but without the exact rules of any language, and it is written before the real code. A flowchart draws the same steps as shapes joined by arrows: an oval for the start and the end, a rectangle for a step, a diamond for a decision, and a parallelogram for an input or an output. Comments are notes inside the code, which the computer ignores, to explain to people why the code does what it does. Documentation goes further, with guides that explain how to use the program, and how it works. The club wrote pseudocode first, then drew a flowchart, then wrote the code with comments.

Sequence, branching, and looping

A sequence is the simplest logic: the instructions run in order, one after the other. Branching lets the program choose: if a teen has read ten books or more, award the badge, else show how many books are left. Looping repeats steps: for each book in the list, add one to the count, or keep asking for a title while the teen still has books to enter. A loop needs a way to end, or the program repeats forever. Almost every program combines all three: a sequence of steps, with branches and loops inside.

Recap

Let's recap. Identifiers name things, variables can change, and constants stay fixed. Arrays hold lists of values by index, and functions are named blocks of code, with parameters and a result. Objects have properties, or attributes, and methods, and object-oriented methods build programs from them. Pseudocode and flowcharts plan the code, and comments and documentation explain it. Sequence, branching, and looping are the three building blocks of logic.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. The program must keep the titles of all of the books that one teen has read, in a single list under one name. What should the club use?

    • An array
    • A constant
    • A Boolean
    • A comment
    Show the answer

    An array

    An array stores a list of values under one name, each at its own index. “A constant” would hold one value that never changes, like the badge goal. “A Boolean” would hold only true or false. And “A comment” is a note for people, which the computer ignores.

  2. Before writing any code, the club draws the steps of the program as boxes joined by arrows, with a diamond where the program checks whether the goal is reached. What are they drawing?

    • Pseudocode
    • An array
    • A flowchart
    • A compiler
    Show the answer

    A flowchart

    A flowchart draws the steps as shapes, with a diamond for each decision. “Pseudocode” would describe the steps in plain text, not as a drawing. “An array” is a list of values in the code, not a plan. And “A compiler” is a program that translates code into an executable.

  3. The program must go through every title in a teen’s list, and do the same step for each one. Which logic concept is this?

    • Branching
    • A constant
    • A sequence
    • Looping
    Show the answer

    Looping

    Looping repeats the same steps, for example once for each item in a list. “Branching” would choose between two paths, based on a condition. “A constant” is a value that never changes, not a kind of logic. And “A sequence” would run each instruction once, in order, with no repetition.