O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

Computing Unit 2 Chapter 2

jacksinoxu Inglês 12 flashcards

Flashcards do conjunto (12)

  1. 1Statement• a single instruction (usually a single line of code) which can be executed.
    • Some statements can contain others (eg IF, WHILE).
  2. 2Subroutine• in the context of A-level computing, a generic term meaning either procedure or function.
    • a separate sub-program that can be “called” from anywhere else in the code.
    • execution jumps to the start of the subroutine then, when the subroutine finishes, execution returns to the point from which it was called.
    • parameters may be passed to a subroutine, and these then act as variables within it.
  3. 3Procedure• A subroutine which is given an identifier and can be called from the main program or from another subroutine.
    • When called the code in the procedure is executed.
    • Control is then passed back to where the procedure was called.
    • Unlike a function, it does not return a value.
  4. 4Function• is a subroutine that returns a single value.
    • can be called using its identifier, which can then be used in expressions like a variable, with the value returned replacing the function call.
  5. 5Parameter• a variable which holds an item of data which is passed to a subroutine, procedure or function.
    • given an identifier when the subroutine is defined and substituted by an actual value when the subroutine is called.
  6. 6SequenceA construct in which…
    • all instructions are executed exactly once.
    • instructions are executed in the order in which they appear.
  7. 7SelectionA construct in which…
    • a condition is used to determine which of the statements (if any) will be executed.
    • As a result some instructions may not be executed.
  8. 8Iteration / LoopA construct in which…
    • A group of statements is executed repeatedly for a set number of times or until a condition is met.
  9. 9Nesting• When a selection/iteration statement is enclosed within another selection/iteration statement.
    • The nested statement must be ended before the end of the enclosing statement or a syntax error will be generated.
  10. 10Recursion• This is when a function/procedure/subroutine calls itself.
    • The original call is halted until subsequent calls return.
    • Eventually a stopping condition must be reached.
  11. 11When tracing programs…• refer to each line of code by number in the order in which it is executed.
    • when expressions are evaluated, state the resulting value.
    • record changes in the values of variables.
    • in IF statements and WHILE loops, etc., state whether the expression evaluates to TRUE or FALSE and where execution will jump to as a result.
    • in calls to subroutines, functions and procedures, state the value(s) (if any) that are passed.
    • when a function ends, state the value that is returned.
  12. 12Iteration vs RecursionAdvantages of iteration:
    • Iteration uses only one set of variables (which are updated on each loop), whereas recursion creates new variables for each call.
    • Iteration makes more efficient use of memory.
    • Iteration can be faster.
    • Iteration is less likely to run out of stack space than recursion.
    Disadvantages of iteration:
    • The algorithm may be more difficult to follow/trace because variables are being reused.
    • You need to be careful to get the conditions of loops correct (given current state of variables).
    • Humans often express the problem in a recursive way.

Informações

Descrição
FlashCards sobre Computing Unit 2 Chapter 2, criado por jacksinoxu em 23-03-2015.
Criado por
jacksinoxu
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?