Fundamentals of programming Flashcards
concept of a data type
defines the type of data that a variable or object can hold
user defined data types
data types created by the programmer for a specific problem
what are reference data types used for
reference data type are used as stores for memory addresses of objects created at runtime
integer
any whole number
{8, 35)
real
numbers with a decimal point and a fractional part
{2.0, 19.234)
boolean
one of two values
{true or false}
character
a letter, number or symbol in the given character set
{h, 6, $}
string
sequence of characters
{hello world !}
casting
changing the data type
sequence
all lines are executed
selection
decisions made that determines the execution
iteration
code is repeated until specified conditions are met
count control loops
exact number of iterations known
condition controlled loops
iterates dependent on condition
variables
locations in the memory containing single values
constants
identifiers with values that remain fixed with values that remain fixed during the programs execution
why use constants
ability to update
readability
compiler optimisation
modulus
remainder
12 mod 5 gives 2
quotient
how many times
17 div 5 gives 3
boolean operators
takes boolean inputs and evaluate to a boolean value
example of string handling
string subject = “Computer Science”
subject.length = 16
subject.upper = COMPUTER SCIENCE
subject.lower = compuer science
subject.substring(0,8) = Computer
exceptions
events that occur during the executions of a program that disrupts the normal flow of the programs instructions
(sometimes cant be avoided and would normally terminate the program)