T2B programming

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/40

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:14 PM on 8/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

41 Terms

1
New cards

What do subroutines allow?

Allows code that you intend to use multiple times to be grouped together under 1 name

2
New cards

Examplse of subroutines

functions and procedures

3
New cards

What does a function do that procedures don't?

Functions will return a value after processing has taken place

4
New cards

pseudocode of a subroutine

SUBROUTINE subroutineName(parameters)... ENDSUBROUTINE

5
New cards

why use subroutines?

Break up large programs into self-contained units

Each subroutine can be tested separately to make sure it works correctly

Cuts down development time: many programmers can work on a large program at the same time

Subroutines can be re-used in other programs

Subroutines can be stored in a subroutine library and used in different programs

Program maintenance is easier: if requirements change then just the affected subroutines need to be modified

6
New cards

what is the scope of a variable/constant/procedure/function?

parts of the program in which it is recognised and can be used/the specific region of a program where a variable, function, or object is visible, accessible, and can be referenced.

7
New cards

local variable definition

Local variable = variable created in a subroutine

8
New cards

local variable parameters?

Only exist while subroutine is executing, Only accessible withing the subroutine

9
New cards

global variable definition?

variable created outside a subroutine

10
New cards

'parameters' of a global variable?

accessible anywhere in the program

11
New cards

pseudocode of a global variable

global variablename

12
New cards

advantages of using local variables

Keeps a subroutine self-contained --> can be used in any program without variable names conflicting with those used in the calling program

Easier to debug program: value of that variable can only be read or changed within one subroutine

Memory efficiency: once a subroutine has finished running, the memory used for all local variables is removed

13
New cards

Disadvantages of using local variables

Limited scope

Potential for data redundancy (needing repeated passing)

Short lifetimes: memory freed when function ends - problematic for persistence

14
New cards

Advantages of Using Global Variables

Large scope: can be accessed from any function

Reduced Passing: no need to pass the same variables as parameters between different subroutines

Only needs to be declared once

15
New cards

Disadvantages of Using Global Variables

Harder to debug: any function can change a global variables - finding where a variables was incorrectly updated is difficult

Too many global variables can clutter namespace --> name clashes where local variable might mistakenly override a global one

Memory usage: stay in memory for entire duration of the program

16
New cards

What way should subroutines be written and why?

Should be written in a modular way so that they can be reused multiple times in the program or by other programs

17
New cards

What should well documented modules/subroutines show?

The parameters that the subroutines take, what they are used for and what data types are needed

Purpose of the subroutine

Return value and its data type

18
New cards

Advantages to structure programming

Modularised approach - breaks down programs into manageable chunks of code

Helps to decompose larger problems

Programmers only need to use the interfaces of subroutines = parameters and return values

Don't need to worry about internal workings of each subroutine

Fewer bugs + easier to maintain

19
New cards

What do data validation routines ensure?

ensure that data entered is of the right type (i.e. data type)

20
New cards

what can't validation make sure of?

Validation can't make sure that the user hasn't entered a wrong value/make a spelling mistake in a name

21
New cards

what can validation only ensure?

Can only ensure that data is reasonable and conforms to a set of rules

22
New cards

what is a range check?

checking data is between 2 values

23
New cards

what is a type check?

Data is of the right type, e.g. integer/letter/text

24
New cards

what is a length check?

Text entered isn't too long/short

25
New cards

what is a presence check?

Checks that data has been entered - field hasn't been left blank

26
New cards

what is a format check?

Checks that the format of, e.g., a postcode/email address is correct

27
New cards

what is an authentication routine

a routine to check that a user enters a valid username and password

28
New cards

validation definition

checking that data is reasonable

29
New cards

verification definition

double checking data from an alternative source or re-typing it

30
New cards

Ways to make Programs Easier to Understand

Comments at the top to show who wrote the program and when they wrote it

Comments to explain what harder parts of the code do

Each subroutine (function or procedure) should have comments to explain their functionality

Use meaningful variable names

Use subroutines/ a modular structure

Meaningful identifiers

31
New cards

What are trace tables used for?

Used to determine the outputs from a program as it runs

Enable a programmer to find errors in their programs

Can be used to find the purpose of a flowchart/pseudocode

32
New cards

what are syntax errors?

an error where the code written doesn't conform to the rules of the language

33
New cards

wat are logical errors? + description if code run

remaining error is a logical error, Program will run, but won't work as programmer intended

34
New cards

what is a test plan?

a structured document created during the design phase to ensure software meets requirements

35
New cards

what is used in normal data testing?

Uses typical/expected/valid inputs

36
New cards

What does normal data testing check?

Checks if a program works correctly under everyday conditions

37
New cards

what is used in boundary data testing?

Checks edges of valid input ranges and values just outside them (by 1)

38
New cards

what does boundary data testing ensure?

Ensures a program correctly accepts valid limits and rejects invalid ones, preventing errors/making software robust

39
New cards

what is used in erroneous data testing?

Uses incorrect/unexpected inputs (e.g. symbols, strings, negative numbers)

40
New cards

what does erroneous data testing ensure?

Ensures it doesn't crash + provides useful error messages, rather than processing bad data

41
New cards

How to find logical errors

Trace table: useful for tracing through a program in order to find a logic error

Value of each variable recorded as it changes

OUTPUT statements at various points in the program to check the values of variables