Section Five - Programming Flashcards
True or False?
Programming languages have SIX main data types.
False
Programming languages have FIVE main data types.
Name the main data types:
Integer Real (or float) Boolean Character String
What is the characteristic of an integer?
Whole numbers only
What is the characteristic of a real/float?
Numbers that have a decimal part
What is the characteristic of a boolean?
Can only take one of two values, usually TRUE or FALSE
What is the characteristic of a character?
A single letter, number, symbol.
What is the characteristic of a string?
Used to represent text, it is a collection of characters
How much memory does an INTEGER typically take up?
2 or 4 bytes
What data type typically takes up 4 or 8 bytes?
Real
How much memory does a BOOLEAN typically take up?
1 bit is needed but 1 byte is actually used
What data type typically takes up 1 byte?
Character
How much memory does a STRING typically take up?
1 byte for every character in the string
What is used to change data types?
Casting
What does the operator ‘==’ mean?
Equal to
What symbol means ‘not equal to’?
!=
What does the operator ‘<=’ mean?
smaller than or equal to
What is the operator ‘=’ used for?
Is used to assign values to constants or variables
What is a constant?
An assigned data value that CAN’T be changed while the program is running
What is a variable?
An assigned data value that CAN be changed while the program is running
What is a string written inside?
Quotation marks
What is concatenation?
Joining strings together to form new strings.
How are the characters in a string numbered?
They are numbered numerically, starting at 0.
What does the function x.upper do?
Changes all characters in string x to upper case
What function would turn all the characters in string x to lower case?
x.lower
What does the function x.length do?
Returns the number of characters in string x.
What function extracts the character in position i from string x?
x[i]
What does the function x.subString(a,b) do?
Extracts a string starting at position a with length b from string x
What structure do IF statements usually follow?
IF-THEN-ELSE
What do IF statements allow you to do?
Check if a condition is true or false and carry out different actions depending on the outcome
What do IF-ELSEIF statements allow you to do?
Check multiple conditions.
Finish the Sentence:
FOR loops are an example of…
…a Count-Controlled Loop.
Finish the Sentence:
SWITCH-CASE statements check the…
…value of a Variable
What are loops controlled by?
Conditions
/What are the three types of loops
Repeat loops
While loops
Do while loops
What are three Boolean operators?
AND
OR
NOT
Where can Boolean operators be used?
In conditions
What are Arrays used for?
To store multiple data values
What is each piece of data in an array called?
An element
How can elements be accessed in an array?
By using its position/index in the array
True or False?
One-dimensional arrays are like lists.
True
What are you allowed to do when you open a file in READ mode?
Read data from the file into your program
What do Databases do?
Organise data into fields and records
What are Databases managed by?
SQL - standard query language
What are the two most important keywords in SQL?
SELECT and FROM
What is the purpose of WHERE in SQL statements?
To filter the results
What are Procedures?
Sets of instructions stored under one name
What are Functions?
Sets of instructions that always return a value
True or False?
Global Variables can only be used within the structure they’re declared in.
False.
Global Variables can be used any time after their declaration.
True or False?
Local Variables can be used any time after their declaration.
False
Local Variables can only be used within the structure they’re declared in.