0% found this document useful (0 votes)
54 views4 pages

Cheat Sheet For Final

Uploaded by

smithabinni12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views4 pages

Cheat Sheet For Final

Uploaded by

smithabinni12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Computer Hardware (iii).

OS stored in main memory, loaded into CPU


Personal Computers: desktop, laptop & as required.
notebook machines, web-surf, chat, write (iv).Program loaded from secondary storage
letters/papers. into main memory (CPU running, OS code).
Embedded Systems: games consoles, cell (v).Program commands loaded into CPU as
phones, car. required
Servers: web servers, file servers, cloud (changes to variables (in main memory)
computing. ,input/output requires OS code).
Computer: a machine that stores information & File Servers: remembers files.
instructions for its own operation.  Internet connected networks to each
Operating Systems: e.g. Windows 10, macOS 10 other.
(runs the computer) IP = Internet Packet (piece of a message)
Applications: e.g. PowerPoint, Chrome, TikTok  IP address indicates
(what people are using the computer for) source/destination of
Programming Languages: to make more message.
software.  message pieces pass
Input devices (data into the computer) thru multiple
mouse, keyboard, microphone, touch screen. computers.
Output devices (data out of the computer)  different packets may
screen, speakers, printer. go thru different
CPU (Central Processing Unit) computers.
process the data (add, multiply, move, ...) Modulator-Demodulator  MODEM ( sound
understands the instructions. conversion for early internet that only allowed
may have extra CPUs (GPU, for example) text messges).
Main Memory: remember what the computer’s HTTP – Hyper-Text Transfer Protocol
working on (volatile = lost when power goes out  language for laying out document
small(ish) capacity (megabytes/gigabytes)). content.
Secondary storage: hold files when the power’s  allows links in documents to other
off. use the open and save commands in a documents.
program. Large capacity  click and go!
Web pages  documents using HTTP.
(gigabytes/terabytes/...)
Internet ≈ Hardware; Web ≈ Software.
Internal: hard disk, solid state storage
Client-Server:
External: USB drive, CD, DVD, ...
§ Client is computer asking for
floppy disk, punch cards, tape, ...
information.
Running a Program:
§ Server provides the information.
(i). User requests program to start
§ Web browser (or similar software)
[types of command on keyboard
renders the information on the client
uses mouse to double-click icon on screen
computer.
uses finger to tap icon on screen
§ Some computing may be required in
speaks command to computer
client.
looks pointedly at the screen
s client-side computing
thinks at the computer]
§ Some computing may be done on
Input devices: keyboard, mouse, touch-screen,
server.
microphone, eye-tracking device, EEG probes
s server-side computing
(ii). Operating system provides continuous
The Cloud:
feedback on output device(s). (visual
§ More services moving to server side.
(screen),audio (speaker)
s storing files on the Web
tactile (vibrator))
» Dropbox, OneDrive, … Java Runtime Environment
s voice recognition done on s a program that runs JVM
server. machine code
» Siri, Alexa, Google » an emulator
Home, … Source code in a .java file
s storing programs on Web s GradeCalculatorApp.java
» Office 365, GSuite, Compiled code in a .class file
AppsAnywhere. s GradeCalculatorApp.class
§ Human can access using any device GUI program in a .jar file
switch between desktop, laptop, phone. s GradeCalculatorApp.jar
Speed of Memory: » can just click and run
data in main memory is accessed FAST. this file
data on secondary storage is slow. » if your computer
data on LAN is slower. has .jar default set
need to wait for other computers properly!
data on internet is slower still Artificial Intelligence:
many more computers involved; The quest to build a machine with human-level
transmission time. intelligence (artificial = not natural)
Memory: Where information is stored s Turing again – the imitation
s your user data (photos, papers, game / tournament
messages, ...) Symbolic methods: computers and logic
s your programs (browsers, word s expert systems – clever but
processors, ...) brittle (failure)
Parts of memory Neural simulation: artificial brains
bits: each either a 0 or a 1 (“binary digit”) s very limited power – using old-
bytes: 8 bits (each byte has an address) time computers.
everything is represented with bits and byte. s modern computers bring lots of
Software: power.
Data & instructions Artificial Neural Networks:
s programs (instructions) Simulate neurons in animal brains:
manipulate data s neuron “fires”
s all represented with bits/bytes s sends energy on
Data hierarchy s connections get
s 8 bits  byte stronger/weaker
1 or more bytes  data value (field) as learning occurs
1 or more data values/objects  object (record) s system learns to classify inputs
data may be stored on secondary memory (file) into groups
Java Compiler: Need lots of neurons to do useful work.
Java designed to be “run anywhere” Deep Learning Applications:
s some source code on every § Speech recognition
computer s input = sounds; output = words
s compiled code runs on every § Language translation
computer s input = sentence in L1; output =
Java Virtual Machine (JVM) sentence in L2
s a make-believe computer § Image recognition
» Java source code input = image; output = object labels
compiled to JVM e.g. tagging faces in photographs
language ARRAYS 1:
Int n= new int [600]; equals – checks if two arrays have same
Reading arrays: elements
for (int i = 0; i < 600; i++) { fill – fills an array with a given value
n[i] = kbd.nextInt();} sort – sorts an array
printing arrays: toString – makes a String representing the array
for (int i = 599; i >= 0; i--) { Needs to be imported
System.out.print(n[i] + " ");} import java.util.Arrays;
Arrays can be of any type: Scanner [], thingy[]; sorting arrays: Arrays.sort(a);
Int [][] matrix = new int [10] [20]; Arrays.sort(words,
Question from user: String.CASE_INSENSITIVE_ORDER);
System.out.print("How many students? "); (ALPHABETICAL ORDER)
int numStu = kbd.nextInt(); Arrays has a method to make it nicer: (int weird)
kbd.nextLine(); System.out.println(Arrays.toString(arr));
String[] names = new String[numStu]; Possible Program Crashes:
System.out.println("What are their names?"); • ArrayIndexOutOfBoundsException
for (int i = 0; i < numStu; i++) { • NullPointerException
System.out.print(" Student #" + (i+1) + ": "); Methods 1
names[i] = kbd.nextLine();} target.name(arguments)
new array: Methods 2:
private int[] asgnGrades; String:
asgnGrades = new int[NUM_ASGN]; equals("yes")
When specific number not index is asked: equalsIgnoreCase("yes")
public static boolean inAsgnRange(int asgnNo) { startsWith("y")
return 1 <= asgnNo && asgnNo <= toUpperCase()
NUM_ASGN; toLowerCase()
} length()
ALWAYS RETURN IN IF STATEMENT IN RETURN Math.pow(x, y) – returns xy
METHOD. Math.max(a, b) – returns maximum of a and b
TYPE CASTING: int sum = 0; Math.min(a, b) – returns minimum of a and b
return (int)Math.round((double)sum / Math.sqrt(x) – returns square root of x
NUM_ASGN); Math.log(x) – returns natural log of x
ARRAY 2: Math.log10(x) – returns log10 of x
Array getter : Math.sin(theta) – returns sin of theta
Copy of Array: also cos, tan, asin, acos, atan
public int[] getAsgnGrades() { theta is in radians (not degrees)
int[] copy = new int[asgnGrades.length]; (int)Math.round(x) – x rounded to nearest int
for (int i = 0; i < copy.length; ++i) { (int)Math.rint(x) – same(!)
copy[i] = asgnGrades[i];} NOTE the (int): Math.round returns a long value
return copy;} Math.rint returns a double (!)
public int[] getAsgnGrades() { Math.random() – returns a random number in
// THIS is the way to return an array [0,1)
instance variable Object 1:
return Arrays.copyOf(asgnGrades, WIMP (Windows, Icons, Menus, Pointers)
NUM_ASGN);} interface
Arrays class provides many useful methods Private data; public methods
copyOf – copies an array Constructor:
copyOfRange – copies part of an array public class Rectangle {
private double height;
private double width; s process control
public Rectangle(double reqHgt, double § Graphical
use pictures
reqWid) { • Names of programs start with Capitals
height = reqHgt; • Names of variables start with little letters
weight = reqWid;}} import java.util.Scanner;
Getters: Scanner is what we want to use
java.util is “where it is” (it’s a package)
public double getHeight() { Comparing Strings:
return height;} oneString.equals(anotherString)
Setters: !oneString.equals(anotherString)
public void setHeight(double reqHgt) { "First String".equalsIgnoreCase("First String") [bool o/p]
if (reqHgt >= 0.0) { // if requested value is
OK…
height = reqHgt; // …use requested
value
} else {
Sopln("Illegal height for Rectangle: " +
reqHgt);}}
Introduction:
Programming Languages:
§ FORTRAN
§ LISP
§ ALGOL
§ COBOL
§ SNOBOL
§ PL/I
§ BASIC
§ APL
§ Pascal
§ Smalltalk
§ c
§ Prolog
§ Scheme
§ Modula
§ SQL
§ Ada
§ C++
§ Prograph
§ Perl
§ Python
§ Java
§ Javascript
§ C#
§ Ruby
Kinds of Languages:
§ Imperative (*)
s tell it what to do
§ Functional
s specify processes
§ Logical
s specify meanings
s say what you want
§ Object Oriented (*)
s data & process abstraction
§ Parallel

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy