Computer Science: Computing Principles, Php, SQL, Java, Javascript, Python, HTML

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is the identity operator for not equal?

!==

for loops

"for x in list_name" ... applies something to every item in a list

my_list[3:]

# Grabs the fourth through last items

Carries out calculations and logical decisions

Arithmetic Logic Unit (ALU)

How can you find a value fast in a sorted array?

Arrays.binarysearch works on all primitives and on objects using a comparator

modulus operator

%, works on integers (and integer expressions) and gives the remainder when the first number is divided by the second

logical operators?

&& [and] || [or] ! [not]

logical operators?

&& [and] || [or] ! [not] ? ternary operator

syntax for line breaks in an alert box?

'/n' + " here"

In the <script> tag, how is the Type attribute used?

<script type="text/javascript"> //Used to denote the type of script being used. Always this for JavaScript

What is the identity operator for equals?

===

Select column1 AS column

Aliases "AS" used to make columns more readable

type conversion

An explicit function call that takes a value of one type and computes a corresponding value of another type.

boolean expression

An expression that is either true or false.

How can you sort an array using parallel tasks

Arrays.parallelSort usesmergesort and ForkJoin common pool to execute any parallel tasks. works with all primitive types and comparables

how can you sort a range of an array in-place?

Arrays.sort(int[] a, int fromIndex, int toIndex) works with all primitive types and comparables

Modules

Python's built-in features are called modules. Also called "libraries" by some programmers. Example speech: "you want to use the sys module."

Main memory is commonly known as _______________.

RAM

keys()

Returns an array of dict's keys

CURTIME()

Returns the current time

SELECT

Select columns

A(n) ?? is a special value that marks the end of a sequence of items.

Sentinel

packets

Small chunks of information that have been carefully formed from larger chunks of information.

pixel

Smallest addressable element of a picture.

Cardinal Numbers

Start at 0

Tim Berners Lee

Invented the World Wide Web (WWW)

True/False: The \t escape character causes the output to skip over to the next horizontal tab.

True

variables can be reassigned?

True

True/False: The first line in the while loop is referred to as the condition clause.

True

True/False: The if statement causes one or more statements to execute only when a Boolean expression is true.

True

True/False: The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.

True

True/False: To get the total number of iterations of a nested loop, multiply the number of iterations of all the loops.

True

if

Used to determine, which statements are going to be executed

What is the string escape sequence to insert a carriage return in JavaScript?

\r

autoload part3

__autoload() function goal is to include the corresponding file. In simplest form, this might be function _ _autoload ($class) { require($class . '.php'); }

"mutable"

can be changed after created

Text

data type, String

pass

does nothing

break

interrupt the (loop) cycle

How can you isolate the rightmost 0-bit?

invert number AND (number + 1)

yield

is used with generators

for

iterate over items of a collection in order they appear

\n

line character; creates new line in string

Margin tag

margin: value;

what does the n$ quantifier do?

matches any string with n at the end x="hello world" y=/ld$/g document.write(x.match(y))--> ld

(a|b|c|)

matches either a or b or c

^

matches the beginning of a string

$

matches the end of a string

indentations in python

mean that there is a code block

robot

mechanism or an artificial entity that can be guided by automatic controls.

as

if we want to give a module a different alias

Control flow statements

if, for, while

function import

import a function from a module (from module import function)

LN10 is what?

natural logarithm of 10 approx (2.302)

LN2 is what?

natural logarithm of 2 approx (0.693)

not

negates a boolean value

How would you name a static factory method that is like new Instance, but used when the factory method is in a different class. <Type> indicates the type of object returned by the factory method.

new<Type>

%

no argument converted, results in "%" in the result

is there a standard that applies to the navigator object?

no, therefore determining browsers becomes quite an ordeal.

!=

not equal

How can you right propagate the rightmost 1-bit?

number OR (number - 1), does not work for 0

When implementing equals, how do you compare objects?

object fields, including collections : use equals

nested constructor

parent::_ _construct() and parent::_ _destruct()

adding parser options

parser.add_option('-n, '--new')

function argument

passed in for function parameter function(argument)

the Math object allows you to?

perform mathematical equations and tasks.

from .... import ....

imports specific attributes from a module

trait

in PHP each class can only inherit from a single parent class, and there is no common parent class that each of them would have. The solution, then, is traits. Traits allow you to add functionality to a class without using inheritance. Like an abstract class and an interface, traits cannot be instantiated

what does floor() method do?

rounds a number to down to the nearest interger Math.floor(number) document.write(Math.floor(5.3))-->5

dictionary

similar to a list but you access values by looking at a key rather than an index useful for information using strings and values i.e. phonebook, email databases (passwords, and usernames)

key

similar to index but uses a string or number

A(n) _______________ decision structure provides only one alternative path of execution.

single alternative

\t

tab character

What is the encoding technique called that is used to store negative numbers in the computer's memory?

two's complement

creating an uncondensed array?

var x = new Array(); //regular array x[0] = "black"; x[1] = "white"; x[2] = "green"; x[3] = "yellow"; x[4] = "blue"; x[5] = "red";

A(n) _______________ is a name that represents a value stored in the computer's memory.

variable

DESCRIBE

provides context about the columns in a SQL table

By general contract, the equals() method in Java must be ..

reflexive, symmetric, transitive, consistent, and any non-null reference must return false.

include a class definition

require('HelloWorld.php');

What are advantages of static factory methods over constructors?

1) they have names 2) they are not required to create a new object 3) they can return an object of any subtype of their return type 4) they reduce the verbosity of creating parameterized type instances

XOR Gate

A or B, but not both, must be true for 0 to be true

Dynamic Host Configuration Protocol (DHCP)

Dynamically provides IP addresses to devices on a network

char(size)

Fixed-length character string. Size is specified in parenthesis. Max 255 bytes.

%f

Floating point decimal format (lowercase)

%e

Floating point exponential format

%e

Floating point exponential format (lowercase)

True/False: Both of the following for clauses would generate the same number of loop iterations: for num in range(4): for num in range(1,5):

False

True/False: In Python, an infinite loop usually occurs when the computer accesses the wrong memory address.

False

In Python, you would use the ?? statement to write a count-controlled loop.

For

autoload part4

For each new object type created in the following code, the function will be invoked: $obj = new Class(); $me = new Human(); $r = new Rectangle(); Thanks to the _ _autoload() function, those three lines will automatically include Class.php, Human.php and Rectangle.php

FORMAT()

Formats how a field is to be displayed

HTTP

Hypertext transfer protocol is the internet protocol used to transport information between the client browser and the web page server.

Here's a string with numbers from 1-250 in random order, but it's missing one number. How will you find the missed number?

I'd XOR them.

The _______________ statement is used to create a decision structure.

If

The output of the following print statement is: print 'I\'m ready to begin'

I'm ready to begin

____ adds a new row to a table

INSERT INTO add row to table

Add a row to the table

INSERT INTO celebs (id, name, age) VALUES (1, 'Justin Bieber', 21);

___ is a condition in SQL that returns true when the value is NULL and false otherwise.

IS NULL

Variable length fields

Identifier (such as a comma) used to show where one field ends

What is the disadvantage of coding in one long sequence structure?

If parts of the duplicated code have to be corrected, the correction has to be made many times.

SDLC (Step 4)

Implementation (coding)

Presentation Layer (OSI 6)

Looks after any conversions between data on network (e.g: encryption/decryption)

Session Layer (OSI 5)

Looks after starting, managing and terminating connection session. Provides simple, half-duplex and full duplex operations

Sign and Magnitude

MSB used to represent sign (0-positive, 1-negative)

The following is an example of an instruction written in which computer language? 10110000

Machine language

*=

Multiply AND. Multiplies left operand by right and assigns product to left operand A*=B ~ A = A*B

NOT Gate

Negates A (symbol: ¬)

How can a thread share a variable with another?

One thread may pass a copy of a primitive variable to another thread, but it cannot share the primitive local variable itself.

open(argument, 'w')

Open a file with an extra parameter. Python has several open parameters that open a file different ways

How can you perform operations on an immutable object?

Operate and create a new immutable object.

When using the _____ operator, one or both subexpressions must be true for the compound expression to be true.

Or

get()

Returns a value for the given key. If key is not available, returns default of 'none'.

items()

Returns an array of dict key/value pairs

NOW()

Returns the current date and time

LEN()

Returns the length of a text field

DATEDIFF()

Returns the number of days between two dates

Waterfall lifecycle

Sequential stages, each stage must be completed for the next to follow

%o

Signed octal value

Flat File database

Simple structure of database, not linked

...

In fact, since the constructor is now empty, we could leave it out and the Java compiler would insert it, and insert an implicit call to the no-arg constructor in the superclass.

Javascript comment syntax?

/**/ for multiple lines // for a single line

x += y

ADD AND x = x + y

calling an external javascript file syntax?

<script type="text/javascript" src="javascript.js"> </script>

...

The purpose of a nested class is to clearly group the nested class with its surrounding class, signaling that these two classes are to be used together. Or perhaps that the nested class is only to be used from inside its enclosing (owning) class.

Website Structure

The purpose of different pieces of content in a web page, used to help the computer determine how that content should be displayed

Website Content

The raw text, images, and other elements included in a web page

traits can have abstract methods

Traits can have abstract methods that must then be implemented by any class that uses the trait.

how to make a case sensitive (single) search?

("w3schools") - case sensitive (/w3schools/) - case insensitive /content/;

Order of Precedence

(**), (*,/,%), (+,-)

What kind of information is held on the thread stack?

- all methods the thread has called to reach the current point of execution. - all local variables for all methods on the call stack

class

-way of producing objects with similar attributes and methods. -used to create new user defined objects -an object is an instance of a class

What is ~0 bitwise?

0

Write a method that compares Country objects.

@Override public int compareTo(Object arg0) { Country country=(Country) arg0; return (this.countryId < country.countryId ) ? -1: (this.countryId > country.countryId ) ? 1:0 ; }

+=

Add AND. Adds right operand to the left and assigns the result to the left. A += B ~ A = A + B

nested loop

A loop inside the body of another loop.

int

A Python data type that holds positive and negative whole numbers

Iteration

A Repeat or Loop. This is where the code uses "while" or "for" loops

ALTER TABLE celebs ADD COLUMN twitter_handle TEXT;

Add a new column 'twitter_handle' to the table in TEXT format

CSS (Cascading Style Sheets)

A W3C recommended language for defining style (such as font, size, color, spacing, etc.) for web documents.

Banner Ad

A (most often graphic) advertisement placed on a web page, which acts as a hyperlink to an advertiser's web site.

dictionary

A list whose objects can be accessed with a key instead of an index. Key can be any string or number. d = {'key1' : 1, 'key2' : 2}

NAND Gate

A and B must be true for 0 to be false

compound data type

A data type that is itself made up of elements that are themselves values.

Streaming

A method of sending audio and video files over the Internet in such a way that the user can view the file while it is being transferred.

close

A method/function/command to close the file

What is a critical section?

A section of code that is executed by multiple threads and where the sequence of execution for the threads makes a difference in the result

algorithm

A set of specific steps for solving a category of problems

IP Address (Internet Protocol Address)

A unique number identifying every computer on the Internet (like 197.123.22.240)

True/False: A better way to repeatedly perform an operation is to write the statements for the task once, and then place the statements in a loop that will repeat the statements as many times as necessary.

True

True/False: An action in a single alternative decision structure is performed only when the condition is true.

True

True/False: Computer programs typically perform three steps: Input is received, some process is performed on the input, and output is produced.

True

Behavior

Allow visitors to interact with the web page by doing such tasks as mousing over something, clicking on something, exiting something, entering something, etc. In order to define a behavior, the object that the visitor will be interacting with must have a null link that contains: javascript:; By typing that into the link space, you will be able to attach.

True/False: Decision structures are also known as selection structures.

True

True/False: Expressions that are tested by the if statement are called Boolean expressions.

True

True/False: In Python, print statements written on separate lines do not necessarily output on separate lines.

True

True/False: In a nested loop, the inner loop goes through all of its iterations for every single iteration of an outer loop.

True

True/False: In flowcharting, the decision structure and the repetition structure both use the diamond symbol to represent the condition that is tested.

True

program

An algorithm that has been coded into something that can be run by a machine.

command

An instruction for the computer. Many commands put together make up algorithms and computer programs.

...

An interface default method can contain a default implementation of that method. Classes that implement the interface but which contain no implementation for the default interface will then automatically get the default method implementation. You mark a method in an interface as a default method using the default keyword.

Open source software

Anybody can edit for free

True/False: The main reason for using secondary storage is to hold data for long periods of time, even when the power supply to the computer is turned off.

True

~88

Bitwise NOT flips all bits in a number for integers, effectively adds 1 and makes negative

less

page through a file

number(size)

Number value with a max number of column digits specified in parenthesis.

Behavioral patterns

Behavioral patterns address how objects within a system communicate and how a program's logic flows. The Command, Iterator, Observer, State, Strategy (covered in this chapter), and Template Method patterns are all behavioral.

What values can confirm() return?

True or false

What are the four attributes of the <script> tag?

Type, Src, Charset, and Defer

Describe how a read operation is done on hardware.

Typically, when a CPU needs to access main memory it will read part of main memory into its CPU cache. It may even read part of the cache into its internal registers and then perform operations on it.

File handlers

Fundamental to storing files securely on a system

const keyword

Class constants are created using the const keyword, followed by the name of the constant (without a dollar sign), followed by the assignment operator and the constant's value: class SomeClass { const PI = 3.14; }

set

Command used to make updates to a table

Input device

Hardware that feeds data to a computer to be processed

Simplex Communication

Communication channel that only sends data in one direction

Full-duplex Communication

Communication channel that sends data in both directions

Intel, AMD

CISC

____ creates a new table.

CREATE TABLE creates a new table.

Network

Collection of connected nodes

TCP/IP Stack

Complete set of many protocols covering data transmission across a network

Not Null

Constraint that specifics a column cannot be empty

Adaptive Maintenance

Updating software due to external influences or changes within company

Determine if a singly linked list contains a circle.

Use a fast and a slow iterator and check if they meet.

Dial-up Connection

In web terms: A connection to Internet via telephone and modem.

True/False: Python formats all floating-point numbers to two decimal places when outputting using the print statement.

False

True/False: Short-circuit evaluation is performed with the not operator.

False

True/False: The CPU is able to quickly access data stored at any random location in ROM.

False

...

You can check the size of a collection using the size() method. By "size" is meant the number of elements in the collection.

...

You can convert an Java array of primitive types to a String using the Arrays.toString() method. H

...

You can obtain an array of all the possible values of a Java enum type by calling its static values() method.

...

You can obtain the length of a String using the length() method.

True/False: The Python language is not sensitive to block structuring of code.

False

sudo

DANGER! become super use root! DANGER!

___ deletes rows from a table.

DELETE FROM

Operand

Data OR address

Physical Layer (TLA 1)

Data transmitted through some medium

date(size)

Date value

|

Default headsep character in SQL plus

Attributes

Defined words used in an HTML tag to modify the tag properties. They can be used to add or change color or change a size in some element.

def

Defines a function def function1(): print "this is function 1"

International Standards Organisation (ISO)

Defines various standards and rules

DROP table "tablename"

Delete a table to start from beginning

Which of the following is not a microprocessor manufacturing company?

Dell

Preparatory software

Designed specifically for a company to carry out a very specific task

Optical Mark Reader (OMR)

Detects presence of pen/pencil marks by reflecting light on the markings

Node

Device or computer in a network

Interrupts

Device sends signal when it needs attention

True/False: The not operator is a unitary operator and it must be a compound expression.

False

0000 opcode

END

Which of the following is considered to be the world's first programmable electronic computer

ENIAC

Fixed length fields

Each file is same length, divided every fixed number of bytes

Distributed Computing

Each node in a network solving a small part of a problem

Packet Switching

Each packet takes the most efficient route

What is the role of the thread stack?

Each thread running in the Java virtual machine has its own thread stack. A thread can only access it's own thread stack.

Explain the actor model!

Each worker is called an actor. Actors can send messages directly to each other. Messages are sent and processed asynchronously. Actors can be used to implement one or more job processing assembly lines, as described earlier.

Software Error

Error in way code is written

SDLC(Step 6)

Evaluation

"

Every time you put " (double-quotes) around a piece of text you have been making a string. A string is how you make something that your program might give to a human. You print strings, save strings to files, send strings to web servers, and many other things. ' (single-quotes) also work for this purpose.

Local Area Network (LAN)

Exists in a defined and limited location

Wide Area Network (WAN)

Exists over large geographical area, composed of many connected LANs

MID()

Extract characters from a text field

SDLC (Step 1)

Feasibility study/problem defined

%F

Floating point decimal format (UPPERCASE)

Data Warehouse, Database, Tables, Views

How data is organized in SQL Server

...

If the substring is not found within the string, the indexOf() method returns -1;

...

In Java a static nested class is essentially a normal class that has just been nested inside another class. Being static, a static nested class can only access instance variables of the enclosing class via a reference to an instance of the enclosing class.

...

In Java nested classes are considered members of their enclosing class.

...

In Java you cannot override private methods from a superclass. If the superclass calls a private method internally from some other method, it will continue to call that method from the superclass, even if you create a private method in the subclass with the same signature.

Copying and Cloning Objects Part 1

In PHP 5, when you create a copy of an object, PHP actually creates a new reference to that object, not an entirely new object. In other words, both variables will point to the same thing, and changes made through one object will be reflected by the other: $a = new SomeClass(); $a->val = 1; $b = $a; $b->val = 2; echo $a->val; // 2

Authentication

In web terms: the method used to verify the identity of a user, program or computer on the web.

Graphics

In web terms graphics describe pictures (opposite to text).

;

Indicates SQL Statement is Complete

What are the 3 shortcuts for Number object properties?

Infinity //Represents Number.POSITIVE_INFINITY -Infinity //Represents Number.NEGATIVE_INFINITY NaN //Represents Number.NaN

Cookie

Information from a web server, stored on your computer by your web browser. The purpose of a cookie is to provide information about your visit to the website for use by the server during a later visit.

World Wide Web (WWW)

Information system, connecting data via hyperlinks

data

Information. Often, quantities, characters, or symbols that are the inputs and outputs of computer programs.

1001 0001 opcode

Input

A(n) ?? validation loop is sometimes called an error trap or an error handler.

Input

INP

Input mneumonic

_____ is the process of inspecting data that has been input to a program to make sure it is valid before it is used in a computation.

Input validation

%d

Integer format character

Common data type

Integer, a positive or negative whole number Text, Date, Real (decimal points)

Object code

Intermediate step, contains place holders for libraries

{}.format(something)

Is the new string.format in Python 3. This is how indexing works: "My first name is {0} and my last name is {1}. You can call me {0}".format("John","Doe").

What is sys.argv?

It allows you to input parameters from the command line.

When fetching a URL in a browser, what happens after the browser parses the URL to find the protocol, host, port, and path?

It forms a HTTP request.

What does Functional Parallelism mean?

It is a third concurrency model. Functions can be seen as "agents" or "actors" that send messages to each other (call each other).

Stores address of the data or instructions that are to be fetched or sent

Memory Address Register

Purpose of Operating System

Mange security, manage programs, manage hardware, provide a user interface

...

Matching a Java lambda expression against a functional interface is divided into these steps: Does the interface have only one method? Does the parameters of the lambda expression match the parameters of the single method? Does the return type of the lambda expression match the return type of the single method? If the answer is yes to these three questions, then the given lambda expression is matched successfully against the interface.

What Math object method is used to return the absolute value of a given number?

Math.abs(number);

What Math object method is used to return a given number rounded to the next highest integer value?

Math.ceil(number);

computational thinking

Mental processes and strategies that include: decomposition, pattern matching, abstraction, algorithms (decomposing problems into smaller, more manageable problems, finding repeating patterns, abstracting specific differences to make one solution work for multiple problems, and creating step-by-step algorithms).

split()

Method splits a string into separate phrases - Default is to split on whitespace split(str, num) str = separator (optional) numb = number of separations (optional)

How is the intrinsic lock used?

Methods declared as synchronized and blocks that synchronize on the this reference both use the object as monitor (that is, its intrinsic lock)

Assembler

Mnemonics used (often specific to processor) to represent opcodes

5 % 3

Modulo; remainder of the division 5 % 3 = 2 (3 goes into 5 once, remainder 2)

Client-Server Network Model

Network supported by a central server, all nodes connected

When fetching a URL in a browser, what happens after the DOM tree is built in the browser?

New requests are made to the server for each new resource that is found in the HTML source (typically images, style sheets, and JavaScript files). Go back to step 3 and repeat for each resource.

Name some advantages of event driven models!

No shared state between workers

Are object member variables thread safe?

No, object member variables (fields) are stored on the heap along with the object. Therefore, if two threads call a method on the same object instance and this method updates object member variables, the method is not thread safe.

