T2A Programming Basics

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

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:11 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

54 Terms

1
New cards

Why do we have different data types?

So code is memory efficient, robust (hard to break) and predictable

2
New cards

What are integers + memory size

Whole numbers, 2 bytes

3
New cards

What are floats/real + memory size

Whole number with decimal part, 4 bytes

4
New cards

What is a character + memory size

A single ASCII character, 1 byte

5
New cards

What is a string + memory size

Zero or more characters - inside quote marks, 1 byte per character

6
New cards

What is a boolean + memory size

Values of True or False, just one bit put high level languages 1 byte

7
New cards

How to define constants in pseudocode

Shown in uppercase

8
New cards

Why use a constant instead of variable

Prevents value from being changed accidentally in code, whos programmer value should stay the same throughout the program

9
New cards

What does concatenating mean?

Joining together

10
New cards

What is casting?

Functions used to convert data types

11
New cards

Why is casting used?

Different data types are represented differently in binary

12
New cards

Function to convert data types - pseudo code

DATATYPE1_TO_DATATYPE2(datatype1), CHAR, CODE, STRING, INT

13
New cards

What does CHAR_TO_CODE('a') do?

Gives 97 - evaluates to the number using ASCII

14
New cards

What does len(string) do?

Gives length of the string

15
New cards

What does SUBSTRING(start/index1, end/index2, string) do?

Will output the part of the string which starts at index1 letter and ends with index2 letter

16
New cards

How to find the position of a character in a string? Pseudocode

POSITION(string, character)

17
New cards

How make a string uppercase - pseudocode?

UPPERCASE(string) or string.UPPER_CASE

18
New cards

Definition of sequence?

the statements are executed one by one in the order they are written in

19
New cards

Definition of selection?

The next statement is executed depending on whether the condition being tested is True or False

20
New cards

What are nested if statements?

If statements inside another if statement

21
New cards

What are AND, OR and NOT called?

Boolean expressions

22
New cards

What does AND do?

Returns true if both conditions are true

23
New cards

What does OR do?

Returns true if either of the conditions are true

24
New cards

What does NOT do?

Switches the expression from True to false and vice versa

25
New cards

How to generate random numbers - pseudocode?

Import random

RANDOM_INT(num1, num2)

26
New cards

Definition of iteration

Repetition of a section of code

27
New cards

When are for loops used?

When you want to execute the loop a specified number of times

28
New cards

What iteration are for loops?

Count controlled iteration

29
New cards

When are while loops used?

When you want to execute the loop while a certain condition is true

30
New cards

When is a condition tested in a while loop?

At the beginning of the loop

31
New cards

What type of iteration is a while loop?

A condition controlled loop

32
New cards

For loop pseudocode?

FOR...ENDFOR

33
New cards

While loop - pseudocode?

WHILE...ENDWHILE

34
New cards

When are conditions tested in a repeat until loop

At the end of the loop

35
New cards

Repeat until loop pseudocode?

REPEAT...UNTIL

36
New cards

Definition of array

A data structure that allows you to hold many items of data which is referenced by one identifier

37
New cards

Condition of an array?

All items of data in the array must be the same data type

38
New cards

Advantages of arrays?

You don't have to use lots of variables, can be used in linear search, can be used in bubble sort

39
New cards

Disadvantages of arrays

Have a fixed size, Inefficiency of inserting/deleting items, can be memory inefficient, has to be same data type

40
New cards

How to swap items in a list?

list[0], list[4] = list[4], list[0] (swaps item 0 with item 4)

41
New cards

How to add items to a list?

list.append(item you want to append)

42
New cards

How to define arrays in pseudocode?

array arrayName[number of elements in array at beginning]

INDENT arrayName

43
New cards

How to make a list of 5 ""

list = [""]*5

44
New cards

Definition of a record

a data structure consisting of a number of fields which can all be of different data types

45
New cards

What is a field?

A single item of data in a record

46
New cards

Defining a record called film - pseudocode

RECORD recordName

INDENT fieldName1: data type

INDENT fieldName2: data type

ENDRECORD

47
New cards

Definition of instantiation

New instances of a record structure being made for different things

48
New cards

Instantiation - pseudocode?

newRecord

49
New cards

Updating a record - pseudocode?

recordName.fieldName

50
New cards

What is a Two-dimensional array?

a list made up of lists/lists in a list

51
New cards

How are position of elements represented in two-dimensional arrays? in python

list[a][b] where a = which 1 dimensional array the element is in b = index of which element in 1D array

52
New cards

What does len(listName) do? listName is a 2D array

Finds number of lists in the two-dimensional array

53
New cards

What does len(listName[1]) do? listName is a 2D array

Used to find number of elements in the one dimensional array (highlighted by the index) in the two dimensional array

54
New cards

Which programming language does the index list[a,b] work in?

Python NumPy array