levo

Fundamentals of Programming

Programming concepts and program structure

  • 3 things to know
  • Paper 1

Overview

Recall questions on the three combining principles of imperative languages, and on declaration, assignment, selection, iteration and subroutines as statement types.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Process

What are the three combining principles on which all imperative programming languages are built?

Numbers

Define indefinite iteration.

Key term

You need to keep asking the user for a password until the correct one is entered. Which position of the condition suits this, and why?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What are the three combining principles on which all imperative programming languages are built?

    Model answer

    Sequence, in which statements are carried out one after another in the order written; iteration or repetition, in which a block of statements is carried out repeatedly; and selection or choice, in which a block is carried out only when a condition is met. Every imperative program is built by combining these three.

  2. 2

    What does a variable declaration do?

    Model answer

    It introduces an identifier and states its data type, so that memory is reserved for it and the translator knows how to interpret and check its use. In some languages a variable is declared explicitly before use; in others it is created implicitly the first time it is assigned to.

  3. 3

    What does a constant declaration do?

    Model answer

    It gives a name to a fixed value that is set when the program is written and cannot be changed while the program runs, for example CONST VAT = 0.2. Any later attempt to assign to it is rejected by the translator.

  4. 4

    Explain what an assignment statement does.

    Model answer

    It stores a value in a variable. The expression on the right-hand side is evaluated first and the resulting value is copied into the variable named on the left, overwriting whatever it held before. This is why count = count + 1 is perfectly sensible as an assignment even though it is nonsense as an equation.

  5. 5

    What does an iteration statement do?

    Model answer

    It causes a block of statements to be executed more than once, either a set number of times or until a condition is met, without that block having to be written out repeatedly.

  6. 6

    What does a selection statement do?

    Model answer

    It chooses between alternative blocks of statements according to whether a condition is True or False, using structures such as IF, IF...ELSE, or a CASE/SWITCH statement that selects one branch from many according to the value of an expression.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A driver is .
softwarehardwarestorage

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AThe integer 5 is 0101.
B0.75 is 1/2 + 1/4.
CThe fraction bits are 1100.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

Head means the first single element of a non-empty list.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Fundamentals of Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.