Write comments on code ...

No, you write comments only to explain difficult to understand code or why you did something. Why is usually much more important, and then you try to write the code so that it explains how something is being done on its own. However, sometimes you have to write such nasty code to solve a problem that it does need a comment on every line. In this case it's strictly for you to practice translating code to English.

Read Only Memory (ROM)

Non-volatile, basic instructions of computer stored on it

interface part 2

Note that all methods in an interface must be public. Also, interfaces only identify methods; they never include attributes. To associate a class with an interface, use the implements operator in the class definition: class Someclass implements iSomething {}. Fatal error will becreated by having a class implement an interface without implementing all of the interface's methods.

What is the implication for TreeMap or TreeSet

Objects which implement Comparable in java can be used as keys without implementing any other interface.

Secondary Storage

Often non-volatile, stores data being used by the CPU

Where are heap and thread stack located in hardware?

On the hardware, both the thread stack and the heap are located in main memory. Parts of the thread stacks and heap may sometimes be present in CPU caches and in internal CPU registers.

element

One of the values in a list (or other sequence). The bracket operator selects elements of a list.

constructor inheritance

PHP will always call the constructor for the class just instantiated . The same rule applies for destructors. Further, unlike in some other OOP languages, in PHP, when you create an object of a child class, the parent class's constructor is not automatically called.

PI is what?

PI approx (3.14159)

Name some Concurrency Models

Parallel Workers

Bug

Part of a program that does not work correctly.

Static Addressing

Permanently assigning an IP address to a device

The while loop is known as a(n) ?? loop because it tests conditions before performing an iteration.

Pretest

The first input operation is called the _____, and its purpose is to get the first input value that will be tested by the validation loop.

Priming read

ARM

RISC

exception

Raised by the runtime system if something goes wrong while the program is running.

The ?? function is a built-in function that generates a list of integer values.

Range

Source Code

Raw code of a piece of software

ROUND()

Rounds a numeric field to the number of decimals specified

Circuit Switching

Route is decided, all data follows this route

A(n) ?? total is a sum of numbers that accumulates with each iteration of a loop.

Running

____ queries data from a table

SELECT

How can you create an immutable object?

Set a value in the constructor and expose only a getter.

How can you set the n-th bit

Shift n times to the left and OR

How can you toggle the nth Bit?

Shift n times to the left and XOR

How can you unset the nth bit

Shift n times to the left and invert, then AND

How do you test if the n-th bit is set?

Shift n times to the right and then AND

Flash objects

Shockwave files that allow visitors to interact with the site. For example, you might include a Flash button to allow your visitor to go back, or go forward. File names: .fla is the source file for a flash object; .swf is a flash movie file.

UPDATE

Statement used to update records

Tags

Tags are used to surround text which has special meaning in HTML. Tags tell the browser what to do. The tag set <P> </P> is used to tell the browser that text between the two tags is to be set apart as a separate paragraph in HTML.

SDLC (Step 5)

Testing/debugging

Singleton pattern

The Singleton pattern is a creational pattern that will restrict an application to creating only a single instance of a particular class type. For example, a Web site will need a database connectivity object, but should have only one so you could use Singleton to enforce that restriction.

...

The String split() method exists in a version that takes a limit as a second parameter. Here is a Java String split() example using the limit parameter: String source = "A man drove with a car."; int limit = 2; String[] occurrences = source.split("a", limit); The limit parameter sets the maximum number of elements that can be in the returned array.

programming

The art of creating a program.

How do you make an object serializable?

The class must implement the java.io.Serializable interface

...

The indexOf() method returns the index of where the first character in the first matching substring is found.

digital footprint

The information about someone on the Internet.

flow of execution

The order in which statements are executed during a program run.

...

The protected access modifier provides the same access as the default access modifier, with the addition that subclasses can access protected methods and member variables (fields) of the superclass. This is true even if the subclass is not located in the same package as the superclass.

DNS (domain name service)

The service that translates URLs to IP addresses.

HTML Tag

The special set of characters that tells the machine where the start and end of an HTML element is and what type it is.

syntax

The structure of a program

...

The substring() method takes two parameters.

Describe the idea behind event driven concurrency!

The system's workers react to events occurring in the system, either received from the outside world or emitted by other workers.

Explain the consequences of workers NOT sharing state with each other!

They can be implemented without having to think about all the concurrency problems that may arise from concurrent access to shared state. This makes it much easier to implement workers. You implement a worker as if it was the only thread performing that work - essentially a singlethreaded implementation.

NOT BETWEEN

To display the keyword outside the range

value (1, 2, 3)

Used to add data with the INSERT INTO function

Unified Modeling Language

Unified Modeling Language (UML), a way to graphically represent your OOP designs.

URL

Uniform Resource Locator. It is used to specify file locations of html or other files. Example: http://mrbenrud.com/

%X

Unsigned Hexadecimal (uppercase)

%x

Unsigned hexadecimal (lowercase)

Organised Database

Updated frequently and checked for errors

call (a variable)

Use a variable in a program.

Solid State Drive (SDD)

Uses flash storage

Hard Disk Drive (HDD)

Uses magnetic tape

Magnetic storage

Uses patterns on magnetic tape. Cheap for high storage but data access is slow

Optical storage

Uses patterns on reflective disc. Cheap for high storage, but not always compatible and may require specific drivers to read/write

Optical Character Recognition (OCR)

Uses scanner and piece of software to examine contents of a page

Flash storage

Uses type of ROM that can be overwritten. Access at high speeds and has no moving parts, but more expensive and has limited read/write cycles

How do you assign the value from a prompt to a non-string variable?

Using a parse. Example : var intVar = parseInt(prompt("Text Here"));

...

Using the keyword super refers to the superclass of the class using the super keyword. When super keyword is followed by parentheses like it is here, it refers to a constructor in the superclass.

computer science

Using the power of computers to solve problems.

May a primitive variable may be declared volatile or synchronized?

Volatile, but not synchronized.

...

When concatenating Strings you have to watch out for possible performance problems. Concatenating two Strings in Java will be translated by the Java compiler to something like this: String one = "Hello"; String two = " World"; String three = new StringBuilder(one).append(two).toString(); As you can see, a new StringBuilder is created, passing along the first String to its constructor, and the second String to its append() method, before finally calling the toString() method. This code actually creates two objects: A StringBuilder instance and a new String instance returned from the toString() method.

How can Functional Parallelism be performant?

When each function call can be executed independently, each function call can be executed on separate CPUs. That means, that an algorithm implemented functionally can be executed in parallel, on multiple CPUs.

When will the following loop terminate? while keep_on_going != 999 :

When keep_on_going refers to a value not equal to 999

global variable

available everywhere

Whitespace

Whitespace refers to any character that shows up as a blank space on the screen, such as a space, a tab, or a new line. Whitespace helps separate different parts of the document to make it easier to read.

script

Will input the name of the script into your code when called

How do statements end in JavaScript?

With a semicolon ";"

How do you denote a string in JavaScript

With either single or double quotes surrounding the data

How do you create a single line comment in JavaScript?

With two forward slashes "//"

Internet

World-wide network of networks

write(stuff)

Writes stuff to file

May a volatile variable that is an object reference be null?

