Programming Flashcards
What is a program?
way of encoding algorithm in a precise enough way for computers to understand the instructions
What do high level programming languages do?
enable us to write program that are portable across different machines – they are closer to human languages
ie. Snap, Scratch, Python, C++, Java, Racket
What does a compiler/interpreter do?
takes a high level language and translates it into something that looks about the same, regardless of which high level language is used
What does an assembler do?
translates from Assembly language to Machine Code
What is an Assembly language?
specific to a particular computer architecture and operating system
What is machine code?
consists of binary or hexadecimal instructions that a computer can respond to directly
What is an algorithm?
precise, systematic method for producing a specified result
What are the 3 components of an algorithm?
sequencing
selection
iteration
What is sequencing?
instructions are executed in the specified order – order matters
- programs will execute exactly in the order that’s given
- if we assign values to variables, they’ll set one value after another, after another
What is a mutation?
updating variables, changing oneself (a step)
What is selection?
allows algorithm to select which instructions to execute depending on conditions
‘if ____, then ____’
‘if ____, then ____, else ____’
‘if [possibility], then you can ____, otherwise, you must ____’
What is iteration?
allows algorithm to repeat instructions
- loop: allows you to do the same thing over and over again, sometimes without a stopping condition, sometimes forever
‘repeat’
‘repeat until…’
‘repeat forever’
What are variables?
named storage location for data (named quantities – name + value)
Communication in Snap!
What is a broadcast?
sprites can send messages to each other
What is iterative design?
engaging in a continuous cycle (design → prototype → evaluate) until you have satisfied user specification
Be able to trace through code.
-
Describe what a block of Snap! does in English.
-
How do you describe a block of Snap! code in English?
- describe code in terms of input and output, and what is being done
use phrases:
- the block consumes…
- it does…
- it produces/displays/reports…
What is a bug?
error or flaw in software that makes it produce wrong or unexpected results
What is debugging?
process of finding and fixing bugs
- some bugs can allow ‘black hat hacker’ to gain control of computer
What are the 3 types of errors that can occur in software?
logical error
syntax error
semantic error
What is logical error?
fail to initialize variable, or there’s an ‘off by one’ error – main type
What is a syntax error?
incorrectly typed
What is a semantic error?
flaw in your understanding of the question
Why can flaw/failure in software programs occur?
- program errors that programmers create while coding application (logical, syntax, and semantic errors)
- lack of testing due to limited time, or not having skilled testers to thoroughly test application for issues and defects
- frequent changes in requirements and miscommunications among clients, business analysts, developers, and testers
Describe computer circuitry at the very lowest level.
made of wires, and each wire is either on or off
- therefore, the only operations that can be performed at level are those that operate on single-bit values
What are single-bit values?
just ones and zeros – ie. just ons and offs
What are Boolean functions?
- take Boolean values (true or false) as inputs, and report new Boolean value as output
- Boolean operator consumes only one of two values (true or false), and can produce one of two values (true or false)
Boolean Operators
What value (true or false) would be produced using the ‘and’ operator?
False and False
False and True
True and False
True and True
F
F
F
T
Boolean Operators
What value (true or false) would be produced using the ‘or’ operator?
False or False
False or True
True or False
True or True
F
T
T
T
Boolean Operators
When are ‘and’ operators true?
both blocks in the operator have to be true
Boolean Operators
When are ‘or’ operators true?
at least one of the blocks in the operator have to be true