Programming Fundamentals Flashcards
What is an INTEGER?
Whole numbers that can be positive or negative and includes 0.
Examples include -5, 0, and 7.
What is a REAL / FLOAT?
Numbers that have a decimal point, which can also be negative.
Examples include -1.8, 0.5, and 3.14.
What is a BOOLEAN?
A data type that can only take one of two values: TRUE or FALSE, YES or NO, 0 or 1.
Used in logical operations.
What does CHARACTER represent in programming?
A single letter, number or symbol, e.g. 6, Y, &.
It is often used to denote individual characters in strings.
What is a STRING?
A collection of characters used to represent text, e.g. ‘Mavis’, ‘C19$8’.
Strings can include spaces and punctuation.
Fill in the blank: A BOOLEAN can only take the values _______.
TRUE or FALSE
True or False: A FLOAT can only be a positive number.
False
FLOATs can be negative, such as -1.5.
What is casting?
Casting is used to change the data type.
e.g. You could change the integer 7 to string “7”.
What are arithmetic operators?
Arithmetic Operators take two values and perform a mathematical function on them.
e.g. 5 + 6.
What is exponentiation?
Exponentiation is used to raise a number to a power. In Python, the symbols ^ or ** are used.
e.g. 2 ** 3 = 2x2x2 = 8.
What does the Div operator do?
The Div operator returns the whole number part of a division. In Python, the symbol // is used.
e.g. 20 // 3 = 6.
What does the MOD operator do?
The MOD operator returns the remainder part of the division. In Python, the symbol % is used.
e.g. 20 % 3 = 2.
What is the Assignment Operator?
The Assignment Operator is used to allocate values to constants or variables.
What do Comparison Operators do?
Comparison Operators compare the expression on the left hand side with the expression on the right hand side and produce a Boolean value: True or False.
What is a Constant?
A Constant is assigned a data value that cannot be changed as the program runs.
Example: VAT = 0.2
What is a Variable?
A variable is a location in memory that holds one or more values. It has a label or name to identify it and its values can be changed as the program runs.
What can you do with string manipulation commands?
You can use commands which give you information about the string or allow you to alter the string.
What are IF Statements?
IF Statements allow you to check if a statement is True or False and carry out different actions based on the outcome.
Example: if age <= 16 then print(“Child”) else print(“Adult”)
What are Switch Statements?
Switch statements (also known as Case Select Statements) can check if a variable has a specific value.
Example: print(“You selected 1”) print(“This is not a valid choice”)
What is a COUNT CONTROLLED LOOP (FOR)?
For Loops will repeat the code in them a fixed number of times.
Example: For i = 1 to 7
What is a CONDITION CONTROLLED LOOP (WHILE)?
While Loops are controlled by a condition at the start of the loop and will keep going while the condition is true.
Example: While total < 10
What is a CONDITION CONTROLLED LOOP (DO)?
A DO … UNTIL Loop is controlled by a condition at the end of the loop and will keep going until the condition is true. This loop will always run at least once.
Example: Do num = input Until total >= 10
What are the three Boolean operators?
AND, OR, NOT
These are used in selection and iteration statements.
What is the purpose of random numbers in programming?
They are useful for simple games.
Example: X = random(1,6)
What is an array?
A data structure that can store a collection of data values under one name.
Example: scores = [2, 5, 1, 3, 4, 7, 9]
What is a two-dimensional array?
It can be thought of as a one-dimensional array where each element is a one-dimensional array.
What is file handling in programming?
It is about how a program can access and change data stored in an external file.
What is a Record?
A Record is a type of data structure like an array - it is used to store a collection of data values. They can store values with different data types.
What does SQL stand for?
SQL stands for Structured Query Language.
What is the purpose of SQL?
SQL can be used to search database tables for specific data.
What is a Sub Program?
Sub Programs can be used to save time and simplify code. The Sub Program will usually carry out a specific task.
What are Procedures?
Procedures are sets of instructions stored under one name. When you want your program to carry out these instructions, you just call the name of the procedure.
What are Functions?
Functions are similar to procedures but Functions always return a value.