Programming

Subdecks (14)

Cards (108)

  • a function is a

    Block of code that performs a task and returns a value
  • a procedure is a 

    a block of code that only performs a task
  • benefits of subroutines
    • Shorter programs
    • easier to read as its in smaller sections
    • can be tested separately so its easier to debug
    • can give different programmers different subroutines which can later be combined
    • if something needs changing it only needs changing once
    • can be used multiple times in one program
    • data that is passed to a subroutines can be customised, so sam action different data
    • subroutines can be Added to a library, to use in other programs
  • parameters define the data that must be passed to a subroutines subroutines when its called
    parameters are treated like local variables
  • parameters are used to share data between different parts of a program. this reduces the risk of problems arising from the values being modified
  • arguments - is th data that is passed to a subroutine.
  • passing arguments by val
    • each parameter will hold a copy of the data from the original argument
    • the data is held in a separate memory location and is only available to the subroutine , this earning the parameter has a local scope
    • so even if th value is changes in the subroutine the original argument is unchanged
  • passing arguments byref
    • when argument is passed it creates a pointer, which contains the memory address of original variable
    • any changes to the parameter within the subroutine also effect the value of the original variable
  • string concatenation
    joining two or more strings together using + or ,
  • string slicing
    extracting a portion of a string by specifying the start and end indices
  • place holders
    breaking into a list of substrings by a specified delimiter
  • string stripping
    removing white space one other specified characters from the beginning or end of a string
  • string substitutions
    replacing one substring with another within a string
  • string indexing
    being able to to access a specific data item in a string
  • In LMC what is the instruction that INP means
    Input data
  • in LMC what instruction does ADD mean

    add data
  • what instruction does SUB mean
    subtract data
  • what instruction does STA mean
    store data
  • what instruction does LDA mean
    load data
  • what instruction does BRA mean
    branch to a specific cell
  • what instruction does BRZ mean
    if 0, branch to specified cell
  • What instruction does BRA mean
    If 0 or positive, branch to specific cell
  • what instruction does HLT mean
    break
  • what instruction does DAT mean
    treat content as data
  • what LMC commands would this problem need(in order):
    allow for the input of two values, sum them up and output the total.
    INP
    STA NUM1
    INP
    ADD NUM1
    OUT
    HLT
    NUM1 DAT
  • What LMC command would this problem need(in order):
    Allow for the input of three values, sum them up and output the total
    INP
    STA num1
    INP
    STA num2
    INP
    ADD num2
    ADD num1
    OUT
    HLT
    num1 DAT
    num2 DAT
  • What set of tools does an IDE give you?:
    • Stepping
    • Variable watch
    • Breakpoint
    • Source code editor
    • Debugging tools
  • what does stepping do(in IDE’s)
    allows you to monitor the effect of each individual line of code, by executing a single line at a time
  • what does variable watch do(in IDE’s)?
    observe how the content of variable change in real-time through the execution of a program
  • what does breakpoint do (in IDE’s)?
    allows the user to set a point in the program at which the program at which the program will stop
  • what does source code editor do(in IDE’s)?
    it makes the coding process easier by providing things such as
    • auto completion
    • indentation
    • syntax highlighting
    • automatic bracket completion
  • what does debugging tools do (in IDE’s)?
    it provides run-time detection of errors
  • What does passing a value by value mean?
    It’s treats the data as a local variable ,a copy of the data is made only for the subroutine and then discarded once finished
  • what does passing a value by reference mean
    the address of the parameter is given to the subroutine , so the value will be updated at the given address
  • what does modularity mean
    its a technique used to split large, complex problem into smaller more self-contained modules