UNIT 11: Programming Techniques Flashcards
What does IDE stand for?
Integratred Devlopoment Enviroment
facilities of an IDE
Integratred Devlopoment Enviroment is a software which enables you to enter, edit, compile (or interpret) and run your programs
many IDE’s will alos have debugging faciliites to help you find the logic errors in a program
Features of an IDE
add line numbers
automatically ident code
auto-complete commands
comment of run-comment a region
finding syntax errors
finding logic errors
debugging facilities
debugging facisilities
set a breakpoint (cause the program to stop on that line)
set a watch on a variable so that its value is displayed each time it changes
step through a program one line a time
trace the execution of a program for example display a mesage every time a particular statement is executed or subroutine is called
algorithm defintion
an algorithm is a sequence of instructions that can be followed to solve a problem
pseudocode defintion
pseudocode is used to write instructions in statements that are somewhere between english and a programming language
guidelines for writing pseudocode no strict rules tho
its an aid
variable and assignment
identifier is a name. eg score that points to a memeory location
assignemnet is assigning a value to the memory location
varaibles and constants
value of a variable can be changed
to change the value of a constant you have to change it in the source code and then recompile
why use a constant
reduce the risk of errors by reducing access to the mmeory location
mod and div operators
mod is REMINADER
div is just division
if then endif - - - - - - program flow
program flow is controlled by evaluating a boolean condition
boolean condition evaluates to true or false
relational operators
> greater than
< less than
=> greater than or equal to
=< less than or equal to
== equal too
!= not equal too
complex boolean expressions§
AND returns TWUE is both conditions are true
OR returns TRUE is either of the conditions is true
NOT a TRUE expressions becomes FALSE vice versa
if then elseif else endif
if aljdkja;dka
elseif sadfjalskfja
else lasjfkads
endif
switch/case .. endswitch
logical equivalent of the
if then else endif statement
switch choice
case a ksldfa;jsdfkja
case b saldjfldas
case c asdlkfjad
default asdlkfja;dkfjs
endswitch
PYTHON NO doesnt have this
nested if
in the nested if statement, the second conditioin is only checked if the first condition is true
iteration
means repetition
a sequence of instructions is repeated multiple times
this is much more efficient than writing the instructions mulitple times
the number of repetitions needed may vary and may not be known when writing the code
while endwhile loop
condiiton is tested upon entry to the loop
its possible that the instructions inside the loop might not be executed at all if the entry condition is not met
do until loop
statements in the loop are excuted before the condition is evaluated
not in python
equgialent is while.. end while loop
infinite loop
you may make one if u make a damn error
brief pause can be included to slow down the loop
computer xontrol and data sendsing appliocations use infinite loops to gather data from sensors
- varitety of sensors can control a number of output dvices such as lights, buzzers and motors
- after the setup code is run the device enters an infiinite loop to repeatedly check the value of the sensors.
for.. next loop
termed ‘definite iteration’ and is used to repeat a block of insturctions a specififed number of times
uses a counter variable which is automatically incrememnted each time through the loop
optionally a step value can be specified to make the counter increase or decrease by any integer
nested for .. next loop
it is possible to use nested for loops
useful for looping through grids in two dimensional arrays
subroutine
set of instructions with a name
built in functions
programming lanugages come with many built in functions which perform common tasks