Yes! (because you're effectively synchronizing on the reference, not the actual object).

...

You can access the length of an array via its length field

...

You can also get the byte representation of the String method using the getBytes() method. Use the specific charset to do that.

same namespace in multiple files

You can use the same namespace in multiple files, which will allow you to put multiple classes, each defined in separate scripts, within the same namespace.

what does the compile() method do?

[edits source] the compile method is used to compile and recompile a regexp y=/regexp/ y.compile(regexp,modifier)

bracket examples

[new RegExp("[abc]") or /[abc]/] [abc] - find any character between bracks [^abc] - find any char not in bracks [0-9] - find any digit 0-9 [A-Z] - find any char from uppercase A to uppercase Z [a-z] - find any char from lowercase a to lowercase z [A-z] - find any char from uppercase A to lowercase Z (red|blue|green) - find any of the alternations specified

what is a cookie?

a cookie is a variable that is stored on a users computer.

boolean

a data type that is like a light switch. it can only have two values: true, false

module

a file containing Python definitions, statements or scripts, can be user defined or from a built-in library

static function variable

a static function variable remembers its value each time a function is called image: function test() { static $n = 1; echo "$n<br>"; $n++; }

Trustworthy

able to be relied on as honest or truthful.

global

access variables defined outside functions

Composite pattern example

an HTML form contains one or more form elements. From a programming perspective, certain behaviors will apply to both the entire form and its individual components: • Display • Validate • Show errors apply Composite so that the entire form or just an individual component can be treated the same Another sign that the Composite pattern may apply is when you're working with a tree-like structure.

Background Color tag

background-color: value;

\\

backslash (\)

LOG10E

base-10 logarithm of E approx (0.434)

composite pattern example pt3

class FormElement extends FormComponent { function add(FormComponent $obj) { return $obj; // Or false. } function display() { // Display the element. } } $form = new Form(); $email = new FormElement(); $form->add($email);

Color tag

color: value;

concatenation

combine

TRUNCATE TABLE

delete data in table, not table

del keyword

deletes key/value pairs from dict

Every if statement must have a(n)...

else

The process known as the _____ cycle is used by the CPU to execute instructions in a program.

fetch-decode-execute

\B meta character does what?

find a match that is not at the beginning of a word (or returns null) x="hello world" y=/\Borld/g document.write(x.match(y))--> orld

find

find files

Describe the logic that needs to be followed when implementing Comparator.

int compare(Object o1,Object o2) This method compares o1 and o2 objects. and returns a integer.Its value has following meaning. 1. positive - o1 is greater than o2 2. zero - o1 equals to o2 3. negative - o1 is less than o1

Describe the logic that needs to be followed when implementing Comparable

int compareTo(Object o1) This method compares this object with o1 object and returns a integer. Its value has following meaning 1. positive - this object is greater than o1 2. zero - this object equals to o1 3. negative - this object is less than o1

how Do you calculate the reminder of 100 / 9 ?

int remainder = 100 % 9;

create an array using literals

int[] ints2 = new int[]{ 1,2,3,4,5,6,7,8,9,10 };

integer vs. float

integer is a number w/out a decimal; float is a number with a decimal

behavioral pattern example 1

interface Filter { function filter($str); } class HtmlFilter implements Filter { function filter($str) { return $str; // Strip out the HTML. } } class SwearFilter implements Filter { function filter($str) { return $str; // Cross out swear words. } }

Where is the Math class located?

java.lang.Math

_______________ are small central processing unit chips.

micro processors

How is the comparable interface implemented?

public interface Comparable<T>{ int compareTo(T o) { return 1; //if this > that return 0; //if this == that return -1; //if this < that } }

How can you assign a specific value to each element of an array or subarray?

public static void Arrays.fill

.read()

reads the specified file use by entering at the end of the variable used to specify the file you have 'opened'.

ALL

selects all data

What does % when printing string

they allow the variables outside the string to enter into the string

+

used for addition

shift() method does what?

removes the first elements in an array and returns it [alters original] array.shift() x=["1","2","3"] document.write(x.shift())--->1 document.write(x)--->2,3

AS

renaming, AS tot_dollar #rename col as tot_dollar

assignment statement

replaces item in list list_name[index number] = "reassignment"

How do you display a confirmation?

confirm("Message Text Here");

What can you use Arrays.parallelPrefix for?

cumulate values in an array

%r is used for...

debugging and display

In a print statement, you can set the _____ argument to a space or empty string to stop the output from advancing to a new line.

end

HLT

end mneumonic

A(n) _______________ character is a special character that is preceded with a backslash, appearing inside a string literal.

escape

What is escape analysis?

escape analysis is a method for determining the dynamic scope of pointers - where in the program a pointer can be accessed.

substring() does what?

extracts characters from a string between two specified #'s and returns it as a new string. [start at 0] e.x. string.substring(from,to) x="hello world" document.write(x.substring(0,4))--->hello

Float tag

float: value;

Font Size tag

font-size: value;

How would you name a static factory method that is like getInstance, but used when the factory method is in a different class. Type indicates the type of object returned by the factory method.

get<Type>

How would you name a static factory method that returns an instance that is described by the parameters but cannot be said to have the same value.

getInstance

env

look at your environment

...

loop over each string in the array: for(String aString : strings) { // }

A disk drive stores data by _______________ encoding it onto a circular disk.

magnetically

The disk drive is a secondary storage device that stores data by _____ encoding it onto a spinning circular disk.

magnetically

.lower

makes lowercase

.upper

makes uppercase

\b

matches a word boundar

x?

matches an option x character (in other words, it matches an x wero or one times)

x{n,m}

matches an x character at least n times, but not more than m times

\D

matches any non-numeric character

\d

matches any numeric digit

what does the n* quantifier do?

matches any string that contains zero or more occurrences of n x="hello world" y=/lo*/g document.write(x.match(y))--> lo,l

x*

matches x zero or more times

include and require difference

require() (as opposed to include()), the script will stop executing with a fatal error if the file could not be included (and there is no point in continuing without this file).

INITCAP

returns first character of each word upper case

AVG

returns the average value in column

charAt() method does?

returns the character at the specified index e.x. string.charAt(index) x="hello world" document.write(x.charAt(0))-->h

COUNT

returns the count of values in a column

_______________ is a type of memory that can hold data for long periods of time, even when there is no power to the computer.

secondary storage

Join Two Tables

select Salesperson.Name from Salesperson, Orders where Salesperson.ID = Orders.salesperson_id and cust_id = '4';

How dates work

select User.name, User.phone_num, max(UserHistory.date) from User, UserHistory where User.user_id = UserHistory.user_id and UserHistory.action = 'logged_on' and UserHistory.date >= date_sub(curdate(), interval 30 day) group by (User.user_id);

Return empty values

select distinct u.user_id from User as u left join UserHistory as uh on u.user_id=uh.user_id where uh.user_id is null

the boolean has a default value of?

true

True and False symbol in PhP

true and false

The while loop (a loop executed when a specific condition is met) syntax?

while(variable<=endvalue) { code to be executed }

_

wildcard used to substitute for any single character, multiple can be combined together

NOT IN

will exclude keywords from a list

How do you make the browser load a new page using JavaScript?

window.location = "New Web Address Here";

How do you view the current web address using JavaScript?

window.location();

How do you assign actions to the window onLoad event?

window.onload = function() {//actions here}

x=x+y is the same as what? or x=x/y?

x+=y or x/=y

prompt box syntax?

x="prompt("text here","default value"); if(x!="null" && x!="") { alert("hello "+x+" how are you today?") }

numerical comparison operators?

x==y [x is equal to y] x===y [x is exactly equal to y] != [not equal to] > [greater than] < [less than] >= [greater than or equal to] <= [less than or equal to]

Can variables include other variables?

yes

can variables include other variables?

yes

static variable

static variable is remembered across all instances of that class (across all objects based on the class). To declare a static attribute, use the static keyword after the visibility indicator: class SomeClass { public static $var = 'value'; }

how to access an array?

string[array index]

numbers + strings =? 5+"5" = ?

strings 55

exponents in python

**

modules

-aka libraries -feature sets you can import into a program

filter()

-filters a list for terms that make the function true filter(function, list) filter(lambda x: x%3 ==0, my_list) -for anonymous (throwaway) functions

What is the result: Car car = new Car(); boolean isVehicle = car instanceof Vehicle;

...

Comparators

< > <= >= == !=

...

A Java lambda expression is thus a function which can be created without belonging to any class. A lambda expression can be passed around as if it was an object and executed on demand.

...

A Java method parameter can be declared final, just like a variable. The value of a final parameter cannot be changed. That is, if the parameter is a reference to an object, the reference cannot be changed, but values inside the object can still be changed.

Packet

A divided, identifiable section of data

List/Array

A list of possible values for a variable. In the fortune teller there was an array of jobs.

algorithm

A list of steps to finish a task. A set of instructions that can be performed with or without a computer. For example, the collection of steps to make a peanut butter and jelly sandwich is an algorithm.

parameter

A name used inside a function to refer to the value which was passed to it as an argument.

file

A named entity, usually stored on a hard drive, floppy disk, or CD-ROM, that contains a stream of characters.

LAN (Local Area Network)

A network between computers in a local area (like inside a building), usually connected via local cables. See also WAN

Citation

A quotation from or reference to a book, paper, or author, especially in a scholarly work.

0001 opcode

ADD

Peer-to-peer Network Model

All nodes have equal status, communicate node to node

Logic error

An error that means the code will run, but will not do what is expected.

Web Designer

Any professional who performs design functions for a Web site. This can include site architecture, programming, logo design or site layout functions.

block-based programming language

Any programming language that lets users create programs by manipulating "blocks" or graphical programing elements, rather than writing code using text. Examples include Code Studio, Scratch, Blockly, and Swift. (Sometimes called visual coding, drag and drop programming, or graphical programming blocks)

Complex Instruction Set Computing (CISC)

Architecutr used by laptops and desktops

increment

Both as a noun and as a verb, increment means to increase by 1.

0110 opcode

Branch always

1000 opcode

Branch positive

decompose

Break a problem down into smaller pieces.

Input interrupt

Buffer nearly empty

Corrective Maintenance

Bug fixes, patches

How can Double-checked locking improve performance?

By limiting synchronization to the rare case of computing the field's value or constructing a new instance for the field to reference and by foregoing synchronization during the common case of retrieving an already-created instance or value.

UNION ALL

Combine both tables and show all duplicates

Creational patterns

Creational patterns create objects, saving you from having to do so manually in your code. The Builder, Factory, Prototype, and Singleton patterns are all creational;

CIR

Current Instruction Register

Stores most recently fetched instruction waiting to be decoded or executed

Current Instruction Register

pattern matching

Finding similarities between things.

''',"""

Free-form strings

Crowdsourcing - (ex. House t-shirts, fifth hour!)

Getting help from a large group of people to finish something faster.

Semicolon ;

Goes at the end of a SQL statement so it will execute

my_list.insert(4, "cat")

Inserts the string "cat" at the 4th position in a list

What do you need to consider when creating invariants for a class using a builder?

It is critical that - the build method check these invariants. - invariants are checked after copying the parameters from the builder to the object - invariants are checked on the object fields rather than the builder fields. - If any invariants are violated, the build method should throw an IllegalStateException

Personal Area Network (PAN)

Links personal devices such as phones, tablets, etc.

0101 opcode

Load

Boot loader

Loads kernal of operating system into memory

How do you clone an object?

MyClone a = (MyClone) c.clone() - TypeCast is nessesary. - handle CloneNotSupportedException

Karnaugh Maps

Pattern recognition used to interpret truth tables (possible inputs mapped against possible outputs to identify logic circuit)

pixel

Short for "picture element" it is the fundamental unit of a digital image, typically a tiny square or dot which contains a single point of color of a larger image.

%x

Signed hexidecimal

%d, %i

Signed integer decimal

/

Slash: used for division

Bottleneck

Slowest part of a system

Perfective Maintenance

Small and minor changes made

What is the Holder Class Idiom?

Solution to Singleton with the initialize-on-demand, holder class idiom that implicitly incorporates lazy initialization by declaring a static variable within a static Holder inner class: final class Foo { // Lazy initialization private static class Holder { static Helper helper = new Helper(); } public static Helper getInstance() { return Holder.helper; } }

ISP (Internet Service Provider)

Someone that provides access to the Internet and web hosting.

Virtual storage

Stored on cloud

How do I get a number from someone so I can do math?

That's a little advanced, but try x = int(raw_input()) which gets the number as a string from raw_input() then converts it to an integer using int()

len[2] = 3

The 2nd term of the list is now equal to 3

...

The Math.min() method returns the smallest of two values passed to it as parameter.

...

The Math.random() method returns a random floating point number between 0 and 1.

ARPANET

The first network, created by ARPA

...

The object versions of the primitive data types are immutable.

...

The parameters mean "from - including, to - excluding".

What is the output of the following print statement? print('The path is D:\\sample\\test.')

The path is D:\sample\test

function call

The piece of code that you add to a program to indicate that the program should run the code inside a function at a certain time.

Indentation

The placement of text farther to the right, or left, to separate it from surrounding text which helps to convey the program's structure.

When fetching a URL in a browser, what happens after the HTTP request is sent to the host?

The software configured to listen to that port processes the request and forms a response.

What is the <noscript> tag used for?

The text between the opening and closing tag is displayed if JavaScript is disabled or otherwise not available

define a namespace

To define a namespace, you'll want to create a new file that will only store the namespaced code. Create a namespace by using the namespace key-word, followed by the identifier: namespace SomeNamespace;

repeat

To do something again.

trace

To follow the flow of execution of a program by hand, recording the change of state of the variables and any output produced.

FOR Loop

To repeat a commands a set number of times.

()

Use these types of brackets around conditions to make code easier to read

"""

Use to make a string that needs multiple lines for the string text.

' '

Used around text strings for conditions for easier code reading and machine understanding

/ * * /

Used to comment multiple lines in SQL

When fetching a URL in a browser, what happens after the socket is opened?

When a connection is open, the HTTP request is sent to the host.

What is a race condition?

When the result of multiple threads executing a critical section may differ depending on the sequence in which the threads execute.

Explain the channel model!

Workers do not communicate directly with each other. Instead they publish their messages (events) on different channels. Other workers can then listen for messages on these channels without the sender knowing who is listening.

Is JavaScript case sensitive?

Yes

cycle a linked list to the right by K steps

because K can be larger than N, use K mod N find the tail node, link it to the head. the new head is then K steps away.

The smallest storage location in a computer's memory

bit

8 & 5

bitwise AND Turns on bits turned on in BOTH inputs 0b100 & 0b101 = 0b100

5 << 1

bitwise left shift -shifts turned on bits to the left 0b001 << 1 = 0b010

5 >> 4

bitwise right shift -shifts turned on bits to the right 0b010 >> 1 = 0b001

Border Color tag

border-color: value;

Border Style tag

border-style: value;

Border Width tag

border-width: value;

string

can contain letters, numbers, and symbols

variables

can only start with a character (not a number)

except

catches the exception and executes codes

cd

change directory

What String object method is used to get the character at a specified index position?

charAt(position);

How do you check if a number is even?

check if number AND 1 is 0

class inheritance syntax

class ChildClass extends ClassName { }

static variable and static function example

class SomeClass { public static $counter = 0; function _ _construct() { self::$counter++ } } class SomeClass { public static function doThis() { // Code. } } echo SomeClass::$counter; // 0 SomeClass::doThis();

singleton implementation

class SomeClass { static private $_instance = NULL; static function getInstance() { if (self::$_instance == NULL) { self::$_instance = new SomeClass(); } return self::$_instance; } private function __construct(){} }

Square Class Definition

class Square extends Rectangle { function _ _construct($side = 0) { $this->width = $side; $this->height = $side; } } // End of Square class.

HTML Class tag

class="something">

_______________ are notes of explanation that document lines or sections of a program.

comments

A(n) _______________ expression is made up of two or more Boolean expressions.

compound

Multiple Boolean expressions can be combined by using a logical operator to create _____ expressions.

compound

What String object method is used to concatenate multiple strings?

concat(var1, var2, varN);

In a decision structure, the action is _______________ executed because it is performed only when a certain condition is true.

conditionally

A(n) _____ structure is a logical design that controls the order in which a set of statements execute.

control

When implementing equals, how do you compare float

convert to int using Float.floatToIntBits, then use ==

When implementing equals, how do you compare doubles

convert to long using Double.doubleToLongBits, then use ==

toLowerCase() method does what?

converts a string to lowercase letters e.x. string.toLowerCase() x="BLAH" document.write(x.toLowerCase())---->blah

upper()

converts a string to uppercase

toUpperCase() method does what?

converts a string to uppercase letters e.x. string.toUpperCase() x="blah" document.write(x.toUpperCase())---->BLAH

toString() method does what?

converts an array to a string, returns the result x=["1","2","3"] document.write(x.toString())-->1,2,3

str

converts to a string

fromCharCode() method does what?

converts unicode values into characters [does not use strings] document.write(string.fromCharCode(72))--> H

cp

copy a file or directory

The _______________ is the part of a computer that actually runs programs and is the most important component in a computer.

cpu

WHERE

create a condition from a table

raise

create a user defined exception

Real

data type, a decimal value

Date

data type, formatted as YYYY-MM-DD for the year, month, and day

Python uses _______________ to categorize values in memory.

data types

DAT

declare mneumomic

del

deletes objects

%s is used for

display

How do you code a button.onclick event handler?

document.getElementById("ButtonId").onclick = functionName;

For checkboxes, how do you set the current checked status of the control?

document.getElementById("CheckboxId").checked = true; //Could also be false

For textboxes, How do you set the control to be disabled?

document.getElementById("TextBoxId").disabled = true; //Could also be false to enable it

The decision structure that has two possible paths of execution is known as _____.

double alternative

\

escape; tells python to ignore following character, or puts difficult characters into strings when used with specific *escape sequences*

e is what?

eulers numbers approx (2.718)

generic import

ex: import math (import module)

xargs

execute arguments

exec

executes Python code dynamically

Conditional Statement: Else

executes some specified code after finding that the original expression was False (or opposite of the if command)

return

exits the function and returns a value

**

exponent

...

fields cannot be overridden in a subclass. If you define a field in a subclass with the same name as a field in the superclass, the field in the subclass will hide (shadow) the field in the superclass.

How do you code a for statement in JavaScript?

for (counter; condition; incrementor) {}

from

for importing a specific variable, class or a function from a module

javascript syntax for a (limited loop based on specifications) syntax?

for(variable=startvalue;variable<=endvalue;variable=variable+increment) { code to be run until loop is complete. }

method

function of an object

abs()

gives absolute value of that number (distance from zero)

data types

i.e. numbers and booleans

Conditional Statement: if

if is a conditional statement that executes some specified code after checking if its expression is True.

optparse first command

import optparse parser = optparse.OptionParser

What String object method is used return the position of the first instance of a specified search string, starting from the specified index?

indexOf(searchValue, startPosition); //If no startPosition is specified, the search begins from the start of the string

The _____ function reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program.

input

The _____ built-in function is used to read a number that has been typed on the keyboard.

input()

The Python _______________ is a program that can read Python programming statements and execute them.

interpreter

Rollover Image

is a handy little function that allows you to place two images in the same spot on your page. The image will change from one to the other as the visitor mouses over it.

which package is Arrays ?

java.util.Arrays

...

java.util.List interface is a subtype of the java.util.Collection interface. It represents an ordered list of objects, meaning you can access the elements of a List in a specific order, and by an index too. You can also add the same element more than once to a List.

Which package contains ForkAndJoinPool?

java.util.concurrent

<, <=, >, >=

less than, less than or equal to, greater than, greater than or equal to

string methods

let you perform specific tasks on strings

WHERE city LIKE '[bsp]%'; or WHERE city NOT LIKE '[!bsp]%';

lets you find a search with any character beginning that is not the following

WHERE city LIKE '[a-c]%';

lets you find a search with any character in a range

WHERE city LIKE '[bsp]%';

lets you select to begin with any of the following characters

ls

list directory

Syntax to index 2 nested lists?

list[x][y]

LDA

load mneumonic

What type of error produces incorrect results but does not prevent the program from running?

logic

mkdir

make directory

shared objects can be made thread safe by ..

making sure that these objects are never updated by making them immutable.

basic regex syntax

match = re.search(pattern, text)

what does the n? quantifier do?

matches any string that contains zero or one occurences of n x="hello world" y=/lo?/g document.write(x.match(y))--> lo,l

what does the ?=n quantifier do?

matches any string that is followed by a specific string of n x="hello world" y=/hello(?=world)/g document.write(x.match(y))--> hello

what deos the ?!n quantifier do?

matches any string that is not follwed by specific string n x="hello world" y=/hello(?!world)/g document.write(x.match(y))-->

x+

matches x one or more times

...

method named replace() which can replace characters in a String. The replace() method does not actually replace characters in the existing String. Rather, it returns a new String instance which is equal to the String instance it was created from, but with the given characters replaced.

pop()

method removes and returns the last object from a list

MOD(x,y)

modulo - returns the integer remainder of x divided by y (same as x%y)

echo

pint some arguments

What is the command to display a prompt?

prompt("Text Here");

DISTINCT

selects unique records, discards duplicate records

incorporate multiple traits into a class

separate each trait by a comma: use tTrait1, tTrait2;

STA

store mneumonic

variable

stores a piece of data and gives it a specific name

the last index in a string is?

string.length-1

Factory pattern

the Factory pattern is used to manufacture potentially multiple objects of many different class types.

the purpose of the boolean object?

to convert a non-boolean value to a boolean value (true or false) value.

What Date object method is used to return a string containing the date?

toDateString();

What Number object method is used to return a number in exponential format with the specified number of decimal places?

toExponential(digits);

What method allows you to set the digit precision of a decimal number?

toFixed(digitCount);

What Number object method is used to round numbers to the specified number of decimal places?

toFixed(digits);

How can you sort with different rules on the same array?

use a comparator:

When implementing equals, how do you compare possibly-null objects?

use both == and equals

-

used for subtraction

How do you declare a variable in JavaScript?

var variableName;

What is the format for the while clause in Python

while condition : statement

A location connected to the Internet that maintains one or more pages on the World Wide Web.

while loop

Width tag

width: value;

EXTRACT()

Returns a single part of a date/time

aliases

Multiple variables that contain references to the same object.

SDLC (Step 2)

Requirements defined

Byte (Binary Term)

A computer storage unit containing 8 bits. Each byte can store one text character.

What type of loop structure repeats the code a specific number of times

Count-controlled loop

Bandwidth

A measure for the speed (amount of data) you can send through an Internet connection. The more bandwidth, the faster the connection.

Ping

A method used to check the communication between two computers. A "ping" is sent to a remote computer to see if it responds.

truncate

A method/function/command to empty the file. Be careful if you care about the file

readline

A method/function/command to read just one line of a text file

Name the consequences of creating only a private default constructor.

- The class cannot be instantiated. - prevents the class from being subclassed: All constructors must invoke a superclass constructor, explicitly or implicitly, and a subclass would have no accessible superclass constructor to invoke.

Parallel Workers Disadvantages

- The shared workers often need access to some kind of shared data, either in memory or in a shared database. That creates complexity. Threads need to avoid race conditions, deadlock and many other shared state concurrency problems. - Part of the parallelization is lost when threads are waiting for each other when accessing the shared data structures. Many concurrent data structures are blocking, leading to contention and eventually serialization. - Shared state can be modified by other threads in the system. Therefore workers must re-read the state every time it needs it, to make sure it is working on the latest copy. This is true no matter whether the shared state is kept in memory or in an external database. A worker that does not keep state internally (but re-reads it every time it is needed) is called stateless . Re-reading data every time you need it can get slow. Especially if the state is stored in an external database.

What kind of information is contained on the heap?

- all objects created in your Java application, regardless of what thread created the object. - This includes the object versions of the primitive types (e.g. Byte, Integer, Long etc.). - It does not matter if an object was created and assigned to a local variable, or created as a member variable of another object, the object is still stored on the heap.

argv

- argument variable - variable holds arguments passed to script when running it script, first, second, third = argv (line 3) - script = name of python script - first, second, third = 3 variables arguments assigned to

open()

- function opens a file - Required argument is filename - Default access_mode is read(r) - Does not return actual content; creates/reads fileObject -

close()

- method flushes unwritten information and closes file object - Not necessary, but important best practice

read()

- method reads a string from an open file - fileObject.read([count]) - Count = # of bytes to read, reads as much as possible if not given

Would a local variable be stored on heap or stack?

- primitive type, it is totally kept on the thread stack - reference to an object. In that case the reference (the local variable) is stored on the thread stack, but the object itself if stored on the heap.

Timeline

Allows you to set up a web page wherein objects change (appear, disappear, move, morph).

What is important to remember when creating a builder?

- the builder's setter methods return the builder itself so that invocations can be chained - the created object should be immutable - the builder is a static member class of the class it builds.

What is the range of byte

-128 to 127

What is the range of int?

-2,1 billion to 2,1billion

What is the range of short?

-32,768 to 32,767

How do you create a Thread?

1) Extend Thread (java.lang.Thread) 2) Implement Runnable (java.lang.Runnable)

Functions

1) HEADER def function and add parameters 2) add additional """COMMENT here""" that explains the function 3)BODY describes procedures the function carries out, is indented

Describe the contract that needs to be followed when implementing hashcode.

1) if a class overrides equals, it must override hashCode 2) equals and hashCode must use the same set of fields 3) if two objects are equal, then their hashCode values must be equal as well 4) if the object is immutable, then hashCode is a candidate for caching and lazy initialization

Software interrupt example

Arithmetic overflow

Describe the builder pattern

1) The client gets a builder object. 2) The client calls setter-like methods on the builder object to set each optional parameter of interest. 3) the client calls a parameterless build method to generate the object, which is immutable.

Declaring a volatile Java variable means:

1) The value of this variable will never be cached thread-locally: all reads and writes will go straight to "main memory"; 2) Access to the variable acts as though it is enclosed in a synchronized block, synchronized on itself.

List the steps to implement equals

1) Use this == that to check reference equality 2) Use instanceof to test for correct argument type 3) Cast the argument to the correct type 4) Compare significant fields for equality

Explain the the service provider framework components

1) a service interface, which providers implement; 2) a provider registration API, which the system uses to register implementations, giving clients access to them 3) a service access API, which clients use to obtain an instance of the service 4) optionally, a service provider interface, which providers implement to create instances of their service implementation. In the absence of a service provider interface, implementations are registered by class name and instantiated reflectively.

Name some positive examples of a non-instantiable class

1) group related methods on primitive values or arrays, in the manner of java.lang.Math or java.util.Arrays. 2) group static methods, including factory methods, for objects that implement a particular interface, in the manner of java.util.Collections. 3) group methods on a final class, instead of extending the class.

If you overwrite clone(), which 3 rules must this method obey?

1) the new object should be new: memory address should differ 2) Both should be an object of the same class 3) Both should be in the same state: a.clone().equals(a) == true

CREATE TABLE celebs (id INTEGER, name TEXT, age INTEGER);

1. CREATE TABLE is a clause that tells SQL you want to create a new table. 2. celebs is the name of the table. 3. (id INTEGER, name TEXT, age INTEGER) is a list of parameters defining each column in the table and its data type.

function

1. Names code like variables name strings/numbers 2. Takes arguments the way scripts take argv 3. Using 1 and 2, allows for mini-commands

github steps

1. git status 2. git add (adds to staging) 3. git commit -m "What you've done" 4. git push -u origin master

Order of Conditionals

1. not 2. and 3. or

mutable type

A compound data type whose elements can be assigned new values.

What is -1 in twos complement?

1111 1111

IPV6

128-bit identifier in network (8 groups of hex values)

What is the size of char?

16 bits

What is the size of short?

16 bits

First trial of email

1972

First trial of the World Wide Web

1990

What are the values that the variable num contains through the iterations of the following for loop? for num in range(2, 9, 2)

2, 4, 6, 8

If value1 is 2.0 and value2 is 12, what is the output of the following command? print(value1 * value2)

24.0

What is the largest value that can be stored in one byte?

255

The program development cycle is made up of _____ steps that are repeated until no errors can be found in the program.

3

IPV4

32-bit identifier in network (4 byte groups)

How can you create a duplicate of an array range?

Arrays.copyOfRange

what is the size of double?

64 bits

what is the size of long?

64 bits

After the execution of the following statement, the variable price will reference the value _____. price = int(68.549)

68

When applying the .3f formatting specifier to the following number, 76.15854, the result is _______________.

76.159

What is the size of byte?

8 bits

How many characters to a line?

80 characters

When implementing equals, how do you compare array fields

: use Arrays.equals

What are the Doctype Tags?

<!DOCTYPE>

Comment tag

<1-- -->

Hyperlink tags

<a> </a>

None

A special Python value. One use in Python is that it is returned by functions that do not execute a return statement with a return argument.

operator

A special symbol that represents a simple computation like addition, multiplication, or string concatenation.

Protocol

A standard or rule that defines how devices should communicate

____ is a string of characters that the database recognizes as a valid command.

A statement

conditional statement

A statement that controls the flow of execution depending on some condition. In Python the keywords if, elif, and else are used for conditional statements.

string

A string is a list of characters inside of quotes. Strings can be made of single, double or triple quotes.

View

A subset of data in a database

String

A text value such as a word or name

Heading

A title or summary for a document or section of a document.

Integer

A whole number

_____ changes an existing table

ALTER TABLE

Why would you avoid creating more than one adapter object per backend?

An adapter is an object that delegates to a backing object, providing an alternative interface to the backing object. Because an adapter has no state beyond that of its backing object, there's no need to create more than one instance of a given adapter to a given object. For example, the keySet method of the Map interface returns a Set view of the Map object, consisting of all the keys in the map. Naively, it would seem that every call to keySet would have to create a new Set instance, but every call to keySet on a given Map object may return the same Set instance.

Which computer language uses short words known as mnemonics for writing programs?

Assembly

input()

Assumes input is valid python expression, returns evaluated result

Behavioral patterns definition

Behavioral patterns are used to address how an application runs. The Strategy pattern can change an algorithm on the fly (an algorithm just being a process or set of code used to perform a calculation or solve a problem). Strategy is most useful in situations where you have classes that may be similar, but not related, and differ only in their specific behavior.

...

Binary search If more than one element exists in the array with the searched value, there is no guarantee about which element will be found. If no element is found with the given value, a negative number will be returned. The negative number will be the index at which the searched element would be inserted, and then minus one.

Machine code

Binary sequences

9 | 4

Bitwise OR Turns on bits if turned on in either input 0b001 | 0b100 = 0b101

12 ^ 42

Bitwise XOR, EXCLUSIVE OR Turns bits on if EITHER but not BOTH bits of inputs are turned on 0b1010 ^ 0b1101 = 0b0111

0111 opcode

Branch zero

How can you avoid race conditions?

By proper thread synchronization in critical sections.

TO_DATE ( String, [Format], [Optional Setting] )

Converts a Date to a string

from sys import argv

Called an "import." This is how you add features to your script from the Python feature set. Rather than give you all the features at once, Python asks you to say what you plan to use. This keeps your programs small, but it also acts as documentation for other programmers who read your code later. May access features other than "argv"

global variable

Can be seen through a program module, even inside of functions.

%d

Converts a signed integer decimal

Compiler

Converts all of code to object code, and then machine code

Address Bus

Carries data from MAR to RAM

SELECT * INTO newtable FROM table1 WHERE 1=0;

Create a new empty table

Web Authority Tool

Create website without writing code

CREATE SEQUENCE [name] STARTS WITH [num] ... INCREMENT BY [num]

Creates a sequence with increments

CREATE/DROP INDEX index_name ON table_name (column_name)

Creates or Drops an Index as a search key

Harvard architecture

Data and instructions stored in separate memory units, can work through instructions concurrently, data and instructions have different buses

AUTO_INCREMENT

Data type to auto increase the entries for a column in table

>=

Greater than or equal

Agile Programming

Group of methodologies, cope with changing requirements

Karnaugh Map groups

Groups of 2 to the power of n (1, 2, 4, 8, etc.)

Text based

HTML editor lets the user see and edit HTML code directly. Usually the HTML tags are displayed in a different color than the surrounding text which makes them easier to see and work with. This web page was written using the Arachnophilia v3.9 HTML editor.

Modem

Hardware equipment to connect a computer to a telephone network Typically used to connect to the Internet via a telephone line.

Output device

Hardware that feeds data out of the computer to be retrieved in some way

When multithreading, local primitive variables are stored ..

In each thread's own stack. That means that local variables are never shared between threads. That also means that all local primitive variables are thread safe.

...

Java annotations are typically used for the following purposes: Compiler instructions Build-time instructions Runtime instructions

What is serialVersionUID?

In addition to implementing the Serializable interface, a class intended for serialization should also contain a private static final long variable named serialVersionUID. The serialVersionUID variable is used by Java's object serialization API to determine if a deserialized object was serialized (written) with the same version of the class, as it is now attempting to deserialize it into. If you make changes to the class that affect serialization, you should also change its serialVersionUID value.

Ex. for INNER Join - FROM customers, items

Most common join "equijoin" or where two tables data are being pulled

Explain advantages of channel vs actor model!

In the channel model, workers do not communicate directly with each other. Instead they publish their messages (events) on different channels. Other workers can then listen for messages on these channels without the sender knowing who is listening.

Bookmark

In web terms: A link to a particular web site, stored (bookmarked) by a web user for future use and easy access.

SPAM

In web terms: The action of sending multiple unwelcome messages to a newsgroup or mailing list.

...

It is possible to get a character at a certain index in a String using the charAt() method.

...

It is possible to have many different variables reference the same object. This is not possible with primitive data types.

...

Java access modifier assigned to a Java class takes precedence over any access modifiers assigned to fields, constructors and methods of that class. If the class is marked with the default access modifier, then no other class outside the same Java package can access that class, including its constructors, fields and methods.

Parallel computing

Multiple processors have direct access to another

...

Java's auto boxing features enables you to use primitive data types where the object version of that data type was normally required, and vice versa. There is one pitfall to keep in mind though. A variable of type object (a reference to an object) can point to null, meaning it points to nothing - no object. If you try to convert null to a primitive value you will get a NullPointerException

OR

Join two or more conditions in the WHERE clause, at least condition must be true

AND

Joins two or more conditions in the WHERE clause; both conditions must be true

Backup utility

Keeps copies of files as a precaution against data loss

Javascript

Language providing functionality to web pages

CSS

Language providing styles to web pages

Most Significant bit (MSB)

Left-most bit of a binary sequence

<=

Less than or equal to

What are the valid characters for an identifier in JavaScript?

Letters, Numbers, Underscores, and Dollar Signs

...

Local classes can only be accessed from inside the method or scope block in which they are defined. Local classes can access members (fields and methods) of its enclosing class just like regular inner classes. Local classes can also access local variables inside the same method or scope block, provided these variables are declared final.

Which constructs can also be achieve thread synchronization?

Locks over critical sections or atomic variables like java.util.concurrent.atomic.AtomicInteger.

%

Modulus is NOT used as a "percentage" sign in the programming language

%=

Modulus AND. Takes modulus using two operands and assigns the result to left operand A%=B ~ A = A%B

...

More precisely, objects representing Java String literals are obtained from a constant String pool which the Java virtual machine keeps internally. That means, that even classes from different projects compiled separately, but which are used in the same application may share constant String objects. The sharing happens at runtime. It is not a compile time feature.

overloading

Overriding a method in such a way that it also takes a different number of arguments than the original is referred to as overloading a method. This can be accomplished in PHP but not as easily as overriding one.

raw_input

Pauses the script at the point it shows up, gets the answer from the keyboard, then continues the script. It is one of python's built-in functions Looks something like: var = raw_input("Enter_Something") Where "Enter_Something" is what the prompt is, asking you to enter some text, and var is where the text is stored Remember the %r in the prompt

%

Percent: used for modulus. The modulus operation finds the remainder after division of one number after another. Example: 75 % 4 = 3, because 4 * 18 is 72, with 3 remaining

Formatter

Placeholders that "punch out a hole in the code % is the character for this

Moving point left in Normalization....

Positive exponent

Hardware interrupt example

Power button

LEFT JOIN

Return all rows from the left table, and the matched rows from the right table

Node

Printer, speaker but also computer, phone, etc.

Software Development Life Cycle (SDLC)

Process of creating software

Keeps track of memory location of line of machine code being executed

Program Counter

PC

Program Counter

Utility

Program that maintains integrity of the Operating System

Rapid Application Development (RAD)

Prototypes developed in cycle until it is good enough to be fully developed

Metropolitan Area Network (MAN)

Provides WAN service on a smaller network/geographical area

Storage Area Network (SAN)

Provides dedicated network for large scale data storage

Internet (TCP/IP 2)

Provides links to transmit datagrams across different networks

Off-the-shelf software

Public, paid software

abstraction

Pulling out specific differences to make one solution work for multiple problems.

RIGHT JOIN

Return all rows from the right table, and the matched rows from the left table

True False

Python recognizes True and False as keywords representing the concept of true and false. If you put quotes around them then they are turned into strings and won't work.

list comprehension

Python rules for creating lists intelligently s = [x for x in range(1:51) if x%2 == 0] [2, 4, 6, 8, 10, 12, 14, 16, etc]

First come first serve

Queue created for tasks based on arrival

What symbol is used to mark the beginning and end of a string?

Quotation

What type of volatile memory is usually used only for temporary storage while running a program?

RAM

len(input)

Return the number of items from a sequence or characters in a string

exists()

Returns TRUE if file in argument exists, FALSE if not

items()

Returns a list of a dict's tuple pairs (key, value)

range()

Returns a list of numbers from start up to (but not including) stop start defaults to 0 and step defaults to 1 range(stop) range(start, stop) range(start, stop, step)

raw_input()

Raw input prompts the user for an input and then turns that input into a string. In between "(" and ")" the programmer writes the prompt that will prompt the user. When you set raw_input() equal to a variable, that variable becomes what the user inputs.

raw_input('prompt:')

Reads a line of input from user and returns as string

readline()

Reads one line of text file

Sequential Files

Records arranged one after another in a particular order (e.g: alphabetically)

Lossy Compression

Reduces size of file by removing data

Compression software

Reduces size of files

...

Regardless of what Collection subtype you are using there are a few standard methods to add and remove elements from a Collection. Adding and removing single elements is done like this:

RDBMS

Relational Database Management System

drop

Release your mouse button to "let go" of an item that you are dragging

iteration

Repeated execution of a set of programming statements.

A(n) ?? structure causes a statement or set of statements to execute repeatedly.

Repetition

What is the structure that causes a statement or a set of statements to execute repeatedly?

Repetition

Packet Identifier

Required so that if packets arrive at different times, they can be correctly ordered

To view the row you just created, under the INSERT statement type

SELECT * FROM celebs;

How to run a query to see the result?

SELECT * FROM celebs;d

SELECT name FROM celebs;

SELECT statements are used to fetch data from a database. Here, SELECT returns all data in the name column of the celebs table. 1. SELECT is a clause that indicates that the statement is a query. You will use SELECT every time you query data from a database. 2. name specifies the column to query data from. 3. FROM celebs specifies the name of the table to query data from. In this statement, data is queried from the celebs table.

____ programming language designed to manipulate and manage data stored in relational databases.

SQL

CREATE TABLE/Database "table name" (col1 constraint1, col2 constraint2, etc)

SQL Statement to Create a new table/database

\'

Single Quote (')

%c

Single character

%c

Single character -accepts integer or single char string

Von Nuemann architecutre

Single control unit, instructions and data stored in memory, works sequentially

uasort

Sort the elements of the $arr array by values using a user-defined comparison function: uasort(array,myfunction); array: Specifies the array to sort myfunction: Optional. A string that define a callable comparison function. The comparison function must return an integer <, =, or > than 0 if the first argument is <, =, or > than the second argument

sorted()

Sorts a list from smallest to highest or a string alphabetically sorted(str, reverse=True) <- Sorts backwards

0011 opcode

Store

Basic Input Output System (BIOS)

Stored in ROM, runs boot loader

Cloud Computing

Storing applications and data on the internet (instead of on the user's computer).

%s

String -Converts any python object using str()

%r

String -converts any python object using repr()

%r

String (converts any Python object using repr())

""" ............."""

String for multiple lines of text; can be multi-line comment

%r

String format character; use for debugging

%s

String format character; use for user formatting

create a new array of strings

String[] stringArray = new String[10];

Structural patterns

Structural patterns assist in the creation and use of complex structures. Examples of structural patterns include Adapter, Bridge, Composite (covered in this chapter), Decorator, Façade, and Proxy.

Database

Structured, organised collection of data

...

Subclasses cannot access methods and member variables (fields) in the superclass, if they these methods and fields are marked with the default access modifier, unless the subclass is located in the same package as the superclass.

0010 opcode

Subtract

-=

Subtract AND. Subtracts right operand from left and assigns the result to the left. A-=B ~ A = A - b

In Python, the variable in the for clause is referred to as the _____ because it is the target of an assignment at the beginning of each loop iteration.

Target Variable

Shortest remaining time

Tasks executed based on how long they are predicted to take

Text align tag

Text-align: value;

Domain Name

The "name" or URL of the Web site. Most domain names are purchased from a domain name registration company, such as GoDaddy.com.

format operator

The % operator takes a format string and a tuple of values and generates a string by inserting the data values into the format string at the appropriate locations.

When is factory pattern useful pt1

The Factory pattern becomes useful in situations where the type of object that needs to be generated isn't known when the program is written but only once the program is running. In very dynamic applications, this can often be the case.

how does factory pattern work

The Factory pattern works via a static method, conventionally named Create(), factory(), factoryMethod(), or createInstance(). The method takes at least one argument, which indicates the type of object to create. The method then returns an object of that type. static function Create($type) { // Validate $type. return new SomeClassType(); }

...

The Java String class also has a lastIndexOf() method which finds the last occurrence of a substring.

...

The Java String class contains a method called trim() which can trim a string object. By trim is meant to remove white space characters at the beginning and end of the string. White space characters include space, tab and new lines.

...

The Java String class contains a set of overloaded static methods named valueOf() which can be used to convert a number to a String.

...

The Template Method design pattern provides a partial implementation of some process, which subclasses can complete when extending the Template Method base class.

UNION

The UNION operator is used to combine the result-set of two or more SELECT statements.

__NAMESPACE__

The _ _NAMESPACE_ _ constant represents the current namespace.

loop

The action of doing something over and over again.

Header

The beginning part of an HTML document which defines various characteristics such as the title.

What it the first thing that happens after you enter a URL in the browser and hit enter?

The browser parses the URL to find the protocol, host, port, and path.

When fetching a URL in a browser, what happens after the host has formed the response?

The browser receives the response, and parses the HTML (which with 95% probability is broken) in the response A DOM tree is built out of the broken HTML.

function definition

The code inside a function that instructs the program on what to do when the function is called.

Digital Footprint

The collected information about an individual across multiple websites on the Internet.

if-statement

The common programming structure that implements "conditional statements".

...

The different Java nested class types are: Static nested classes Non-static nested classes Local classes Anonymous classes

...

The enum constructor must be either private or package scope (default). You cannot use public or protected constructors for a Java enum.

Head - <head></head>

The head element is a container for all the head elements. Elements inside <head> can include scripts, instruct the browser where to find style sheets, provide meta information, and more.The following tags can be added to the head section: <base>, <link>, <meta>, <script>, <style>, and <title>.

Application Layer (OSI 7)

The layer closest to the user, collects or delivers data

Take two cycle free singly linked lists and determine if there is an element that belongs to both.

The lists would have the same tail element.

Bit (Binary Digit)

The smallest unit of data stored in a computer. A bit can have the value of 0 or 1. A computer uses 8 bits to story one text character.

What is the difference between A) Boolean.valueOf(String) B) new Boolean(String)

The static factory method Boolean.valueOf(String) is almost always preferable to the constructor Boolean(String). The constructor creates a new object each time it's called, while the static factory method is never required to do so and won't in practice. The static factory method can work with a pool of immutable objects.

...

The trim() method does not modify the String instance. Instead it returns a new Java String object which is equal to the String object it was created from, but with the white space in the beginning and end of the String removed.

binary alphabet

The two options used in your binary code.

Data type

The type of data being used. Could be any of those below

What are cache lines?

The values stored in the cache memory is typically flushed back to main memory when the CPU needs to store something else in the cache memory. The CPU cache can have data written to part of its memory at a time, and flush part of its memory at a time. It does not have to read / write the full cache each time it is updated. Typically the cache is updated in smaller memory blocks called "cache lines". One or more cache lines may be read into the cache memory, and one or mor cache lines may be flushed back to main memory again.

When fetching a URL in a browser, what happens after the DNS lookup?

Then a socket needs to be opened from the user's computer to that IP number, on the port specified (most often port 80 (http) or 433(https))

...

There is a version of the indexOf() method that takes an index from which the search is to start. That way you can search through a string to find more than one occurrence of a substring.

Why would a pure function be better testable?

To test a pure function, it is sufficient to create the input parameter, run the "function under test" and compare the outcome. No mockups, no dependency injection, no complex setup, and no other techniques are necessary that take the fun out of testing.

import

This is how you add features to your script from the Python feature set. Rather than give you all the features at once, Python asks you to say what you plan to use. This keeps your programs small, but it also acts as documentation for other programmers who read your code later.

call (a function)

This is the piece of code that you add to a program to indicate that the program should run the code inside a function at a certain time.

Download

To transfer a file from a remote computer to a local computer. In web terms: to transfer a file from a web server to a web client. (see also Upload).

define (a function)

To add code inside a function so that the program knows what it is supposed to do when the function is called.

What is the most common mistake when starting a thread?

To call the run() method of the Thread instead of start(). in that case, the run() method is executed by the thread that created the thread.

Encryption

To convert data from its original form to a form that can only be read by someone that can reverse the encryption. The purpose of encryption is to prevent unauthorized reading of the data.

clone

To create a new object that has the same value as an existing object. Copying a reference to an object creates an alias but doesn't clone the object.

When fetching a URL in a browser, what happens after the browser forms an HTTP request.

To reach the host, it first needs to translate the human readable host into an IP number, and it does this by doing a DNS lookup on the host.

What is Double-Checked Locking?

To reduce the overhead of acquiring a lock by first testing the locking criterion without actually acquiring the lock.

iteration

To repeat a section of code.

traverse

To repeat an operation on all members of a set from the start to the end.

Frame

Used to divide a web page into multiple HTML pages so that you can have some elements of the page that are constant, and other parts that change. For example, you might have one part of the page that always contains the same header, another part that contains the navigation bar, and the middle part that changes according to what is clicked on the navigation bar.

When objects and variables can be stored in various different memory areas in the computer, certain problems may occur. The two main problems are:

Visibility of thread updates (writes) to shared variables. Race conditions when reading, checking and writing shared variables.

Random Access Memory (RAM)

Volatile, stores temporary program data

Example Between Statements

WHERE ProductName BETWEEN 'C' AND 'M'; BETWEEN #07/04/1996# AND #07/09/1996#;

list slicing

Way to access elements list[start:end:stride] -stride = count by __'s -any term can be omitted, will be set to default - a negative stride progresses through list backwards

special text insertions?

\' single quote \" double quote \n new line \r carriage return \t tab \b backspace \f form feed

What is the string escape sequence to insert a backslash in JavaScript?

\\

What is the string escape sequence to insert a form feed in JavaScript?

\f

What is the string escape sequence to start a new line in JavaScript?

\n

What is the string escape sequence to insert a tab in JavaScript?

\t

What does consistent mean?

assertTrue( a.equals(b) == a.equals(b) );

What does symmetic mean?

assertTrue( a.equals(b) == b.equals(a) );

keyword

define the language's syntax rules and structure, and they cannot be used as variable names

%d

digit

How do you access a page element by id?

document.getElementById(id);

How do you write text to the current element of the DOM?

document.write("Text Here"); //Remains on current line

.insert(index, item)

insert a certain item into a list at a certain index

the break and continue statement?

if(i==3) { break; } breaks loop if(i==3) { continue; } breaks loop and restarts at next value;

A(n) _______________ statement will execute one block of statements if its condition is true, or another block if its condition is false.

if/else

Insert Rows

insert into highAchiever (name, age) (select name, age from salesperson where salary > 100000);

my_list[:]

gives you the entire list

strings

list of characters

access dictionary values

list[item]

SUB

subtract mneumonic

bit mask

variable used to determine if bits are on or off in an input -sort of works like a multiple choice test key -can be used with | to turn bits on if off -use with ^ and 11111111 to flip all bits def check_bit4(input): mask = 0b1000 desired = input & mask if desired > 0: return "on" return "off"

member variables

variables only available to members of certain class

A placeholder for a piece of information that can change.

website

When is factory pattern useful pt2

when there's an abstract base class, and different derived subclasses will need to be created on the fly. This particular design structure is important with the Factory pattern, as once you've created the object, regardless of its specific type, the use of that object will be consistent.

How do you code a while statement in JavaScript?

while (condition) {}

high-level language

A programming language like Python that is designed to be easy for humans to read and write.

low-level langauge

A programming language that is designed to be easy for a computer to execute; also called machine language or assembly language

Creative Commons

A public copyright licenses that enable the free distribution of an otherwise copyrighted work. A CC license is used when an author wants to give people the right to share, use, and build upon a work that they have created.

URL (universal resource locator)

A relatively easy-to-remember address for calling a web page (like www.code.org). username

iteration

A repetitive action or command typically created with programming loops.

Router

A hardware (or software) system that directs (routes) data transfer to different computers in a network.

Domain Name

A human readable reference to an IP address

Variable

A letter or word for a value that can vary or change

Hyperlink

A link from a HTML file to another location or file, typically activated by clicking on a highlighted word or image on the screen.

What's a dictionary?

A list of tuples in curly brackets: {"x:y"}; x is a key, y is a value; dictionaries are unordered.

nested list

A list that is itself contained within a list.

definite iteration

A loop where we have an upper bound on the number of times the body will be executed. Definite iteration is usually best coded as a for loop

for loop

A loop with a predetermined beginning, end, and increment (step interval).

read

A method/function/command to read the file

event-handler

A monitor for a specific event or action on a computer. When you write code for an event handler, it will be executed every time that event or action occurs. Many event-handlers respond to human actions such as mouse clicks.

function

A named sequence of statements that performs some useful operation. Functions may or may not take parameters and may or may not produce a result

IP address

A number assigned to any item that is connected to the Internet.

OR Gate

A or B must be true for 0 to be true (symbol: v)

NOR Gate

A or be must be true for 0 to be true

HTML Element

A piece of a website. Marked by a start tag and sometimes closed with an end tag. Also includes the content of the element as well.

function

A piece of code that you can easily call over and over again. Functions are sometimes called 'procedures.' A function definition is a segment of code that includes the steps performed in the function. A function call is the code segment, typically within the main logic of the program, which invokes the function.

lambda

A piece of code which can be executed as if it were a function but without a name. (It is also a keyword used to create such an anonymous function.)

Algorithm

A precise sequence of instructions for processes that can be executed by a computer

...

A private constructor can still get called from other constructors, or from static methods in the same class.

Search Engine

A program that searches for and identifies items in a database that correspond to keywords or characters specified by the user, used especially for finding particular sites on the World Wide Web.

search engine

A program that searches for and identifies items in a database that correspond to keywords or characters specified by the user, used especially for finding particular sites on the World Wide Web.

Mutli-level feedback queue

Multiple queues created based on priority

subnamespace

Namespaces can have subnamespaces. To do that, indicate a subnamespace using the backslash: namespace MyUtilities\UserManagement; class Login {}

Moving point right in Normalization

Negative exponent

What is the difference between static nested and inner classes?

Nested classes that are declared static are called static nested classes. Non-static nested classes are called inner classes.

#

Octothorpe use for comments on the code, use to disable code placing a # at the beginning of a line or in the middle of a line tells python to ignore whatever is written on the line after the #

Parameter

An extra piece of information that you pass to the function to customize it for a specific need.

tuple

An immutable sequence of Python objects -Immutable; can't be changed -Similar to list, but can't be modified - Uses (), ends in ; tuple1 = ('word', 1, False);

what algorithm is Arrays.sort?

An improved quicksort with average nlog(n) runtime

integer division

An operation that divides one integer by another and yields an integer. Integer division yields only the whole number of times that the numerator is divisible by the denominator and discards any remainder.

SDLC (Step 3)

Analysis and design

Why can Annotations replace marker interfaces?

Annotations can convey metadata about the class to its consumers without creating a separate type for it. Annotations let you pass information to classes that "consume" it.

FROM customer_info INNER JOIN purchases

Another option to write inner join

How can you transform an array into a List?

Arrays.asList

How can you create a duplicate of an array?

Arrays.copyOf copies until a given length

How can you compare arrays?

Arrays.equals : two arrays are equal if they contain the same elements in the same order

Give an example of a race condition when using a volatile variable.

As soon as a thread needs to first read the value of a volatile variable, and based on that value generate a new value for the shared volatile variable, a volatile variable is no longer enough to guarantee correct visibility. The short time gap in between the reading of the volatile variable and the writing of its new value, creates an race condition where multiple threads might read the same value of the volatile variable, generate a new value for the variable, and when writing the value back to main memory - overwrite each other's values.

*

Asterisk: used for miltiplication

What is AJAX?

Asynchronous JavaScript And XML

Why do we need to implement the Clonable interface?

At runtime it would throw the CloneNotSupportedException if we don't implement the Cloneable interface. A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class.

Logic Gate

Basic building block with a logic circuit

Datagram

Basic unit of data transmitted on a network

CSS

CSS stands for Cascading Style Sheets. CSS allows each HTML element to be styled according to certain set of rules.

Control Bus

Carries data from control unit to RAM

Scheduler

Carries out scheduling

Data Bus

Carrries data between MDR and RAM

Parallel processing

Carrying out multiple computations simultaneously to solve a given problem

run program

Cause the computer to execute the commands you've written in your program.

Unicode

Character Set with 16-bit identifier per character

American Standard Code for Information Interchange (ASCII)

Character Set with 8-bit identifier per character

Address+

Character allowed as a space for when combining phrases together

\uxxxx

Character with 16-bit hex value xxxx (Unicode only)

\Uxxxxxxxx

Character with 32-bit hex value xxxxxxxx (Unicode only)

\xhh

Character with hex value hh

\ooo

Character with octal value ooo

Character Set

Characters have a unique numeric code

Magnetic Ink Character Recognition (MICR)

Characters stored in special standard font- very difficult to forge or change

Polling

Checking if each device needs attention

Power-On Self Test (POST)

Checks computer is functional to turn on

FROM

Choose from a table

class constants

Class Constants Class constants are like static attributes in that they are accessible to all instances of that class (or derived classes). But as with any other constant, the value can never change.

Describe the purpose of the Comparator interface:

Class whose objects to be sorted do not need to implement this interface. Some third class can implement this interface to sort.

...

Classes cannot be marked with the private access modifier. Therefore the private access modifier is not allowed for classes.

How would you implement the natural ordering of an entity?

Comparable interface: Class whose objects to be sorted must implement this interface

strcasecmp

Compare two strings (case-insensitive):

composition

Composition represents a "has a" relationship, where one class's property values are objects of another class type. For example, Employee is not a subtype of Department (i.e., a child), but rather a part of a Department's composition.

Search Engine

Computer program used to search and catalog (index) the millions of pages of available information on the web. Common search engines are Google and AltaVista.

Spyware

Computer software hidden in a computer with the purpose of collecting information about the use of the computer.

Terminal

Computer, phone, etc.

servers

Computers that exist only to provide things to others.

When the + operator is used with two strings, it performs string _______________.

Concatenation

Transport Layer (OSI 4)

Concerned with keeping track of segments of a network, checking successful transmission and packet protocols

Link (TCP/IP 1)

Concerned with passing datagrams to the local physical network

Transport (TCP/IP 3)

Concerns establishment and termination of connections

Network Layer (TLA 2)

Concerns how data is to be sent in the most efficient way

Application (TCP/IP 4)

Concerns production, communication and reception of data

Application Layer (TLA 3)

Concerns what data is to be sent

A(n) ??-controlled loop causes a statement or set of statements to repeat as long as a condition is true.

Condition

What type of loop structure repeats the code based on the value of the Boolean expression

Condition-controlled loop

online

Connected to the internet.

Time-to-live

Contained in metadata of packet, if not retrieved will self delete to avoid data collision after a specified time

'%ITEM%'

Contains the following word, use with LIKE in WHERE clause

Sends out signals to co-ordinate how the processor works

Control Unit

Data Link Layer (OSI 2)

Control of access, error detection and correction

int()

Convert a string to an integer int(raw_input(> ))

Hashing

Converting a field into a shorter disk address

%s

Converts String (converts any Python object using str())

Interpreter

Converts each line to machine code sequentially

Translator

Converts source code to machine code (compiler, interpreter or assembler)

Kernel

Core of the OS, helps manage system resources

Delete a node in a singly linked list in O(1) time.

Delete the next node instead: Copy the next node value into the current node, point next to next.next.

// (operator)

Floor Division. Numbers after the decimal in the quotient are removed - 9//2 = 4

Can you think of a case where you may have to implement Runnable as well as subclass Thread?

For instance, if creating a subclass of Thread that can execute more than one Runnable. This is typically the case when implementing a thread pool.

The acronym ?? refers to the fact that the computer cannot tell the difference between good data and bad data.

GIGO

HAVING

GROUP BY clause: Satisfies a condition in "quotes", used for COUNT or plural clauses

GROUP BY

Gathers Data

What Math object method is used to return the highest value from a set of supplied numbers?

Math.max(var1, var2, varN);

What Math object method is used to return the lowest value for a set of supplied numbers?

Math.min(var1, var2, varN);

What Math object method is used to return a given number raised to a given power?

Math.pow(number, power);

What Math object method is used to return a random number?

Math.random() //Returns a value >= 0.0 but <1.0

What Math object method is used to return a given number that has been rounded to the closes integer value?

Math.round(number);

What Math object method is used to return the square root of a given number?

Math.sqrt(number);

30 characters

Maximum number of characters allowed for a SQL statement

MAR

Memory Address Register

MDR

Memory Data Register

Stores the data that has been fetched or sent to the memory

Memory Data Register

Register

Memory location within the processor itself, works at high speed

.isalpha()

is a letter

parameter ex: (column_1 data_type, column_2 data_type, column_3 data_type)

is a list of columns, data types, or values that are passed to a clause as an argument

finally

is always executed in the end. Used to clean up resources.

:: operator

is used to access members through classes, not objects: ClassName::methodName(); ClassName::propertyName;

How do you test that a variable contains a valid number?

isNaN(varHere); //Returns true or false.

Parallel Workers Advantages

it is easy to understand. To increase the parallelization of the application you just add more workers.

concat() method does what?

joins 2 or more arrays array.concat(array2)

join() does what?

joins all elements of an array into a string array.join(seperator) x=["1","2","3"] document.write(x.join(" and ")) --> 1 and 2 and 3

mutable

can be changed after created

regexp quantifiers

can be used in conjunction with metacharacters

Case SenSiTive

SQL is NoT Case Sensitive

=

SQL operator for equal

>, <

SQL operator for greater or less than

> =

SQL operator for greater than or equal to

< =

SQL operator for less than or equal to

<> or ! =

SQL operator for not equal to

LIKE

SQL operator for string comparison test, used in where clause

CREATE TABLE table_name ( column_1 data_type, column_2 data_type, column_3 data_type);

SQL statement that CREATEs TABLE

%G

Same as "E" if exponent is greater than -4 or less than precision

%g

Same as "e" if exponent is greater than -4 or less than precision

Single Instruction Multiple Data (SIMD)

Same operation is carried out on multiple pieces of data at once

*

Selects all columns to return

SELECT TOP 2/50 PERCENT

Selects the first 2, or first 50 percent of data from a table

HyperText Markup Language (HTML)

Standard markup language for creating web pages

HTML

Stands for Hypertext Markup Language and is used to create the content of a web page.

Ordinal Numbers

Start at 1; First, second, third

How do you create a multi-line comment in JavaScript?

Start with a forward slash and asterisk, and then end with an asterisk and forward slash. "/*" "*/"

add methods to classes:

class ClassName { function functionName() { // Function code. } }

singleton example 1

class Config { static private $_instance = NULL; private $_settings = array(); private function _ _construct() {} private function _ _clone() {} static function getInstance() { if (self::$_instance == NULL) { self::$_instance = new Config(); } return self::$_instance; } function set($index, $value) { $this->_settings[$index] = $value; } function get($index) { return $this->_settings[$index]; } }

exit

exit the shell

export

export/set a new environment variable

slice() method does what?

extracts a part of a string and returns the extracted part in a new string(-1 if null) e.x. string.slice(begin,end) x="hello" document.write(x.slice(0,3))---> hell

regexp brackets

find a range of characters

grep

find things inside files

apropos

find what man page is appropriate

\d meta character does what?

finds a digit from 0-9 x="hell1o world" y=/\d/g document.write(x.match(y))--> 1

\W meta character does what?

finds a non-word character x="hello world!%" y=/\W/g document.write(x.match(y))--> !,%

\0 meta character does what?

finds a nul character

What Date object method is used to return the number of milliseconds since the start of GMT?

getTime();

What are the available get methods for a Date object?

getTime(); getFullYear(); //Returns 4 digit year getMonth(); //Returns months, starts with 0 for January getDate(); // Returns day of the month getHours(); //Returns hours in the day getMinutes(); //Returns the minutes in the current hour getSeconds(); //Returns seconds in the current minute getMilliseconds(); //Returns milliseconds in the current second

parseFloat() does what?

gets a decimal number from a string [not part of the math object] parseFloat(string) document.write(parseFloat("45.1nn"))-->45.1 document.write(parseFloat("45nn"))-->45

parseInt() does what?

gets a number from a string [not part of the math object] parseInt(string) document.write(parseInt("45.1nn"))-->451 document.write(parseInt("45nn"))-->45

enumerate()

gives an index number to each element in a list

not

gives the opposite of the statement; i.e. "Not True is False"

my_list[-1]

gives you the last term in the list

my_list[1:3]

gives you the list starting at the 1st position and ending at the 2nd position

my_list[0:]

gives you the whole list, starting at the 0 position

Third-level Domain Name example

google, bbc, etc.

The term _______________ refers to all of the physical devices that a computer is made of.

hardware

Describe the contract between hashcode and equals!

hashCode and equals are closely related : if you override equals, you must override hashCode. hashCode must generate equal values for equal objects. equals and hashCode must depend on the same set of "significant" fields.

Static class variables are also stored on the..

heap along with the class definition.

An object's member variables are stored on the ..

heap along with the object itself. That is true both when the member variable is of a primitive type, and if it is a reference to an object.

Height tag

height: value;

Data types

http://www.w3schools.com/sql/sql_datatypes_general.asp http://www.w3schools.com/sql/sql_datatypes.asp

What does transitive mean?

if ( a.equals(b) && b.equals(c) ) { assertTrue( a.equals(c) ); }

How do you code an If Else If statement in JavaScript?

if (condition) { } else if (condition) {}

How do you code an If statement in JavaScript?

if (condition) {}

How do you code an If Else statement in JavaScript?

if (condition){ } else {}

...

if a constructor is declared protected then only classes in the same package, or subclasses of that class can call that constructor.

Name an advantage of an object's immutability for collections

if an object is immutable, then hashCode is a candidate for caching and lazy initialization

The natural ordering for a class C is said to be consistent with equals ...

if and only if this.compareTo(that) == 0 has the same boolean value as this.equals(that) for every this and that of class C.

Python provides a special version of a decision structure known as the _______________ statement, which makes the logic of the nested decision structure simpler to write

if elif else

else if conditional syntax?

if(condition) { code } else if(condition) { code }

concat() method does?

joins 2 or more strings then returns a copy. e.x. string.concat(string2) x="hello world " y="goodbye world" document.write(x.concat(y))--> hello world goodbye world

. meta char does what?

finds a single character (can be used in combination) except newline or other line terminators x="hello world" y=/h.l/g document.write(x.match(y))--> hel

\s meta character does what?

finds a whitespace chracters x="hello world " y=/\s/g document.write(x.match(y))--> , ,

What makes the identity operators different from the standard equality operators?

They do not perform type coercion. //Eg. If data types don't match they fail the comparison

What is the private lock object idiom?

This idiom uses the intrinsic lock associated with the instance of a private final java.lang.Object declared within the class instead of the intrinsic lock of the object itself. This idiom requires the use of synchronized blocks within the class's methods rather than the use of synchronized methods. Lock contention between the class's methods is prevented.

\w meta character does what?

finds a word character (a-z,A-Z,0-9) x="hello world!%" y=/\w/g document.write(x.match(y))--> h,e,l,l,o, ,w,o,r,l,d

len(my_list)

finds the length of a list

Boolean variables are commonly used as _______________ to indicate whether a specific condition exists.

flags

After the execution of the following statement, the variable sold will reference the numeric literal value as a(n) _____ data type: sold = 256.752

float

%f

float Floating point decimal format

What are the two methods common to most controls?

focus //Brings focus to the control blur //Removes focus from the control

Font Family tag

font-family: value;

The _______________ specifier is a special set of characters that specify how a value should be formatted.

formatting

function syntax and purpose?

function functionName(var1,var2,..,var99) { some code } functions allows scripts to be executed when called.

return statement syntax?

function product(a,b) { return a*b; } alert(product(4,3)) <-- will alert 12 return function gives a value back based on function variables.

round()

function rounds floating point numbers round(1.773) = 2

LCASE()

function that Converts a field to lower case

UCASE()

function that Converts a field to upper case

TRANSLATE

function that let's you change how the context is written

FIRST() or TOP 1 + ASC/DESC

function that returns the first value

LAST()

function that returns the last value

ISNULL(), NVL(), IFNULL(), COALESCE()

function to specify how we want to treat NULL Values

Web Crawler

This is a robot program that crawls through content on pages for any number of indexing reasons. For example, Google uses a crawler to index and sort pages for search.

True/False: Nested decision structures are one way to test more than one condition.

True

True/False: Python allows programmers to break a statement into multiple lines.

True

True/False: RAM is a volatile memory used for temporary storage while a program is running.

True

True/False: The CPU understands instructions written in a binary machine language.

True

True/False: The integrity of a program's output is only as good as the integrity of its input. For this reason the program should discard input that is invalid and prompt the user to enter correct data.

True

The line continuation character is a _____.

\

What is the string escape sequence to insert a double quote in JavaScript?

\"

What is the string escape sequence to insert a single quote in JavaScript?

\'

What is the escape sequence used to insert a Unicode character into a string in JavaScript?

\udddd //"dddd" is replaced by the hexadecimal value for the Unicode character

What is the string escape sequence to insert a vertical tab in JavaScript?

\v

autoload part5

_ _autoload() function is defined outside of any class; instead, it is placed in a script that instantiates the objects.

regexp metacharacters

are characters with a special meaning

Copyright

the exclusive legal right, given to an originator or an assignee to print, publish, perform, film, or record literary, artistic, or musical material, and to authorize others to do the same.

instanceof and interface

the instanceof operator can also be used to test if a class implements an interface.

semantic

the meaning of a program

byte

the most common fundamental unit of digital data eg. Kilobyte, Megabyte, etc. A single byte is 8 bits-worth of data.

index

the number that each character in a string is assigned

namespace should be the first line of code

this should be the first line of PHP code in a file, and that the file cannot even have any HTML before that PHP code. Any code that follows that line will automatically be placed within that namespace: namespace SomeNamespace; class SomeClass {}

Attempting to synchronize on a null object will

throw a NullPointerException.

"""

to display things as they're written in the .txt file

What String object method returns a new string containing the value of the original string but in all lower case?

toLowerCase();

What Number object method is used to return a numerical string with the specified number of significant digits?

toPrecision(precision);

For a text area, how do you get the current character count for the control?

var areaText = document.getElementById("textAreaId").value; var charCount = areaText.length;

How do you create an Array object in JavaScript?

var arrayVar = new Array();

What is the format to create a new Date object from a string?

var dateObject = new Date("11/22/2012 18:25:35");

How do you create a new Date object?

var dateObject = new Date(year, month, day, hours, minutes, seconds, milliseconds);

How do you create a Date object in JavaScript?

var dateVar = new Date();

How do you create a function that returns a value in JavaScript?

var functionName = function(param1, param2, paramN) { //Other steps return returnValue; }

How do you create a function in JavaScript?

var functionName = function(param1, param2, paramN) {}

how is regexp defined?

var patt = new RegExp(pattern,modifiers) or var patt = /pattern/modifiers

for... in statement syntax?

var person={fname:"john",lname:"doe",age:"25"}; var x; for (x in person) { document.write(person[x]+" "); } ------- loops through all variables attached to person;

How do you concatenate multiple parts into a string?

var stringVar = "part 1:" + "part 2";

How do you assign the value from a prompt to a string?

var stringVar = prompt("Text Here");

creating a literal array?

var x = ["black","white","red","blue","green"]

creating a condensed array?

var x = new array ("white","black","red","green","blue") //condensed array

In programming, a variable is a value that can change, depending on conditions or on information passed to the program. Typically, a program consists of instruction s that tell the computer what to do and data that the program uses when it is running.

variable

instance variable

variable only available to one instance of a class

slicing lists

letters = ['a', 'b', 'c', 'd', 'e'] slice = letters[1:3] print slice print letters **when slicing if you wanted numbers 1 and 2 you would slice [0:2] so the code would include both the index 0 and 1

In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called a _____.

list

what does the n{x,y} quantifier do?

matches any string that contains a sequence of X to Y n's [x and y must be #'s] x="100, 1000 or 10000" y=/\d{4,5}/g document.write(x.match(y))--> 1000,10000

what does the n{x,} quantifier do?

matches any string that contains a sequence of atleast X n's [x must be a number] x="100, 1000 or 10000" y=/\d{3,}/g document.write(x.match(y))--> 100,1000,10000

what does the n{x} quantifier do?

matches any string that contains a sequences of x n's x="100, 1000 or 10000" y=/\d{4}/g document.write(x.match(y))--> 1000,1000

what does the n+ quantifier do?

matches any string that contains at one n x="hello world" y=/w+/g document.write(x.match(y))--> hello,world

what does the ^n quantifier do?

matches any string with n at the beginning x="hello world" y=/^he/g document.write(x.match(y))--> he

!=

means doesn't equal

==

means equal to

or

means one of the conditions must be true

and

means that both conditions must be true

two ways to synchronize access to shared mutable variables:

method synchronization and block synchronization

Which logical operators perform short-circuit evaluation?

or, and

how to structure namespace

organize the files themselves using the same structure image. This isn't required.

OUT

output mneumonic

polymorphism

override a parent class's method to customize it for the new class.

polymorphism 2

overriding methods creates polymorphism, where calling the same method can have different results, depending on the object type.

What is the use of Streams in Java 8?

parallel streams which can help you parallelize the iteration of large collections.

what does the i modifier do?

performs a case insensitive search /regexp/i x="hello world" y=/world/i document.write(x.match(y))--> world

what does the g modifier do?

performs a global match (instead of stopping at first found) /regexp/g x="hello world" y=/o/g document.write(x.match(y))--> o,o

REFERENCES

points to a different column

popd

pop directory

cat

print the whole file

print

print to console

pwd

print working dictionary

A(n) _______________ is a set of instructions that a computer follows to perform a task.

program

properties of methods defined?

properties - are values associated with an object i.e. length methods - are actions (functions) that can be performed on objects ie toUpperCase [an uppercase method]

What is the informal language that programmers use to create models of programs that have no syntax rules and are not meant to be compiled or executed?

pseudocode

what does the max() method do?

returns the number with the highest value Math.max(x,y,z) document.write(Math.max(10,5,-1))-->10

what does min() method do?

returns the number with the lowest value Math.min(x,y,z) document.write(Math.min(10,5,-1))-->-1

indexOf() method does?

returns the position of the first found occurrence of a specified value in a string e.x. string.indexOf(searchstring,start) x="hello world" document.write(x.indexOf("world",0))-->7

lastIndexOf() method does what?

returns the position of the last occurence of a specified value in a string. e.x. string.lastIndexOf(regexp,start) x="hello world" document.write(x.lastIndexOf("wo",0))--->7

valueOf() method does what?

returns the primitive value of a string. e.x. string.valueOf() x= "Hi!" document.write(x.valueOf())----> Hi!

valueOf() method does what?

returns the primitive value of an array array.valueOf()

SIGN(x)

returns the sign of input x as -1, 0, or 1 (negative, zero, or positive respectively)

what does sin() do?

returns the sine of a number (-1 to 1) Math.sin(number) document.write(Math.sin(3))-->0.1411

CEILING(x) or CEIL(x)

returns the smallest integer value that is greater than or equal to x

what does the source property do?

returns the source of the regexp x=/regexp/gi document.write(x.source)-->regexp

what does sqrt() do?

returns the square root of a number Math.sqrt(number) document.write(Math.sqrt(9))-->3

SQRT(x)

returns the square-root value of x

SUM

returns the sum of values in a column

what does the method tan() do?

returns the tangent of a number Math.tan(number) document.write(Math.tan(90))-->-1.995

charCodeAt() method does?

returns the unicode of the character at a specific index in a string. e.x. string.charCodeAt(index) x="hello world" document.write(x.charCodeAt(0))--->72

what does exp() method do?

returns the value of a user-defined power to eulers number Math.exp(number) document.write(Math.exp(1))-->2.7183

POWER(x,y)

returns the value of x raised to the power of y

ROUND(x)

returns the value of x rounded to the nearest whole integer

ROUND(x,d)

returns the value of x rounded to the number of decimal places specified by the value d

what does pow() method do?

returns the value of x to the power of y Math.pow(x,y) document.write(Math.pow(4,2))-->16

type()

returns what "type" of data ex: int, float, str

reverse() method does?

reverse the order of elements in an array (first is last, last is first) array.reverse() x=["1","2","3"] x.reverse() document.write(x)-->3,2,1

what does round() method do?

rounds a number to the nearest interget Math.round(x) document.write(Math.round(5.5))-->6 document.write(Math.round(5.49))-->5

what does ceil() method do?

rounds a number upwards to the nearest interger and returns the result Math.ceil(number) document.write(Math.ceil(2.3))--> 3

substr() does what?

same as substring except uses length as opposed to a stop number e.x. string.substr(start,length) x="hello world" document.write(x.substr(0,4))--->hello

In _______________ mode, the interpreter reads the contents of a file that contains Python statements and executes each statement.

script

search() method does what?

searches for a match between a regular expression and the string and returns the position e.x. string.search(regexp) x="hello world" document.write(x.search("wo"))--->7

match() method does?

searches for a match between the regexp and a string and returns the matchs e.x. string.match(regexp) x="hello world" document.write(x.match("hello"))-->hello

replace() method does what?

searches for a regexp or substring and replaces it with a new string. e.x. string.replace(regexp/substr,newstring) x="hello world" document.write(x.replace("hello","goodbye"))-->goodye world

slice() method does what?

selects a part of an array and returns an array [starts from 0, original not changed] array.slice(begin,length) x=["1","2","3"] document.write(x.slice(0,2))-->1,2

BETWEEN

selects all keyword within a range; Used in WHERE statement

`new self` and `new static`

self refers to the same class in which the new keyword is actually written. static, in PHP 5.3's late static bindings, refers to whatever class in the hierarchy you called the method on.

whitespace

separates statements

sort() for numbers?

sorting by numbers is different, using a sort function is necessary. function sortNumber(a,b) { return b-a;// for descending return a-b;// for ascending }

my_list.sort()

sorts a list from lowest to highest, or alphabetical

sort()

sorts a list from smallest to greatest

sort() method does what?

sorts the elements of an array (alphabetical default) [changes original] array.sort(sort function) x=["a","b","c"] y=["a","c","b"] document.write(y.sort())-->a,b,c

operators

special tokens that represent computations like addition, multiplication and division

what does the global property do?

specified if the "g" modifier is set /regexp/g

what does the ignoreCase property do?

specified if the "i" modifier is set /regexp/i

what does the lastIndex property do?

specified the index at which to start the next match [specified character position after last match] x="string string string" y=/regexp/gi while(y.text(x)==true) { document.write("i found the index at: " + y.lastIndex) } firstmatch index number, second match index number

try

specifies exception handlers

split() method does what?

splits a string into an array of substring and returns the new array e.x. string.split(separator,limit) x="hello world" document.write(x.split(" ",1))---> hello

SQRT1_2 is what?

square root of 1/2 approx (0.707)

SQRT2 is what?

square root of 2 approx (1.414)

elif

stands for else if. if the first test evaluates to False, continues with the next one

SELECT INTO

statement selects data from one table and inserts it into a new table. SELECT Customers.CustomerName, Orders.OrderID INTO CustomersOrderBackup2013 FROM Customers LEFT JOIN Orders ON Customers.CustomerID=Orders.CustomerID;

DELETE, where

statement to remove rows from a table

c++ destructor

"In C++ and C#, the destructor's name for the class ClassName is ~ClassName, the corollary of the constructor, which is ClassName. Java does not support destructors." Excerpt From: Ullman, Larry. "PHP Advanced and Object-Oriented Programming: Visual Quickpro Guide, Third Edition." iBooks.

class names and function names are not case sensitive

"function names in PHP are not case-sensitive, the same is true for method names in classes."

initialize class attribute

"if an attribute is initialized with a set value, that value must be a literal value and not the result of an expression: Click here to view code image class GoodClass { public $var1 = 123; public $var2 = 'string'; public $var3 = array(1, 2, 3); } class BadClass { // These won't work! public $today = get_date(); public $square = $num * $num;"

call the methods of the class, you use this syntax

$object->methodName(); $object->methodName(arg1, arg2, arg3,...)

$this

$this is a reference to the calling object (usually the object to which the method belongs, but possibly another object, if the method is called statically from the context of a secondary object)

$this is not available inside static function

$this, which always refers to the current object, is not available inside a static method, because static methods are meant to be invoked without using an object.

interface benefits

Another benefit that interfaces have over using abstract classes and inheritance is that classes in PHP cannot inherit from multiple parents. Classes, however, can implement multiple interfaces by separating each by a comma: Click here to view code image class SomeClass implements iA, iB {

private variable convention

As a convention, private variable names are often begun with an underscore. This is commonly done in many OOP languages, although it is not required.

Php Class Definition Format

Basic class definitions begin with the keyword class, followed by a class name, followed by a pair of curly braces which enclose the definitions of the properties and methods belonging to the class.

how to access static or constant attributes

Constants, like static attributes, also cannot be accessed through the object. You cannot do this: $obj->PI or $obj::PI But you can use ClassName::CONSTANT_NAME (e.g., SomeClass::PI) anywhere. You can also use self::CONSTANT_NAME within the class's methods.

how to reference a namespace

First include the file that defines the namespace, then use backslashes to indicate a namespace is being used. E.G. require('SomeNameSpace.php'); $obj = new \SomeNameSpace\SomeClass(); Or: require('MyUtilities\User\User.php'); $obj = new \MyUtilities\User\Login();

composition UML

In UML, composition is indicated by drawing a line with a diamond at one end from the included class (e.g., Employee) to the composite class (e.g., Department).

interface part 1

Interfaces, like abstract classes, identify the functionality (i.e., the methods) that must be defined by a specific class. To create an interface, use the interface keyword. Then, within the curly brackets, define the method signatures, not their actual implementation: interface iSomething { public function someFunction($var); }

copying and cloning part 2

More formally put, this means that PHP assigns objects by reference, not by value. PHP does this for performance reasons, as having multiple copies of entire objects, when not needed, is expensive.

_ _toString

The _ _toString() Method If you define a _ _toString() method in a class, PHP will invoke that method automatically when an object of that type is used as a string. For example, it would be called if you attempted to do this: $a = new SomeClass(); echo $a;

function's signature

The combination of a function's name and its arguments (the number of arguments, specifically) is referred to as the function's signature. In PHP 5, except for constructors, any derived class must use the same signature when overriding a method.

Abstract Class vs. Interface

The difference between an interface and an abstract class may seem subtle. Remember that an abstract class is meant to be extended by a more specific class, of which you'll probably create an object instance. As you've already seen, an abstract class might define a generic object, such as a shape. Conversely, an interface is not inherited by a class, so you should not think of an interface as a way of loosely defining an entire object. Instead, an interface establishes a contract for the functionality that a class must have, regardless of the class type. For example, in Chapter 8, "Using Existing Classes," you'll learn about the Iterator interface defined within the Standard PHP Library (SPL). The Iterator interface dictates the methods that must exist in a class in order for PHP to be ...

how to create a trait

To create a trait, use the trait keyword, followed by the name and definition: trait tSomeTrait { // Attributes function someFunction() { // Do whatever. } }

new

To create an instance of a class, the new keyword must be used.

override a method

To override a method in PHP, the subclass must define a method with the exact same name and number of arguments as the parent class.

parent keyword

To refer to a member of a parent class, use the scope resolution operator with the keyword parent: class SomeOtherClass extends SomeClass{ function _ _construct() { parent::doThis(); } }

Type Hinting

Type hinting is the programming act of indicating what type of value is expected. For example, what type of value a function expects to receive for a parameter. Type hinting doesn't play much of a role in procedural PHP code because you cannot hint simple types (e.g., integers or strings). But you can hint object types, which is more useful.

autoload part2

_ _autoload() function is invoked when code attempts to instantiate an object of a class that hasn't yet been defined.

`new self` and `new static` example

class A { public static function get_self() { return new self(); } public static function get_static() { return new static(); } } class B extends A {} echo get_class(B::get_self()); // A echo get_class(B::get_static()); // B echo get_class(A::get_self()); // A echo get_class(A::get_static()); // A

destructor

class ClassName { // Attributes and methods. function _ _destruct() { // Function code. } } Destructors do differ from constructors and other methods in that they cannot take any arguments.

Triangle Class Example

class Triangle extends Shape { private $_sides = array(); private $_perimeter = NULL; function _ _construct($s0 = 0, $s1 = 0, $s2 = 0) { $this->_sides[] = $s0; $this->_sides[] = $s1; $this->_sides[] = $s2; $this->_perimeter = array_sum($this->_sides); } // End of constructor. public function getArea() { //code } } public function getPerimeter() { return $this->_perimeter; } }

abstract keyword

defining an abstract class abstract class ClassName { } abstract function methodName(); abstract function methodName ($var1, $var2); abstract class Pet { protected $_name; abstract public function getName(); }

dynamically calling a class attribute

function printVar($var) { echo "<p>In Test, \$$var: '{$this->$var}'.</p>"; } } // End of Test class.

get_object_vars && get_class_methods

get_object_vars($this); $methods = get_class_methods($this);

instanceof

if ($obj instanceof SomeClass) { ...} Notice that you don't put the class's name in quotation marks. Also—and this is important—in order for this to work, the PHP script must have access to the SomeClass definition.

default destructing

if you don't forcibly delete the object , it will be deleted when the script stops running.

implement abstract method rule

implementation of the abstract method in the extended class—e.g., Cat::getName()—must abide by the same visibility or weaker. If the abstract function is public, the extended version must also be public. If the abstract function is protected, then the extended version can only be protected or public. You would never make an abstract method private, since a private method

a CRUD interface

interface iCrud { public function create($data); public function read(); public function update($data); public function delete(); } class User implements iCrud { private $_userId = NULL; private $_username = NULL; function _ _construct($data) { $this->_userId = uniqid(); $this->_username = $data['username']; } . function create($data) { self::_ _construct($data); } function read() { return array('userId' => $this->_userId, 'username' => $this->_username); } function update($data) { $this->_username = $data['username']; } public function delete() { $this->_username = NULL; $this->_userId = NULL; } }

add a trait to a class

you add a trait to a class via the use keyword inside the class definition: class SomeClass { use tSomeTrait; // Rest of class. }

indicating visibility in UML

• +, for public • -, for private • #, for protected +name:string +_ _construct($pet_name:string):void

class attribute summary

• Are variables • Must be declared as public, private, or protected (I'll use only public in this chapter) • If initialized, must be given a static value (not the result of an expression)

constructor summary

• Its name is always _ _construct(). • It is automatically and immediately called whenever an object of that class is created. • It cannot have a return statement. The syntax for defining a constructor: class ClassName { public $var; function _ _construct(arg1=default1, arg2=default2,...) { // Function code. } }

%u

unsigned decimal

what is the size of float?

32 bits

%o

unsigned octal

How can you check whether a tree is a valid binary tree or not?

...

Math object methods

...

Math object properties

...

RegExp modifiers

...

Take two posibly cyclic singly linked lists and determine if there is an element that belongs to both.

...

What is non-blocking IO?

...

What is the ForkAndJoinPool?

...

What is the largest number binary representation in a two complement?

...

What is the smallest number binary representation in two complement?

...

array object methods

...

regexp object methods

...

regexp object properties

...

string object methods

...

To conserve IP addresses, networks will often...

...set up their own internal subnet addresses

Boolean tests should be..

...simple. If complex, move calculations to variables earlier in function and use a good name for the variable.

Treat if statements like...

..paragraphs. Each if, elif, and else grouping is like a set of sentences. Put blank lines before and after.

Never nest if-statements more than..

..two deep. Try to do one deep (put inside another function).

Top-level Domain Name example

.com, .uk, .edu, etc.

Second-level Domain Name example

.org, .co, .etc.

javascript comment syntax?

/**/ for multiple lines // for a single line

making a global (multiple) case insensitive search?

/content goes here/g; var x = /money/g

javascript starts counting on what?

0

7 values that make boolean false

0 -0 null " " false undefined NaN <-- not a number

What are the values that the variable num contains through the iterations of the following for loop? for num in range(4)

0, 1, 2, 3

Normalized numbers will start with...

01

INSERT INTO celebs (id, name, age) VALUES (1, 'Micheal Fasbander', 38);

1 is an integer that will be inserted into the id column 'Micheal Fasbander' is text that will be inserted into the name column 38 is an integer that will be inserted into the age column

What exactly is parallelism?

Application splits its tasks up into smaller subtasks which can be processed in parallel, for instance on multiple CPUs at the exact same time.

Reduced Instruction Set Computing (RISC)

Architecture used by smartphones

...

Fields and methods with default (package) access modifiers can be accessed by subclasses only if the subclass is located in the same package as the superclass. Private fields and methods of the superclass can never be referenced directly by subclasses.

Serial Files

Files where records are organised one after another

final method and class

Final Methods Most methods in classes can be overridden. The exception is if a function is defined as final: final function myFunc() {...} A final method's definition cannot be altered by any subclass. A class can also be declared final, meaning that it cannot be extended.

.index(item)

Find the index of an item

debugging

Finding and fixing errors in programs.

Debugging

Finding and fixing problems in your algorithm or program.

%E

Floating point exponential format (uppercase)

Segmentation

Splitting into blocks of memory containing modules or routines

Paging

Splitting into blocks of memory the same size

What is Context Switching Overhead

When a CPU switches from executing one thread to executing another, the CPU needs to save the local data, program pointer etc. of the current thread, and load the local data, program pointer etc. of the next thread to execute. This switch is called a "context switch". The CPU switches from executing in the context of one thread to executing in the context of another. Context switching isn't cheap. You don't want to switch between threads more than necessary.

short circuit evaluation

When a boolean expression is evaluated the evaluation starts at the left hand expression and proceeds to the right, stopping when it is no longer necessary to evaluate any further to determine the final outcome.

Describe how write operation is done on hardware.

When the CPU needs to write the result of a computation back to main memory it will flush the value from its internal register to the cache memory, and at some point flush the value back to main memory.

argument

a value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.

volatile is used to indicate that

a variable's value will be modified by different threads.

what is a regular expression?

an object that describes a pattern of characters

what is an array?

an object used to store multiple values in a single variable.

Floating Point Number

any number with a decimal point showing one or more digits behind the decimal point. e. "4.0" or "0.087"

list_name.append("")

appends thing to lists

for loop

applies function to every item in list for x in a: print x can sort functions for number in my_list print number #prints out every number on its own line

what does abs() method do?

determines the absolute value of x Math.abs(x) document.write(Math.abs(-7))-->7

In flowcharting, the _______________ symbol is used to represent a Boolean expression.

diamond

d = {'key1' : 1, 'key2' : 2, 'key3' : 3}

dictionary **not curly braces

Else must have a...

die function that prints out an error message, in case the else doesn't make sense. Shows errors.

For textboxes, how do you set focus on the control?

document.getElementById("TextBoxId").focus;

For textboxes, How do you get the current value?

document.getElementById("TextBoxId").value;

For checkboxes, how do you get the current checked status of the control?

document.getElementById("checkboxId").checked;

For checkboxes, how do you get the text value of the control?

document.getElementById("checkboxId").value;

For lists, how do you get the value or the currently selected item?

document.getElementById("listId").value;

For radio buttons, how do you set the current checked status of the control?

document.getElementById("radioButtonId").checked = true; //Could also be false

For radio buttons, how do you get the current checked status of the control?

document.getElementById("radioButtonId").checked;

For radio buttons, how do you get the text value of the control?

document.getElementById("radioButtonId").value;

How do you alter the value of the text element in a span tag?

document.getElementById("spanId").firstChild.nodeValue = "New Value";

How do you access the text element in a <span> tag?

document.getElementById("spanId").firstChild;

For a text area, how do you set the current value of the control?

document.getElementById("textAreaId").value = "Text Value";

For a text area, how do you get the current value of the control?

document.getElementById("textAreaId").value;

How do you write a line to the current element of the DOM?

document.writeln("Text Here"); //Advances to new line after text

passing array using GET method

domain.com/factory.php?shape=rectangle& dimensions[]=10&dimensions[]=14.

use imported function from module

ex: math.sqrt() (module.function)

else

optional. Used after elif to catch other cases not provided for.

FLOOR(x)

returns the largest integer value that is less than or equal to x

How would you name a static factory method that is used for type conversion?

valueOf(..) or of(..)

Inheritance constructor example

"The Square class is derived from Rectangle but has its own constructor. That constructor, not Rectangle's, will be called when an object of type Square is created.

[:2]

# Grabs the first two items

To access an object's properties

$object->propertyName;$object-$propertyName; // Error!

modulo

%. Returns the remainder from a division.

What is the syntax of a conditional operator?

(Condition_Expression) ? Value_If_True : Value_If_False;

WYSIWYG

(What you see is what you get) or graphical HTML editors which allow the user to see the page as the web browser would see it as they edit the page. You will not see the HTML elements or tag sets using this type of editor, so for learning HTML it is not recommended.

after we've added options (in parser)

(options, args) = parser.parse_args()

Which mathematical operator is used to raise five to the second power in Python?

**

exponent

**

floating point numbers

-Scientific notation in computers -Allows very large and small numbers using exponents -Made up of: *Significand*: 5, 1.5, -2.001 *Exponent*: 2, -2 -Put decimal after integers to make floating point 1 ~ 1.0

What is the size of int?

32 bits

Layout table

<table></table>a layout table is the basic formatting element. Everything that you put on your web site will be contained within a layout table.

Calling an external javascript file syntax?

<script type="text/javascript" src="javascript.js"> </script>

What is not an example of an augmented assignment operator

<=

Angle brackets

<> The characters, < and >, set HTML tags off from the rest of the text on an HTML page. These two symbols enclose all HTML tags.

Creating an instance Example

<?php $instance = new SimpleClass(); // This can also be done with a variable: $className = 'SimpleClass'; $instance = new $className(); // new SimpleClass() ?>

php class example

<?php class SimpleClass { // property declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this->var; } } ?>

access a member of a newly created object in a single expression

<?php echo (new DateTime())->format('Y'); ?>

uasort example

<?php function my_sort($a,$b) { if ($a==$b) return 0; return ($a<$b)?-1:1; } $arr=array("a"=>4,"b"=>2,"c"=>8,d=>"6"); uasort($arr,"my_sort"); ?>

Hyperlinks or links

<a></a> HTML coded locations of other material on the web. They are usually underlined and consist of a different text color than the surrounding text. When you click on them they will usually cause your browser to load the page it is pointing to and you will see the new page displayed.

What are the Body Tags?

<body> </body>

Body

<body></body> The main part of an HTML document.

What are the tags for the biggest Heading?

<h1> </h1>

What are the Head Tags?

<head> </head>

What are the HTML Tags?

<html></html>

HTML

<html></html> First tag on a page = <html>. The last tag on a page = </html> Hyper-Text Markup Language is the basic language web pages are written in.

Image tags

<img src="something.jpeg" atr="something">

Layer

<layer></layer>is a container that holds HTML page elements. You can put layers on top of one another and hide some while showing others. Layers can contain text or images. In order to insert layers, you must be in Standard view.

List Item tags

<li> </li>

Ordered List

<ol> </ol>

What are the Paragraph Tags?

<p> </p>

In the <script> tag, how is the Defer attribute used?

<script defer="defer"> //Used to ensure the code doesn't run until the rest of the page has been loaded

In the <script> tag, how is the Src attribute used?

<script src="fileName.js"> //Used to denote external file for script use

Table cell

<td></td> is one grouping within a table. Cells are grouped horizontally (rows of cells <tr></tr> ) and vertically (columns of cells <col></col>). Usually information on the top header of a table and side header will "meet" in the middle at a particular cell with information regarding the two headers it is collinear with.

Title

<title></title> tag defines the title of the document, and is the only required element in the head section!

Unordered List tags

<ul> </ul>

What's the difference between = and == in Python?

= is the assignment operator. == is the equality operator.

...

A Java field can have be given an initial value. This value is assigned to the field when the field is created in the JVM. Static fields are created when the class is loaded. A class is loaded the first time it is referenced in your program. Non-static fields are created when the object owning them are created.

What is a marker interface?

A Marker interface, has no method. Serializable, Clonable are marker interfaces.

float

A Python data type which stores floating-point numbers. Floating-point numbers are stored internally in two parts: a base and an exponent. When printed in the standard format, they look like decimal numbers

AND Gate

A and B must be true for 0 to be true (symbol: ^)

Selection

A choice or decision. This is where the code uses "If", "else" or "elif" to decide what to do.

...

A class that extends another class does not inherit its constructors. However, the subclass must call a constructor in the superclass inside one of the subclass constructors!

...

A class that implements the Iterable can be used with the new for-loop. Here is such an example: List list = new ArrayList(); for(Object o : list){ //do something o; }

TCP/IP (Transmission Control Protocol / Internet Protocol)

A collection of Internet communication protocols between two computers. The TCP protocol is responsible for an error free connection between two computers, while the IP protocol is responsible for the data packets sent over the network.

dictionary

A collection of key/value pairs that maps from keys to values.

Primary Key

A combination of a NOT NULL and UNIQUE. Ensures that a column (or combination of two or more columns) have an unique identity which helps to find a particular record in a table more easily and quickly

Comment

A comment is a programmer-readable note in the source code of a computer program.

immutable type

A compound data type whose elements can NOT be assigned new values.

ZIP

A compressing format for computer files. Commonly used for compressing files before downloading over the Internet. ZIP files can be compressed (ZIPPED) and decompressed (UNZIPPED) using a computer program like WINZIP.

DNS (Domain Name Service)

A computer program running on a web server, translating domain names into IP addresses.

What is same-threading?

A concurrency model where a single-threaded systems are scaled out to N single-threaded systems. The result is N single-threaded systems running in parallel.

fiber optic cable

A connection that uses light to transmit information.

bit

A contraction of "Binary Digit". A bit is the single unit of information in a computer, typically represented as a 0 or 1.

slice

A copy of part of a sequence specified by a series of indices.

What is the difference between A) String s = new String("stringette"); and B) String s = "stringette";

A creates a new String instance each time it is executed, and none of those object creations is necessary. The argument to the String constructor ("stringette") is itself a String instance, functionally identical to all of the objects created by the constructor. B uses a single String instance, rather than creating a new one each time it is executed. Furthermore, it is guaranteed that the object will be reused by any other code running in the same virtual machine that happens to contain the same string literal.

sequence

A data type that is made up of elements organized linearly, with each element accessed by an integer index.

Floating Point

A decimal

What is the parallel worker concurrency model ?

A delegator distributes the incoming jobs to different workers. Each worker completes the full job. The workers work in parallel, running in different threads, and possibly on different CPUs.

module

A file containing definitions and statements intended to be imported by other programs.

...

A final class cannot be extended. In other words, you cannot inherit from a final class in Java.

prompt

A formatter text that is used to give the user the ability to type in a question

What is an event handler?

A function that is called with a certain event occurs. Examples of these include button.onclick and window.onload.

boolean function

A function that returns a Boolean value. The only possible values of the bool type are False and True.

fruitful function

A function that returns a value when it is called.

print

A function used in a program or script that causes the Python interpreter to display a value on its output device.

Internet

A group of computers and servers that are connected to each other.

block

A group of consecutive statements with the same indentation.

strings

A string is usually a bit of text you want to display to someone, or "export" out of the program you are writing. Python knows you want something to be a string when you put either " (double-quotes) or ' (single-quotes) around the text. You saw this many times with your use of print when you put the text you want to go inside the string inside " or ' after the print to print the string. Strings may contain the format characters you have discovered so far. You simply put the formatted variables in the string, and then a % (percent) character, followed by the variable. The only catch is that if you want multiple formats in your string to print multiple variables, you need to put them inside ( ) (parenthesis) separated by , (commas). It's as if you were telling me to buy you a list of items from the store and you said, "I want milk, eggs, bread, and soup." Only as a programmer we say, "(milk, eggs, bread, soup)."

local variable

A variable defined inside a function. A local variable can only be used inside its function. Parameters of a function are also a special kind of local variable.

variable

A variable is something that holds a value that may change. In simplest terms, a variable is just a box that you can put stuff in. You can use variables such as numbers. Ex: lucky = 7 print(lucky) 7

binary

A way of representing information using only two options.

output

A way to get information out of a computer.

input

A way to give information to a computer.

Semantic Web

A web of data with a meaning in the sense that computer programs can know enough about the data to process it.

Intellectual Property

A work or invention that is the result of creativity, such as a manuscript or a design, to which one has rights and for which one may apply for a patent, copyright, trademark, etc.

How can you turn off the rightmost 1Bit?

AND with (number - 1)

The _____ coding scheme contains a set of 128 numeric codes that are used to represent characters in the computer memory.

ASCII

\b

ASCII Backspace (BS) - Erases last character printed

\a

ASCII Bell -may cause receiving device to emit a bell or warning of some kind

\r

ASCII Carriage Return (CR) - Resets position to beginning of a line of text

\f

ASCII FormFeed (FF) - ASCII Control character. Forces printer to eject current page and continue printing at top of another.

\t

ASCII Horizontal Tab (TAB) - 8 horizontal spaces; tab

\n

ASCII LineFeed (LF) - Goes to next line -newline escape

\v

ASCII Vertical Tab (VT) - 6 vertical lines; 1 inch

Open Systems Interconnection (OSI)

Abstraction of the three network layers subdivided further

Streaming

Accessing cache memory of a node

ACC

Accumulator

Stores results and values from the ALU

Accumulator

The variable used to keep the running total

Accumulator

INSERT INTO

Add Columns or data to a table INSERT INTO table_name (column1,column2,column3,...) VALUES (value1,value2,value3,...);

ALTER TABLE Persons ADD CONSTRAINT uc_PersonID UNIQUE (P_Id,LastName) ALTER TABLE Persons ADD UNIQUE (P_Id)

Add constraint

SQL Injection

Add to webpage, like: txtUserId = getRequestString("UserId"); txtSQL = "SELECT * FROM Users WHERE UserId = " + txtUserId;

How do you recognize overflow in two complement?

Adding 2 positive results in negative and vice versa

DATE_ADD()

Adds a specified time interval to a date

FULL OUTER JOIN or FULL JOIN

Adds columns from one table to another by way of a join

append()

Adds input to the end of a list

Which kinds of variables are fully stored on the thread stack?

All local variables of primitive types ( boolean, byte, short, char, int, long, float, double) are fully stored on the thread stack and are thus not visible to other threads.

Explain how Functional Parallelism avoids race conditions?

All parameters passed to the function are copied, so no entity outside the receiving function can manipulate the data. This copying is essential to avoiding race conditions on the shared data. This makes the function execution similar to an atomic operation. Each function call can be executed independently of any other function call.

Open Architecture for the Internet

Allows connections among widely diverse systems

Memory Management

Allows programs to be stored safely and efficiently

Hotspot

Allows the visitor to interact with the site by clicking on a specific place on an image. For example, if you have a map you can create hotspots that bring up images or other links when the visitor clicks on them.

Application

Allows user to perform a task

event

An action that causes something to happen.

What exactly is concurrency?

An application is making progress on more than one task at the same time (concurrently). It does not completely finish one task before it begins the next.

HTML editor

An editor that makes web page creation easier than using a normal text editor. Although you can write HTML code using a standard text editor, it is strongly recommended that you use some type of HTML editor even for learning. There are two categories of text editor.

semantic error

An error in a program that makes it do something other than what the programmer intended.

syntax error

An error in a program that makes it impossible to parse — and therefore impossible to interpret.

bug

An error in a program that prevents the program from running as expected.

Syntax error

An error in the code that means it will not run. Incorrect spelling of keywords, leaving off speech marks or brackets, not using colons for "if" statements.

runtime error

An error that does not occur until the program has started to execute but that prevents the program from continuing.

WHERE

Clause that filters SELECT * FROM movies WHERE imdb_rating > 8; clause that indicates you want to filter the result set to include only rows where the following condition is true.

UPDATE, set age= age+1 where firstname="Mary"

Clause used with UPDATE where you make an update to a column and then list a condition

___ perform specific tasks in SQL. By convention, __ are written in capital letters. ___ can also be referred to as commands. ex) CREATE TABLE

Clauses

Batch SQL Code

Code statement; Code Statement2; Using semicolons allows multiple statements

What does thread safe mean?

Code that is safe to call by multiple threads simultaneously

Pair Programming

Code written by two programmers. "Driver" will write code, "navigator" analyses what is being written

How do you use Comparable on a collection?

Collections.sort(List) Here objects will be sorted on the basis of CompareTo method

How to use Comparator on a collection?

Collections.sort(List, Comparator) Here objects will be sorted on the basis of Compare method in Comparator

How can you transform a List into an array?

Collections.toArray

CONCAT()

Combines text together

zip()

Combines two or 3 lists to return all values in for loops

Opcode

Command

Half-duplex Communication

Communication channel that sends data in both directions, but not at the same time

How do you use java collections when need a stack?

Deque <T> stack = new LinkedList<T>()

Multiple Instruction Multiple Data (MIMD)

Different instructions carried out on different data at the same time

DATE_FORMAT()

Displays date/time data in different formats

Indexing

Dividing data up into categories

What is the DOM?

Document Object Model

\"

Double-quote (")

ALTER TABLE Persons DROP CONSTRAINT/INDEX uc_PersonID

Drop constraint

Round Robin

Each process given fixed amount of time

Which concurrency model is used by reactive or event driven systems

Each worker only performs a part of the full job. When that part is finished the worker forwards the job to the next worker. Each worker is running in its own thread, and shares no state with other workers. This is also sometimes referred to as a shared nothing concurrency model. They are usually design to use non-blocking IO.

Telnet

Early form of computer communication protocols

Assets

Elements such as images, music clips, or movies that you incorporate into your site. You can manage your assets easily in the Assets panel.

Extreme Programming

Emphasis on code, pair programming, versions released

truncate()

Empties the file

Foreign key

Ensure the referential integrity of the data in one table to match values in another table

Hardware drivers

Ensures hardware and software can communicate

Unique

Ensures that each row for a column must have a unique value

Check

Ensures that the value in a column meets a specific condition

What Math object method is used to return a given number rounded to the next lowest integer value?

Math.floor(number);

**=

Exponent AND. Performs exponential calculation on operators and assigns value to left operand. A**=B ~ A = A**B

DATE()

Extracts the date part of a date or date/time expression

True/False: A computer is a single device that performs different types of tasks for its users.

False

True/False: According to the behavior of integer division, when an integer is divided by an integer, the result will be a float.

False

True/False: All programs are normally stored in ROM and loaded into RAM as needed for processing.

False

True/False: Python allows you to compare strings, but it is not case sensitive.

False

True/False: The Python language uses a compiler, which is a program that both translates and executes the instructions in a high level language.

False

Describe how race conditions can occur.

If two or more threads share an object, and more than one thread updates variables in that shared object, race conditions may occur. Solved by Java synchronized block.

How can static factory methods reduce the verbosity of creating parameterized type instances?

If HashMap provided this generic static factory: public static <K, V> HashMap<K, V> newInstance() { return new HashMap<K, V>(); } Then instead of writing: Map<String, List<String>> m = new HashMap<String, List<String>>(); we could write this: Map<String, List<String>> m = HashMap.newInstance();

What is the volatile Happens-Before Guarantee?

If Thread A writes to a volatile variable and Thread B subsequently reads the same volatile variable, then all variables visible to Thread A before writing the volatile variable, will also be visible to Thread B after it has read the volatile variable. Instructions before and after can be reordered, but the volatile read or write cannot be mixed with these instructions. Whatever instructions follow a read or write of a volatile variable are guaranteed to happen after the read or write.

...

If a Java inner class declares fields or methods with the same names as field or methods in its enclosing class, the inner fields or methods are said to shadow over the outer fields or methods.

...

If a method or variable is marked as private (has the private access modifier assigned to it), then only code inside the same class can access the variable, or call the method. Code inside subclasses cannot access the variable or method, nor can code from any external class.

What is the Thread Control Escape Rule

If a resource is created, used and disposed within the control of the same thread, and never escapes the control of this thread, the use of that resource is thread safe.

Can you think of a guarantee to know if a given object is thread safe?

If an object created locally never escapes the method it was created in, it is thread safe.

What is the implication of implementing comparable for collections and arrays alike?

If any class implements the comparable interface then collection of that object can be sorted automatically using Collection.sort() or Arrays.sort()

Overflow error

If the sum of a binary operation does not fit within the bounds (e.g: a 9 bit number trying to be represented through 8 bit)

Describe the problem of Visibility of Shared Objects

If two or more threads are sharing an object, without the proper use of either volatile declarations or synchronization, updates to the shared object made by one thread may not be visible to other threads. Solved by volatile

Explain the consequences of workers having state.

If workers can be stateful, they have to be sure there are no other threads modify their data. They can keep their data in memory, only writing changes back the eventual external systems. A stateful worker can therefore often be faster than a stateless worker.

copying and cloning part 3

If you actually want two separate, individual objects, you need to create a clone: $a = new SomeClass(); $a->val = 1; $b = clone $a; // Separate objects! $b->val = 2; echo $a->val; // 1 When the clone operator is used, PHP will perform what's called a "shallow copy." If you want to change how a clone of an object is made, you can define a _ _clone() method within the class. That method would be called whenever a clone is made, and would handle the cloning as you see fit. See the PHP manual for details.

...

If you override a method in a subclass, and the method is all of a sudden removed or renamed or have its signature changed in the superclass, the method in the subclass no longer overrides the method in the superclass.

...

If you override a method in a subclass, but still need to call the method defined in the superclass, you can do so using the super reference

...

If you want to be sure that two String variables point to separate String objects, use the new operator like this: String myString1 = new String("Hello World");

...

If, however, the subclass calls up into a method in the superclass, and that method accesses the field with the same name as in the subclass, it is the field in the superclass that is accessed.

What are the advantages of implementing Runnable or extending Thread?

Implementing Runnable handing an instance of the implementation to a Thread instance is easy with Threadpools

universal import

Imports all functions and variables from a module - Can cause conflicts with user defined functions and vars - Better to import only necessary functions from module import *

Pipelining

Improving processor throughout by performing part of the FDE cycle concurrently

...

Let's assume our application, a todo-list, is already running for a while and the user presses a button to create a new entry in the todo-list. This will result in a button-clicked event in the DOM, which is captured by the DOM-Driver and forwarded to one of our ActionCreators. The ActionCreator takes the DOM-event and maps it to an action. Actions are an implementation of the Command Pattern, i.e. they describe what should be done, but do not modify anything themselves. In our example, we create an AddToDoItemAction and pass it to the Updater. The Updater contains the application logic. It keeps a reference to the current state of the application. Every time it receives an action from one of the ActionCreators, it generates the new state. In our example, if the current state contains three todo-items and we receive the AddToDoItemAction, the Updater will create a new state that contains the existing todo-items plus a new one. The state is passed to the View()-Function, which creates the so-called Virtual DOM. As the name suggests, the Virtual DOM is not the real DOM, but it is a data-structure that describes how the DOM should look like. The code snippet above shows an example of a Virtual DOM for a simple <div>. A later article will explain the Virtual DOM and its advantages in detail. The Virtual DOM is passed to the DOM-Driver which will update the DOM and wait for the next user input. With this, the cycle ends.

Mantissa

Numbers before decimal place

...

Java classes where the subclass constructors did not seem to call the constructors in the superclass. Maybe the superclass did not even have a constructor. However, the subclass constructors have still called superclass constructors in those case.

...

Java has a way to force all numbers in a calculation to be floating point variables. You suffix the numbers with either a capital F or D. Here is an example: 4F or 4D

Name integer types that will truncate division.

Java integer types (byte, short, int and long)

Java object serialization is performed using which classes?

Java object serialization (writing) is done with the ObjectOutputStream and deserialization (reading) is done with the ObjectInputStream.

Hybrid drives

Magnetic component where most of data is stored, with a smaller SSD for commonly accessed data

Where does a computer store a program and the data that the program is working with while the program is running?

Main memory

SDLC(Step 7)

Maintenance

How can you prevent race conditions?

Make sure that the critical section is executed as an atomic instruction. So that when a thread is executing it, no other can execute it until the first thread has left the critical section.

CREATE or REPLACE VIEW

Makes a view to see data

HTML Class

Makes it possible to define equal styles for elements by giving them all the same class name.

Lossless Compression

Makes use of redundant data, no data lost

...

Nested classes which are declared private are not inherited. Nested classes with the default (package) access modifier are only accessible to subclasses if the subclass is located in the same package as the superclass. Nested classes with the protected or public access modifier are always inherited by subclasses.

Physical Layer (OSI 1)

Network devices and transmission media

...

Notice how you put new after the reference to the outer class in order to create an instance of the inner class. Non-static nested classes (inner classes) have access to the fields of the enclosing class, even if they are declared private.

...

Now, for every iteration in this loop a new StringBuilder is created. Additionally, a String object is created by the toString() method. This results in a small object instantiation overhead per iteration: One StringBuilder object and one String object. This by itself is not the real performance killer though. But something else related to the creation of these objects is. Every time the new StringBuilder(result) code is executed, the StringBuilder constructor copies all characters from the result String into the StringBuilder. The more iterations the loop has, the bigger the result String grows. The bigger the result String grows, the longer it takes to copy the characters from it into a new StringBuilder, and again copy the characters from the StringBuilder into the temporary String created by the toString() method. In other words, the more iterations the slower each iteration becomes.

number(size, d)

Number value with a maximum number of digits of "size" total, with a maximum number of "d" digits to the right of the decimal.

What are the available properties for the Number object?

Number.MAX_VALUE Number.MIN_VALUE Number.POSITIVE_INFINITY Number.NEGATIVE_INFINITY Number.NaN

Exponent

Numbers after decimal place (determined position of decimal place in floating point binary)

conditional statement

One program structure within another, such as a conditional statement inside a branch of another conditional statement

DUAL table

One row and one column

os.path

Operating system path module: allows many functions to occur on a specified path. Ex: os.path exists will return a true or false if a file does or doesn't exist

PEMDAS

Order of Operations: Mode of Operations: Parentheses Exponents Multiplication Division Addition Subtraction

PEDMAS

Order of operations: parentheses, exponents, multiplication, division, addition, subtraction

Boolean Operators

Order: Not, And, Or

1001 0010 opcode

Output

INNER JOIN, ON

Returns all rows when there is at least one match in BOTH tables

values()

Returns an array of dict's values

CURDATE()

Returns to the current date

Three Layer Abstraction

Simplified, three-step set of how data communication works over a network

Web browser

Software used to retrieve and display web pages on the web. It is considered to be a client program which makes requests to web servers for web page files. Browsers can all read basic HTML but may be different in other areas such as being able to display or run script code, video and graphics.

Function

Some code that has been grouped together so that it can be reused by "calling" the function name. Like a mini-program within a program.

digital citizen

Someone who acts safely, responsibly, and respectfully online.

Web Programmer/Developer

Someone who works with a site plan or deign plan to program or build, the actual site. Programmers can also be designers.

Co-processors

Specialist processors perform tasks on a processors behalf

Graphical Processing Unit (GPU)

Specifically designed processor for executing instructions relating to creating and managing graphics on a computer

Default 'Food'

Specifies a default value when specified none for this column

CSS Selector

Specifies the part of the code which the style should be applied to.

how to implement the composite pattern

Start with an abstract base class that will be extended by the different subclasses. The base class needs to identify the methods for adding and removing "leaves" (or composite items). The base class also needs to identify any functionality that the composite, or its subelements, needs to do:

conditionals

Statements that only run under certain conditions or situations.

you can call static methods from an abstract class

Static methods in OOP do not change internal state, therefore you can call static methods from an abstract class.

DATE_SUB()

Subtracts a specified time interval from a date

Domain Name System (DNS)

System for providing domains to resources on a network

Logical Error

System not behaving in the way that the customer initially expected; programmers misunderstood task

...

The Java String class contains a split() method which can be used to split a String into an array of String objects. The source String has been split on the a characters. The Strings returned do not contain the a characters. The a characters are considered delimiters to split the String by, and the delimiters are not returned in the resulting String array.

...

The Java access modifiers private and protected cannot be assigned to a class.

...

The Java inheritance mechanism does not include constructors. In other words, constructors of a superclass are not inherited by subclasses. Subclasses can still call the constructors in the superclass using the super() contruct. In fact, a subclass constructor is required to call one of the constructors in the superclass as the very first action inside the constructor body.

Describe the Java memory model.

The Java memory model used internally in the JVM divides memory between thread stacks and the heap.

What is the volatile Visibility Guarantee

The Java volatile keyword guarantees visibility of changes to variables across threads.

...

The Math.abs() function returns the absolute value of the parameter passed to it.

...

The Math.ceil() function rounds a floating point value up to the nearest integer value.

...

The Math.floor() function rounds a floating point value down to the nearest integer value.

...

The Math.floorDiv() method divides one integer (int or long) by another, and rounds the result down to the nearest integer value. What is the difference to regular int division?

...

The Math.max() method returns the largest of two values passed to it as parameter.

...

The Math.round() method rounds a float or double to the nearest integer using normal math round rules .

RGB (Red Green Blue)

The combination of the three primary colors that can represent a full color spectrum.

...

The compareTo() method compares the String to another String and returns an int telling whether this String is smaller, equal to or larger than the other String. If the String is earlier in sorting order than the other String, compareTo() returns a negative number. If the String is equal in sorting order to the other String, compareTo() returns 0. If the String is after the other String in sorting order, the compareTo() metod returns a positive number.

Web server

The computer the web pages are stored on. The web server will transmit the web pages across the network/internet to the client computer which is running a web browser.

...

The default Java access modifier is declared by not writing any access modifier at all.

...

The default access modifier means that code inside the class itself as well as code inside classes in the same package as this class, can access the class, field, constructor or method which the default access modifier is assigned to. Therefore, the default access modifier is also sometimes referred to as the package access modifier.

accessibility

The design of products, devices, services, or environments taking into consideration the ability for all users to access, including people who experience disabilities or those who are limited by older or slower technology.

Home page

The main page of an organization or company which is the first page seen when the organization's URL is visited.

When is a function pure?

The outcome of a pure function depends only on the input parameters and they do not have any side effects.

...

The private access modifier means that only code inside the class itself can access this Java field. The package access modifier means that only code inside the class itself, or other classes in the same package, can access the field. You don't actually write the package modifier. By leaving out any access modifier, the access modifier defaults to package scope. The protected access modifier is like the package modifier, except subclasses of the class can also access the field, even if the subclass is not located in the same package. The public access modifier means that the field can be accessed by all classes in your application.

What is the "Visibility Problem"?

The problem with threads not seeing the latest value of a variable because it has not yet been written back to main memory by another thread, is called a "visibility" problem. The updates of one thread are not visible to other threads. Solution: By declaring the counter variable volatile all writes to the counter variable will be written back to main memory immediately. Also, all reads of the counter variable will be read directly from main memory.

recursion

The process of calling the currently executing function.

WHILE Loop

To repeat while a condition is true (e.g. while score < 100)

evaluate

To simplify an expression by performing the operations in order to yield a single value.

decrement

To subtract one from a variable.

IF Statement

To test if a condition is true (e.g. if age >17)

Network Layer (OSI 3)

Transmission of data packets, routing

--- edits a row in a table.

UPDATE

Update the table to include Taylor Swift's twitter handle. In the code editor type:

UPDATE celebs SET twitter_handle = '@taylorswift13' WHERE id = 4; SELECT * FROM celebs;

Two's Complement

Use MSB to find if positive or negative, invert all bits after MSB and add 1

Spiral Model

Used for high risk projects; broken into four stages (objective, possible risks, prototype, evaluation)

General Purpose Registers

Used to temporarily store data used

How do you assign a default value to a prompt?

Using the second parameter. Example: prompt("Enter Age:", "18");

<>

Value of two operands not equal? -Similar to !=

Comma Separated Value (CSV)

Variable length field database, separated by commas

function parameter

Variable name for passed in argment def function(parameter):

varchar(size)

Variable-length character string. Max size is specified in parenthesis.

,

We put a , (comma) at the end of each print line. This is so print doesn't end the line with a newline character and go to the next line

In which situation would you not use volatile?

When we want to read-update-write as an atomic operation (unless we're prepared to "miss an update"); Accessing a volatile variable never holds a lock.

...

When you call a constructor from inside another constructor, you use the this keyword to refer to the constructor

...

When you create a subclass of some class, the methods in the subclass cannot have less accessible access modifiers assigned to them than they had in the superclass.

autoload part1

When you define a class in one script that is referenced in another script, you have to make sure that the second script includes the first, or there will be errors. To that end, PHP 5 supports a special function called _ _autoload

Explain loitering

When you don't free references to be collected. E.g. In the array implementation of a stack, pop needs to null the entry for the popped item

keyword self

Whereas you can use $this within a class to refer to the current object instance, the keyword self is a reference to the current class:

If a variable is not a function and does not have var then it is?

a global variable

if a variable is not a function and does not have var then it is?

a global variable

variable

a name for a place to store strings, numbers etc.

composite pattern example pt1

abstract class FormComponent { abstract function add (FormComponent $obj); abstract function remove (FormComponent $obj); abstract function display(); abstract function validate(); abstract function showError(); } the abstract class here is also using type hinting. The first two methods are key to Composite. The other three represent the specific functionality needed by this particular example.

factory pattern example pt1

abstract class ShapeFactory { static function Create($type, array $sizes) { switch ($type) { case 'rectangle': return new Rectangle($sizes[0], $sizes[1]); break; case 'triangle': return new Triangle($sizes[0], $sizes[1], $sizes[2]); break; } // End of switch. } // End of Create() method. } // End of ShapeFactory class.

composite pattern example pt4

abstract class WorkUnit { protected $tasks = array(); protected $name = NULL; function _ _construct($name) { $this->name = $name; } function getName() { return ($this->name); } abstract function add(Employee $e); abstract function remove(Employee $e); abstract function addTask($task); abstract function removeTask($task); }

raw_Input

accepts a string, prints it, and then waits for the user to type something and press Enter (or Return).

Are you holding a lock when you access a synchronized method?

access to a volatile variable never has the potential to block: we're only ever doing a simple read or write, so unlike a synchronized block we will never hold on to any lock;

Are you holding a lock when you access a volatile variable?

access to a volatile variable never has the potential to block: we're only ever doing a simple read or write, so unlike a synchronized block we will never hold on to any lock;

universal import

access to all variables and functions in an import without having to type math.function constantly. (from module import *) con: fill your program with a ton of variables and functions and may not link them correctly to the module (your functions and their functions may get confused)

ADD

add mneumonic

list.append()

add to a list by typing list_name.append()

...

add() adds the given element to the collection, and returns true if the Collection changed as a result of calling the add() method.

...

addAll() adds all elements found in the Collection passed as parameter to the method. The Collection object itself is not added. Only its elements.

push() method does what?

adds new elements to an array [alters original] array.push(ele1,ele2,..,ele99) x=["1","2","3"] x.push("4") document.write(x)-->1,2,3,4

unshift() method does what?

adds new elements to the beginning of an array and returns new length array.unshift(ele1,ele2,...,ele99) x=["1","2","3"] document.write(x.unshift("4"))-->4

What is arity?

adjective describing how many operands an operator expects

How do you display an alert?

alert("Alert Text Here");

alert box syntax?

alert("message");

Objects on the heap can be accessed by..

all threads that have a reference to the object. When a thread has access to an object, it can also get access to that object's member variables.

...

an because accessing a volatile variable never holds a lock, it is not suitable for cases where we want to read-update-write as an atomic operation (unless we're prepared to "miss an update");

A while-loop is...

an infinite loop. "while True" ~ "While true is true, run this:"

PHP CALL BACK

array($this, $some_method_string) it is a valid callback , calling the method $some_method_string on $this. You can't pass $this->some_method_string without it being called right then and there.

purpose of namespace

as you begin utilizing more and more classes, including those defined by other developers and in third-party libraries, conflicts can occur if multiple classes have the same name. Namespaces prevent these conflicts by letting you organize your code into groups. This has the effect of allowing you to safely use descriptive names without concern for conflicts.

What does reflexive mean?

assertTrue( a.equals(a) );

=

assigns values from right side operands to left side operand

LOG2E is what?

base-2 logarithm of E approx (1.442)

token

basic elements of a language(letters, numbers, symbols)

composition and type hinting example

class Department { private $_name; private $_employees; function _ _construct($name) { $this->_name = $name; $this->_employees = array(); } function addEmployee(Employee $e){ $this->_employees[] = e; echo "<p>" . {$e->getName()} . "has been added to " . {$this->_name} . "</p>"; } } class Employee{ private _name; function __construct($name) { $this->_name = $name;} function getName(){ return ($this->_name);} } $hr = new Department('Human Resources'); $e1 = new Employee('Jane Doe'); $e2 = new Employee('John Doe'); $hr->addEmployee($e1); $hr->addEmployee($e2); unset($hr, $e2, $e1);

composite pattern example pt6

class Employee extends WorkUnit { function add(Employee $e) { return false; } function remove(Employee $e) { return false; } function assignTask($task) { $this->tasks[] = $task; } function completeTask($task) { $index = array_search($task, $this->tasks); unset($this->tasks[$index]); } } /

composite pattern example pt2

class Form extends FormComponent { private $_elements = array(); function add(FormComponent $obj) { $this->_elements[] = $obj; } function display() { // Display the entire form. } }

behavioral pattern example 2

class FormData { private $_data = NULL; function _ _construct($input) { $this->_data = $input; } function process(Filter $type) { $this->_data = $type->filter($this->_data); } } $form = new FormData($someUserInput); if (/* No HTML allowed. */) { $form->process(new HtmlFilter()); } if (/* No swear words allowed. */) { $form->process(new SwearFilter()); }

trait example continued

class Rectangle { use tDebug; public width = 0; public length = 0; function __construct($w,$l) { this->$width = $w; this->$length = $l; } public function getArea(){ return (this->$width*this->length); } ...... }

implementing multiple interfaces

class SomeClass implements iA, iB { /* code */ }

self example

class SomeClass { function _ _construct() { self::doThis(); } protected function doThis() { echo 'done!'; } } self::doThis() will invoke the doThis() method of the current class

How to use Type Hinting

class SomeClass { function doThis(OtherClass $var) { } } If the argument passed to the doThis() method is not of type OtherClass, or of a derived subclass, PHP will generate a fatal error

composite pattern example pt5

class Team extends WorkUnit{ private $_employees = array(); function add(Employee $e){ $this->_employees []= $e; } function remove(Employee $e){ $ind = array_search($e,$this->_employees); unset($this->_employees[$ind]); } function assignTask(Task $k){ $this->tasks [] = $k; } function completeTask(Task $k){ $ind = array_search($k, $this->_tasks); unset($this->_taks[ind]); } function getCount() { return count($this->employees); } }

What is the main disadvantage of providing only static factory methods?

classes without public or protected constructors cannot be subclassed.For example, it is impossible to subclass any of the convenience implementation classes in the Collections Framework. Arguably this can be a blessing in disguise, as it encourages programmers to use composition instead of inheritance.

Relevant

closely connected or appropriate to the matter at hand.

A ___ is a set of data values of a particular type. Here id, name, and age are each ---

column

analogy of namespace

compare namespaces to creating a directory structure on your computer. You cannot place two files named functions.php within the same folder. However, you can place one in the MyUtilities folder and another in the YourUtilities folder, thereby making both versions of functions.php available.

...

compareTo() method may not work correctly for Strings in different languages than English. To sort Strings correctly in a specific language, use a Collator.

types of strings object properties

constructor- returns the function that created the objects prototype. length- returns the length of characters of a string. prototype-allows you to add properties and methods to an object.

while

controls flow of the program with truth statements. Statements inside the while loop are executed until the expression evaluates false.

lower()

converts a string to lowercase

lambda

creates a new anonymous function

how to loop through dictionaries keys

d = {"foo" : "bar"} for key in d: print d[key]

comment

in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program

(x)

in general is a remembered group. You can get the value of what matched by using the groups() method of the object returned by re.search

statement

instruction that the Python interpreter can execute

ALTER [Table, Database]

modifies a table/database

os

module - OS routines for NT or POSIX

sys

module - contains important objects and functions

The % symbol is the remainder operator and it is also known as the _______________ operator.

modulus

mv

move a file or directory

seek()

move to a new position in file, reads bytes

\n

moves whatever's after it to a new ling

Race conditions occur only if ...

multiple threads are accessing the same resource, and one or more of the threads write to the resource. If multiple threads read the same resource race conditions do not occur.

hostname

my computer's network name

When is volatile Enough?

n case only one thread reads and writes the value of a volatile variable and other threads only read the variable, then the reading threads are guaranteed to see the latest value written to the volatile variable. Without making the variable volatile, this would not be guaranteed. The volatile keyword is guaranteed to work on 32 bit and 64 variables.

finding browsers and app.name?

navigator.appName - name navigator.appVersion - version #

determining if cookies are enabled?

navigator.cookieEnabled - true or false

How would you name a static factory method that returns an instance that is described by the parameters but cannot be said to have the same value when it guarantees that each instance returned is distinct from all others?

newInstance

purchases.customer_info

nomenclature used for naming tables when joins for multiple tables is present

The logical _______________ operator reverses the truth of a Boolean expression.

not

How can you return only 1 or 0 for the rightmost 1Bit value?

number & ( - number)

How can you turn on the rightmost 0-bit.

number OR (number + 1)

object based programming what does this mean?

objects have properties & methods for example { var txt="Hello World!"; document.write(txt.length) } gives the property of length of txt and writes it to the doc which is 12.

proprioception

on a robot, internal sensing mechanisms. On a human, a sense of the relative positions of different parts of ones own body.

HTML DOM mouse events?

onclick ondblclick mousedown mousemove mouseover mouseout mouseup

What are the events common to most controls?

onfocus //Fired when control receives focus onblur //Fired when control loses focus onclick //Fired when the control is clicked ondblclick //Fired when the control is double clicked onchange //Fired when the control's value is changed onselect //Fired when text is selected in a textbox or text area

SELECT name FROM celebs;

only name column shows from celebs table

IN

operator that tests whether or not a value (stated before the keyword) is part of the list of values provided after the keyword; replaces compound operator need to use AND/OR

ORDER BY

optional clause to sort

Sketch the components of the service provider framework

public interface Service {} public interface Provider { Service newService(); } public class Services { private Services() { } // Prevents instantiation (Item 4) // Maps service names to services private static final Map<String, Provider> providers = new ConcurrentHashMap<String, Provider>(); public static final String DEFAULT_PROVIDER_NAME = "<def>"; // Provider registration API public static void registerDefaultProvider(Provider p) { registerProvider(DEFAULT_PROVIDER_NAME, p); } public static void registerProvider(String name, Provider p){ providers.put(name, p); } // Service access API public static Service newInstance() { return newInstance(DEFAULT_PROVIDER_NAME); } public static Service newInstance(String name) { Provider p = providers.get(name); if (p == null) throw new IllegalArgumentException( "No provider registered with name: " + name); return p.newService(); } }

what does the log() method do?

returns the natural logarithm (base E) of a number Math.log(number) document.write(Math.log(2))-->0.6931

COUNT(*)

returns the number of rows in a table

How do you assign the return value of confirm() to a variable?

var answerVar = confirm("Message Text Here");

three levels of visibility

public, protected, and private

pushd

push directory

column IS NULL; column IS NOT NULL;

query used to search for null values

confirm box syntax?

r=confirm("press a button") if(r==true) { alert('you pressed ok!'); } else { alert('you pressed cancel'); }

ABS(x)

returns the absolute value of x

what does acos() method do?

returns the arccosine of a number in radians Math.acos(x) document.write(Math.acos(0.64))-->0.87629

can javascript detect a browser type?

yes and version.

man

read a manual page

regexp means what?

regular expression

A(n) _______________ operator determines whether a specific relationship exists between two values.

relational

Tables are sometimes referred to as ---

relations

remove duplicates from a sorted list

remove all successive nodes that have the same element. Time analysis here is amortized O(n).

rmdir

remove directory

...

remove() removes the given element and returns true if the removed element was present in the Collection, and was removed. If the element was not present, the remove() method returns false.

.remove()

removes items from list

pop() does what?

removes the last element of an array and returns it [alters original] array.pop() fruits=["apple","nana","grape","orange"] document.write(fruits.pop())-->orange document.write(fruits())-->apple,nana,grape

what does atan2() method do?

returns the arctangent between positive x-axis and the point Math.atan2(x,y) document.write(Math.atan2(8,4))-->1.1071

what does atan() method do?

returns the arctangent of a number in radians Math.atan(x) document.write(Math.atan(2))-->1.1071

what does cos() method do?

returns the cosine of a number Math.cos(number) document.write(Math.cos(3))-->-0.9899

Is javascript case sensitive?

yes!

factory pattern example pt 2

require('ShapeFactory.php'); require('Shape.php'); require('Triangle.php'); require('Rectangle.php'); if (isset($_GET['shape'], $_GET['dimensions'])) { $obj = ShapeFactory::Create ($_GET['shape'], $_GET['dimensions']); }

what does the random() method do?

returns a random number between 0 and 1 [use .floor() and * to get a higher number] Math.random() document.write(Math.random())-->0.57

MAX

returns largest value in a column

MIN

returns smallest value in a column

Describe the pattern implemented in JDBC Connection, DriverManager and Driver

service provider framework: Connection: service interface, DriverManager.registerDriver: provider registration API DriverManager.getConnection: service access API Driver: service provider interface

What are the available set methods for a Date object?

setFullYear(); //Sets 4 digit year setMonth(); //Sets months, starts with 0 for January setDate(); // Sets day of the month setHours(); //Sets hours in the day setMinutes(); //Sets the minutes in the current hour setSeconds(); //Sets seconds in the current minute setMilliseconds(); //Sets milliseconds in the current second

Conditional Statement: Elif

short for else if...otherwise, if the following expression is true, do this!

%d

signed integer decimal

%i

signed integer decimal

Programs are commonly referred to as

software

A _____ has no moving parts, and operates faster than a traditional disk drive.

solid state drive

ASC

sort by ascending (smallest on top)

DESC

sort by descending (largest on top)

What String object method is used to return a new string that contains part of the original string from the specified start position?

substring(startIndex);

What String object method is used to return a new string that contains part of the original string from the specified start position and up to but not including the specified stop index?

substring(startIndex, stopIndex); //stopIndex is optional, if it is not specified, then it will go until the end of the string

What is the format for a switch statement in JavaScript?

switch (inputVar) { case "caseSwitch1": //Operations here //No break so it cascades to caseSwitch2. case "caseSwitch2": //Operations here break; //Break so it will not continue to cascade down. }

switch statement syntax?

switch(variable) { case 1; code break; case "example"; code break default; code }

max()

takes largest out of a set of numbers and returns it

min()

takes smallest out of a set of numbers and returns it

\

tells Python not to end the string

what does the exec() method do?

tests for a match in a string (returns matched text if found null if not) y=/regexp/ y.exec(string)

what does the test() method do?

tests for a match in a string, returns true or false (true if found, false if not) y=/regexp/ y.test(string)

is

tests for object identity

Text Decoration tag

text-decoration: value;

argv

the "argument variable," a very standard name in programming, that you will find used in many other languages. This variable holds the arguments you pass to your Python script when you run it. You know how you type python ex13.py to run the ex13.py file? Well the ex13.py part of the command is called an "argument." What we'll do now is write a script that also accepts arguments. What's the difference between argv and raw_input()? The difference has to do with where the user is required to give input. If they give your script inputs on the command line, then you use argv. If you want them to input using the keyboard while the script is running, then use raw_input(). Line 3: script, first, second, third = argv Line 3 "unpacks" argv so that, rather than holding all the arguments, it gets assigned to four variables you can work with: script, first, second, and third. This may look strange, but "unpack" is probably the best word to describe what it does. It just says, "Take whatever is in argv, unpack it, and assign it to all of these variables on the left in order." (ex13.py)

Composite pattern

the Composite pattern applies in situations where you have an object that might represent a single entity or a composite entity, but still needs to be usable in the same manner.

booleans only non-primitve is what?

toString() boolean.toString()

What Date object method is used to return a string containing the date and time?

toString();

What Number object method is used to return a string with a given number base?

toString(base); //Bases can range from 2 to 36

What Date object method is used to return a string containing the time?

toTimeString();

What String object method returns a new string containing the value of the original string but in all upper case?

toUpperCase();

Which of the following represents an example to calculate the sum of the numbers (accumulator)?

total += number

a trait example

trait tDebug { public function dumpObject() { $class = get_class($this); $attributes = get_object_vars($this); $methods = get_class_methods($this); foreach ($attributes as $k => $v) { echo "<li>$k: $v</li>"; } foreach ($methods as $v) { echo "<li>$v</li>"; } echo '</li></ul>'; } // End of dumpObject() method. }

Boolean variable can reference one of two values: _____.

true or false

Avoid SQL Injection

txtNam = getRequestString("CustomerName"); txtAdd = getRequestString("Address"); txtCit = getRequestString("City"); txtSQL = "INSERT INTO Customers (CustomerName,Address,City) Values(@0,@1,@2)"; db.Execute(txtSQL,txtNam,txtAdd,txtCit);

When implementing equals, how do you compare enums?

type-safe enumerations : use either equals or == (they amount to the same thing, in this case)

SQL Injection 2

uName = getRequestString("UserName"); uPass = getRequestString("UserPass"); sql = "SELECT * FROM Users WHERE Name ='" + uName + "' AND Pass ='" + uPass + "'"

delete an object

unset($object);

Delete the Kth last element from a singly linked list

use 2 iterators, the second is k steps behind the first

When implementing equals, how do you compare primitive fields other than float or double

use ==

use keyword

use MyNamespace\Company; $obj = new Department();

assert

used for debugging purposes

/

used for division

\D meta character does what?

used for find a non-digit character x="hello world9" y=/\D/g document.write(x.match(y))--> h,e,l,l,o, ,w,o,r,l,d

%

used for modulo Boolean

*

used for multiplication

PRO%

used for what a command starts with, located in LIKE for WHERE clause

def

used to create a new user defined function

\b meta character does what?

used to find a match at the beginning or end of a word (if none null) x="hello world" y=/\bworld/g document.write(x.match(y))--> world

\n meta chracter does what?

used to find a newline character (only useful in alert text) x="hello \n world" y=/\n/g document.write(x.search(y))--> 5

\S meta character does what?

used to find a non-whitespace character x="hello world" y=/\S/g document.write(x.match(y))-->h,e,l,l,o,w,o,r,l,d

continue

used to interrupt the current cycle, without jumping out of the whole cycle. New cycle will begin.

what are regexp modifiers?

used to perform case-insensitive and global searches

SELECT DISTINCT

used to return unique values in the result set. It filters out all duplicate values. Here, the result set lists each genre in the movies table exactly once. 1. SELECT DISTINCT specifies that the statement is going to be a query that returns unique values in the specified column(s)

NOT LIKE

used to show what is not contained in the word

onsubmit should be used for what and where?

validating form fields ex. <form action="blah.asp" method="post" onsubmit="return checkForm()">

conditional variable syntax?

z=(x==y)?5:6 z = 5 if x=y; z = 6 if x!=y;

How can you also declare -x bitwise?

~x + 1

what can be placed in a namespace

• Classes • Interfaces • Functions • Constants You couldn't create a namespace just to hold some variables.

A class at its core has three components:

• Its name • Its attributes • Its methods

where to use ::

• Within classes, to avoid confusion when inherited classes have the same attributes and methods • Outside of classes, to access members without first creating objects


संबंधित स्टडी सेट्स

AP Comparative Government Unit 2: Great Britain

View Set

Unit 6: Diving into the Finance Instruments

View Set

Microbiology Homework Chapter 9A

View Set

Oceanography Study Guide Chapter 1

View Set

APUSH chapters 2-5 Test Study Guide

View Set

Buscando amistad Lección 14 Estructura: 14.1

View Set

Army Physical Readiness Training - PRT

View Set

molecular bio: test 1 chapter 3 questions

View Set