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/32

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:51 PM on 6/12/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

33 Terms

1
New cards

why should you use the correct data type? (3)

  • makes code more memory efficient

  • code is more robust

  • code is more predictable

2
New cards

define casting

changing the data type of a variable to another data type

3
New cards

what does the ASC() function do?

converts a character into its ASCII number

4
New cards

what does the CHR() function do?

converts an ASCII number into its equivalent character

5
New cards

exponentation operator

^ pseudocode ** python

6
New cards

what does MOD do

returns remainder

7
New cards

what does DIV do

removes remainder to return whole number

8
New cards

define variable

named location in memory which can change during the running of the program

9
New cards

what is a constant

an assigned data value that can’t be changed

10
New cards

what would x.left(2) do on the string x=”Hello”

extract the first 2 characters = “He“

11
New cards

what would x.right(3) do on the string x=”Hello”

extract the last 3 characters = “llo”

12
New cards

what would x.subString(2,2) do on the string x=”Hello”

extract the characters starting at position 2 with a length of 2 = “ll”

13
New cards

NOT gate truth table

knowt flashcard image
14
New cards

AND gate truth table

knowt flashcard image
15
New cards

OR gate truth table

knowt flashcard image
16
New cards

differences between arrays and lists (2)

  • arrays store data of the same data type, lists can store data of different data types

  • arrays have a fixed length but lists can change length

17
New cards

array rowers[4]

creates an array called rowers which can hold 4 elements

18
New cards

code to open a file called file.txt stored in a variable myfile for writing

myfile = open(“file.txt”,”w”)

19
New cards

code to open a file called file.txt stored in variable myfile

myfile = open(“file.txt”)

20
New cards

code to close a myfile

myfile.close()

21
New cards

code to read next line of myfile

myfile.readLine()

22
New cards

code to add “hello” to the end of myfile

myfile.writeLine(“hello”)

23
New cards

code to check if at the end of the file

myfile.endOfFile()

24
New cards

code to create a new file called mytext.txt

newFile(“mytext.txt”)

25
New cards

code to print on a new line

\n

26
New cards

are records fixed length or static?

fixed length

27
New cards

problems with flat file databases (3)

  • data redundancy

  • inaccurate data

  • inconsistent data

28
New cards

define procedure

sets of instructions stored under one name which are executed when called.

29
New cards

difference between a function and a procedure

functions return a value, procedures do not return a value

procedures don’t always need a parameter, functions always need at least one parameter

functions must be inside print statements or assigned to variables or the value returned is lost.

#procedure
subject()

#function
subject = favourite(computer)

30
New cards

when are subprograms useful? (3)

  • repeating code

  • better structure and readability of code

  • reduces the amount of code you have to write

31
New cards

what is the difference between an argument and a parameter?

  • parameters are used to pass values into a subprogram

  • arguments are the actual values that parameters take when subprograms are called

# Function definition with parameters
def add(x, y): # x and y are parameters
   return x + y

# Function call with arguments
result = add(5, 3) # 5 and 3 are arguments
print(result) # Output: 8

32
New cards

define local variable

variables that can only be used in the structure they are declared in

33
New cards

define global variable

variables that can be used anywhere after their declaration