Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

1.2.4

QuestionAnswer
Programming paradigms The approach, style or pattern we follow when programming
Turing complete when paradigms can complete any problem (ignoring practical constraints), making paradigms equal
Low-level languages compared to high level Pros - More flexible due to direct memory access - More efficient - Less storage - Can be used in embedded programs Cons - Machine dependent - Harder to read/write/debug - Need detailed CPU architecture knowledge - Longer code
Machine dependent only works on specific CPU architecture
Low level paradigms Consist of opcode and operand Pros -Both have same execution efficiency -Produce precise, efficient code -Direct access to system-level features Cons -Machine-dependent -Hard to debug -Hard to understand, modify + maintain code
Machine code (Low level paradigms) - Programs in 1s and 0s that translate to electrical signals - Closest to what actually happens on a computer
Assembly language (Low level paradigms) - Short code words (mnemonics) that each matches a sequence of 1s and 0s - Translates by a specific assembler - One-to-one instructions - Opcodes are mnemonics
Declarative (High level paradigms) Don’t say how to solve a problem, but says what needs to be done
Imperative (High level paradigms) Control the state of the program (sequence, iteration etc) through instructions that solve the problem, focus on describing how a program operates - Procedural - Object-oriented
Procedural (Imperative) - Give the computer step-by-step instructions to solve a problem - Instructions are grouped into subroutines - Sequence, selection + iteration - Stored in variables that can be passed to subroutines
Object-oriented (Imperative) - Objects are created that can interact with each other - Sequence, selection, iteration, inheritance, objects, classes, - Stored in attributes concealed by encapsulation - Classes, methods and instances
LMC little man computer: Each processor family has its own assembly language opcode set. We use little man computer (LMC) opcode set that uses 11 opcodes. Each line can have up to 3 parts: a label, the mnemonic, the data.
ADD (LMC) Add
SUB (LMC) Subtract
STA (LMC) Stores ACC contents in memory
LDA (LMC) Loads memory value to ACC
BRA (LMC) Always branch to a location in the computer (iteration)
BRZ (LMC) Branch to a location if ACC contents are 0 (iteration, selection)
BRP (LMC) Branch to a location if ACC contents are positive (iteration, selection)
INP (LMC) Input
OUT (LMC) Output ACC contents
HLT (LMC) End program (halt)
DAT (LMC) Memory location label
Memory addressing ways of accessing memory in low level languages
Addressing modes determine the way the operands of an instruction are interpreted - Immediate - Direct - Indirect - Indexed
Immediate addressing (addressing modes) the operand is the data to be used, not an address
Direct addressing (addressing modes) operand is the address of the data to be used
Indirect addressing (addressing modes) operand is the address where the address of data to be used is - Useful where there are not enough bits to represent addresses
Indexed addressing (addressing modes) operand is added to value in IR to give the memory address of the data to be used - Useful when you want to visit several consecutive addresses, as IR is incremented
IR index register: stores a value to be used as a base address to add to the operand
OOP object-oriented programming: attempts to group information, data and related functionality (code) into structured items known as objects
Objects (OOP) instances of classes that can store data and perform actions on this data
Instantiation (OOP) the process of creating an object from a class
Classes (OOP) templates, with attributes and methods defined within it, that create objects - Easy to reuse, and create many objects from it Four parts: - Class name - Constructor method - Its attributes - Its methods
Constructor method (Classes) runs when an object of that class is instantiated
Attributes (Classes) ‘properties’ of the class (like variables)
Methods (Classes) code that allows attributes to be changed (like subroutines)
Classes code example (OOP) Class toyTank #Class name Private color #Attributes #Constructor method Public procedure new (givenColor) Color = givenColor Public procedure getColor() #Methods print(color) Public procedure setColor(newColor) Color = newColor
Encapsulation (OOP) hiding the values or internal state of an object, preventing direct access - Encapsulated attributes are only accessible/changeable via the methods - This is what the ‘private’ key term means - Allows validity checks inside the methods
Inheritance (OOP) Inheritance: a class obtains attributes and methods defined in another class, as well as being able to define its own methods and attributes The first line of code would then be: Class toyTank inherits Models
Superclass/base class (Inheritance) class others inherit from
Subclasses/derived classes (Inheritance) classes that inherit from superclasses
Overriding (Inheritance) when a subclass writes a new method under the same name as in a super class that method is used instead of the old one To use the old one, the key word .super is used: tankOne.super.getName()
Polymorphism (OOP) two different objects respond to the same command in different ways (e.g. overriding)
Created by: FlashCardFun!
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards