Session XP: 0
Spec 1.2, 6.1 – 6.4Paper 1 and Paper 2

Programming Concepts

Variables, constants, data types, sequence, selection, iteration, subprograms. Pseudocode questions and trace tables require these.

—
Best score
—
Last attempt
Best attempt progress
0
XP earned
Watch first — Craig 'n' Dave
Craig 'n' Dave · Edexcel 1CP2Introduction to programming concepts (10:14)
Craig 'n' Dave · Edexcel 1CP2Identifying errors and suggesting fixes (4:32)
Craig 'n' Dave · Edexcel 1CP2Program maintenance techniques (3:55)
Craig 'n' Dave · Edexcel 1CP2How to identify syntax and logic errors (10:32)
Craig 'n' Dave · Edexcel 1CP2Evaluating a program for purpose & efficiency (7:45)
Craig 'n' Dave · Edexcel 1CP2The use of variables, constants and assignments (10:53)
Craig 'n' Dave · Edexcel 1CP2The use of the three basic programming constructs (7:01)
Craig 'n' Dave · Edexcel 1CP2User input and display output (6:28)
Craig 'n' Dave · Edexcel 1CP2Data validation (15:14)
Craig 'n' Dave · Edexcel 1CP2Simple authentication routines (10:57)
Key facts

Core constructs — fill in the table

TermDescription
Sequence
Selection
Iteration
Variables
Constants
Exam wording (constants)

Advantages of constants

  • Less likely to be accidentally changed → more robust programs
  • If the value needs updating, only ONE change needed (where the constant is defined)
  • Makes code easier to read — a meaningful name is more readable than a "magic number"
  • Example: MAX_SPEED = 70 is clearer than using 70 throughout the code

Input validation and error types — fill in the table

Error typeDescription
Syntax error
Runtime error
Logic error
Exam wording (syntax error)
Boolean values

Validation (spec 6.4.3) — fill in the table

CheckWhat it does
Presence check
Length check
Range check
Pattern check
Limit of validation

Authentication (spec 6.4.4) — fill in the table

IdeaDetail
Why
ID and password
Lookup
Failed attempts

Readability and maintenance (spec 6.1.4) — fill in the table

TechniqueWhy it helps
Layout and indentation
Comments
Meaningful identifiers
White space
Benefit

Finding and testing errors (spec 1.2.5, 6.1.5, 6.1.6) — fill in the table

IdeaDetail
Syntax error
Runtime error
Logic error
Test data
Evaluating
Exam questions — 8 questions · 16 marks · from real 1CP2 past papers
1 markSyntax errorPaper 1 · spec 1.2.5 (1CP2 Jun 2024 Q1(d)(i) style)

What is a syntax error?

A A program that runs but produces the wrong answer
B A program that crashes when dividing by zero
C Code that violates the grammar or rules of the programming language
D A variable that contains the wrong data type
1 markConstant vs variablePaper 2 · spec 6.3.2 (1CP2 Specimen Q5(c) style)

Why should a programmer use a constant instead of a variable to store the value of pi (3.14159)?

A Constants are stored faster by the CPU
B Constants use less memory than variables
C Pi should never change during the program — using a constant prevents accidental modification and if the value ever needs updating, only one change is required
D Variables cannot store decimal numbers
4 marksDescribe iteration typesPaper 1 · spec 1.2.1

Describe the difference between a FOR loop and a WHILE loop. Give an example situation where each would be most appropriate. (4 marks)

Hint: Cover: how each loop is controlled (count vs condition) + when each is appropriate. Two marks per loop type.
+40 XP
2 marksError type identificationPaper 1 · spec 1.2.5 (1CP2 Jun 2024 Q1(d)(ii) style)

A program contains the following code: result = 10 / userInput Explain what type of error occurs if the user enters 0, and why the program behaves as it does. (2 marks)

Hint: Name the error type (runtime) AND explain WHY — what makes this impossible for the CPU to execute.
+20 XP
1 markValidationPaper 2 · spec 6.4.3

A program rejects any password with fewer than 8 characters. Which validation check is this?

A Presence check
B Length check
C Range check
D Pattern check
3 marksRange check in PythonPaper 2 · spec 6.4.3

Write Python that asks for an age and keeps asking until the age entered is from 11 to 16 inclusive. (3 marks)

Hint: Convert the input to a number, then loop while the age is outside the range.
+30 XP
3 marksAuthenticationPaper 2 · spec 6.4.4

The lists ids = ["ava", "ben"] and passwords = ["tiger", "lion"] hold the users, so passwords[0] belongs to ids[0]. Describe, or write the Python for, a log-in check that grants access only to a valid ID and password. (3 marks)

Hint: Ask for both, find the position of the ID, compare the matching password.
+30 XP
1 markReadabilityPaper 2 · spec 6.1.4

Which of these makes a program easier to read and maintain?

A Using single-letter names such as x and y
B Writing everything on as few lines as possible
C Adding comments and meaningful variable names
D Removing all the blank lines
Quick recall flashcards

Module complete! 🎉

Score loading...

⚡ +10 XP