2.2 Programming Fundamentals Flashcards
(30 cards)
Integer:
Whole number
Real/float:
Decimal numbers
Boolean:
1 of 2 values, true/false, yes/no, 0/1
Character:
Single letter, number or symbol
String:
Used to represent text, collection of characters
Casting:
Change data type
Arithmetic operators:
Take values and perform mathematical functions on them
Exponentiation:
Raise a number to a power. ^, or **
DIV:
Returns the whole number part of a division. // is used
MOD:
Returns the remainder part after division % is used
Assignment:
Allocate values to constants or variables
Comparison operators:
Compare the expression on left side with expression on right. Boolean value
Constant:
A constant is assigned a data value that can’t be changed as the program runs
Variable:
A location in memory that holds 1 or more values. Has a label to identify it and value can be changed as program runs
String manipulation:
Chars in a string numbered starting at 0. Can use commands giving info about the string or allows you to alter the string
Selection statements(if):
Check if a statement is true or false and carry out different actions depending on outcome
Selection statements(switch):
Also known as case select statements, can check if a variable has a specific value
Count controlled loop(for):
For loops will repeat the code in them a fixed number of times
Condition controlled loop(while):
Controlled by a condition at loop start. Will keep going until condition is false
Condition controlled loop(do):
A do…until loop is controlled by a condition at end of loop. Keep going until condition is true. Will always run the loop at least once
Boolean operators:
And, or, not. Selection and iteration statements
Random numbers:
Most languages have a function to generate random numbers. Useful for simple games
Arrays:
Data structures that can store a collection of data values under one name. Each val called an element
2D arrays:
Essentially a 1 dimensional array where each element is a 1 dimensional array