Chapter 6 Flashcards
What are the four categories of programming languages?
Assembly
Compiled
Interpreted
Query
Assembly language:
developed in 1947 at the University of London
the lowest level of code
allows the developer to provide instructions directly to the hardware
is specific to processor architecture
What are assembly language’s advantages over higher-level languages?
It can be faster
used for direct hardware access such as in the BIOS, device drivers, and customized embedded systems
used for reverse engineering of code
Binary Notational System (base 2):
1s and 0s
Decimal Notational System (base 10):
the numbers 0 or through 9 are used
Binary Math:
1+1=?
10+1=?
11+1=?
10
11
100
Hexadecimal Notational System (base 16):
number 0-9 are used
letters A-F are used to represent numbers 10-15
F+1=10
American Standard Code for Information Interchange (ASCII, pronounced ask-e):
represent text and special characters on computers and telecommunications equipment
use seven bits to store information, which provides for only 128 characters
Unicode:
superset of ASCII
136,755 characters across 139 language scripts and several character sets
UTF-8 uses 8 bits and it identical to ASCII
UTF-16 uses 16 bits for 65,536 and is the most common standard in use today
What 2 things do you need to know when coding in assembly?
the version specific to the processor’s platform
how the processor codes will respond in protected and unprotected memory environments
What is the binary code to tell the processor to move data?
10110 followed by a 3-bit memory register identifier
MOV:
short for move
is a mnemonic to replace the binary or hex code
What section is after the semicolon on a line of code?
comments
What does the basic structure of a line of code contain?
processor instructions (do this)
directives (giving the processor specific ways of performing the task)
data
optional comments
Compiled Programming Language:
one that requires the use of a compiler to translate it into machine code
What are the three steps for creating and using a program using a compiled language?
Write the application in a programming language, such as Java or C++. This is called source code
Use a compiler to translate the source code into machine code. Most software development apps have a compiler
Execute the program file, which (in Windows) usually has an .exe extension
In the past what were the more common compiled languages?
Fortran
BASIC
Pascal
Currently what are the more common compiled languages?
Java
C
C++
C#
Compare Java code to assembly:
Java is a lot shorter
Java uses the { } brackets to indicate code blocks
use 2 slashes (//) to create comment section compared to semicolon
Java uses double quotes (“””) and assembly uses single quotes (‘’)
Compare C++ and Java:
both are derivatives of the C language
Both comments start with two slashes and braces are present to create blocks of code
both use a main function, double quotes for text, and a semicolon to end a statement
Interpreted Programming Language:
each line of code is read by an interpreter every time the program is executed
What do both an interpreter and a compiler do?
they take high-level source code and translate it into low-level machine code
Interpreter vs. Compiler
Task:
Translating source code
Interpreter translate one statement at a time
Compiler translates entire program at once
Interpreter vs. Compiler
Task:
Executing programs
Interpreter executes program by itself
Compiler creates an executable file (usually .exe)
Interpreter vs. Compiler
Task:
Analyzing source code:
Interpreter is faster than Compiler
Interpreter vs. Compiler
Task:
Executing code
Compiler is faster than Interpreter
Interpreter vs. Compiler
Task:
Using memory
Compiler is faster than Interpreter
Interpreter vs. Compiler
Task:
Debugging
Interpreter is easier than Compiler
When does the interpreter generate an error code?
when it gets to a line that is written incorrectly
When does the compiler generate an error code?
After it reads the entire code
What are the three types of interpreted languages to be familiar with?
Markup language
Scripting language
Scripted language
Markup language:
is a language that programmers can use to annotate text to tell the computer how to process or manipulate the text.
What do you need to create a markup language?
a codified set of rules telling the processor what to do with the marked-up text when it encounters it
What is the most common application of markup language?
the creation of web pages
Hypertext Markup Language (HTML):
the language in which most web pages are created
allows web developers to format web pages
pages are downloaded to a client and then processes by specialized software
works by using tags to signify instructions for the browser
Bold penguin using tags
<b> penguin </b>
Scripting languages:
used for executing a list of tasks
create a file that contains multiple actions to perform and then execute the file
most common use is to execute tasks from within a web page written in HTML
Bourne again shell (Bash):
one of the earlier common scripting languages
What are some advantages to using scripting language?
can get more down with less code
supports the use of objects, variables, and functions
What are the most popular scripting languages?
JavaScript (JS)
Visual Basic (VB)
Script
PHP
Perl
Python
Scripted language:
needs a command interpreter to be built into the program
often used to modify video games to add functionality above and beyond what the initial developers created- without altering the core of the game itself
What are some common scripted languages?
Lua
Lisp
Query language:
is specialized to ask questions
is designed to retrieve data from databases
What are some common Query Languages?
Structured Query Language (SQL)
Lightweight Directory Access Protocol (LDAP)
Queries often follow a structure like:
Select
From
Where
Structured Query Language (SQL):
allows for insertion of data into tables, joining data from multiple tables, and several different types of operators, such as finding the minimum and maximum, counting, finding averages, and summing values
What is a programmer’s goal?
to get a computer to do what he or she wants it to do
What is one way that programmers can simplify their work?
Reuse sections of code
How are many programs like Frankenstein in nature?
Blocks of code perform specific tasks and the developer figures out how to stitch them all together into a finished product
Programming logic:
refers to what the program does and includes topics such as logic components, data types, and identifiers
What are the two main ways the programs perform logic?
Branching
Looping
Common data types:
Char (Character)
one character, such as a UTF-16 or UTF-32 character
Common data types:
String
Zero or more characters
Common data types:
Integer
Whole number with no decimal point
Common data types:
Floats
Any number with a decimal place
Common data types:
Boolean
A true of false condition, usually represented by a 1 (true) or 0 (false)
Constant:
a set or predefined number
Variable:
number that can change
Branching logic:
used to compare variables and constants to other variables and constants and can be used across different data types
Boolean output:
used to determine the path that the program takes
Looping logic:
used for monitoring a state within a program, and then invoking an action when that state changes
What is at the center of looping?
a while statement
Flowchart:
a visual representation of a program that uses boxes to represent the logic created before the code is developed
helps the developers visualize the flow of the program, making it easier to plan out the sections of code needed
Pseudocode:
a fake code used for comments
What are two types of containers?
Arrays
Vectors
Arrays:
holds a list of values
all elements in an array must be of the same data type
is predefined in size and does not change
Vector:
holds a list of values
elements don’t need to be the same data type
can shrink or grow as the program requires
Functions:
created to accomplish tasks
generally designed to take input, transform it somehow, and deliver output
starts at the beginning of the code block and finishes at the end, handing off to another process
Objects:
are collections of attributes, properties, and methods that can be queried or called upon to perform a task
can be a variable, function, method, or data structure that can be referenced
Properties:
describes the characteristics of the object
Attributes:
refers to additional information about an object
How are properties and attributed used differently in coding?
Properties can be different data types
Properties can be modified through code
Attributes only have the data type of string and can’t be changed
Object-Oriented Programming (OOP) languages are:
Java
C++
C#
Python
PHP
Perl
Ruby
In most Object-Oriented Programming languages, objects consist of three things:
Identity, which is the name of the object
State, which is represented by attributed and reflects properties of the object
Behavior, which determines the response of the object and is represented by methods
Common data types example:
Character
A or a
Common data types example:
String
“This is a string”
Common data types example:
Integer
5 or 500000
Common data types example:
Floats
5.2 or 5.000001
Common data types example:
Boolean
1 (true) or 0 (false)