2.2-2.3 Flashcards
What is an integer
Whole number
Int
What is a real/float
Numbers with decimals
real
What is a Boolean
Can take one of two values(true/false)
bool
What is a character
Single letter,number or symbol
char
What is a string
Text
string
What do strings and characters always need when coding
Speech marks
Advantages of data types
Make code more memory efficient, robust and predictable
What is casting and give an example of coding
Converting between data types
real(1) converts integer to real 1.0
What do arithmetic operators do, what data types do they work on and give an example
Take two values and perform maths functions on them
Work on real or integer values
DIV and MOD
What is DIV
Returns while number of the division
What is MOD
Returns remainder of the division
What do assignment operators do and give an example
Assign values to constants or variables
What are comparison operators and give an example
Compare value from left to right side to produce a Boolean value(true/false)
What is a constant
Assigned the data value at design time and can’t be changed while running
What is a variable
Can change values
What is concatenation
Joining two strings together to form a new string using the + operator
Code to put all character to upper or lower case
X.upper
X.lower
Code to get the number of characters in a string
X.length
Code to extract the first I characters from a string or last I characters
X.left(I)
X.right(I)
Code to extract a string starting at a with length b
X.substring(a,b)
Code to get a random number
X = random(1,6)
What is a one dimensional array and give code
List
Family = [“jess”, “Alice”]
What is a two dimensional array
Table
How to open a file
File = open(“file.txt”)