CSC 110 - Intro. to Computing Lecture 26: XML & Course Review
CSC 110 -Intro. to Computing
Lecture 26:XML & Course Review
Announcements
Essay due todayPlease e-mail essay & your service learning
logs Service Learning due 5PM Friday Quiz #6 available on class web page
Due at start of final If you hand it in earlier, I will give you the quiz
solutions to help you study
XML DTD XML documents include Document Type
Definition (DTD) which specify document’s organization
XML Example XML uses tags
from the DTD to label data in a document
File can now be “mined” like a database!
In-Class Exercise
Define the DTD and write an XML document for:Election ballotCollection of CDs
Final’s Format
Final will be similar to midtermA few fill-in-the-blanks or multiple choice, but
mostly problem solving and short answer Final will be closed-book and closed-note
Material for Final
Focus will be on material not covered on midtermStarting with Palgo and RobotranOlder material included only when it relates to
most recent material Try testing understanding of material rather
than rote memorization Important to understand hows and whys
Program Trace
1 x = 4 + 22 y = 8 * 13 z = y – 34 x = x + 15 z = y - x6 y = y / 27 z = “x”8 y = z + “b”
Line# x y z1 6
Line# x y z
2
Line# x y z
2 83
Line# x y z
2 83 54
Line# x y z
75
Line# x y z
16
Line# x y z
6 47
Line# x y z
x8
Line# x y z
xb
Tracing a Loop
1 x = 52 y = 33 total = 04 repeat y times5 total = total + x6 end7 print total
Line
Cond-ition x y tota
l output
1 52 33 04 1 of 35 54 2 of 35 104 3 of 35 157 15
Line
Cond-ition x y tota
l outputLine
Cond-ition x y tota
l output
1 5
Line
Cond-ition x y tota
l output
2 3
Line
Cond-ition x y tota
l output
3 0
Line
Cond-ition x y tota
l output
4 1 of 3
Line
Cond-ition x y tota
l output
5 5
Line
Cond-ition x y tota
l output
4 2 of 3
Line
Cond-ition x y tota
l output
5 10
Line
Cond-ition x y tota
l output
4 3 of 3
Line
Cond-ition x y tota
l outputCond-ition
5 15
Tracing n! 1 num = input_num(“What number?”)
2 fact = 13 for i = 1 to num4 fact = fact * i5 end6 print fact
Line Cond-ition
num fact i OutputCond-
ition1 4
Cond-ition
2 1
Cond-ition
3 1 < 4 1
Cond-ition
4 1
Cond-ition
3 2 < 4 2
Cond-ition
4 2
Cond-ition
3 3 < 4 3
Cond-ition
4 6
Cond-ition
3 4 < 4 4
Cond-ition
34 24
Line Cond-ition
num fact i Output
2 13 1 < 4 14 13 2 < 4 24 23 3 < 4 34 63 4 < 4 44 243 5 < 4 5
Line Cond-ition
num fact i Output
3 1 < 4 14 13 2 < 4 24 23 3 < 4 34 63 4 < 4 44 243 5 < 4 56 24
Palgo Loop Selection Each of Palgo’s loops serves different purpose
repeat Executing the commands a specific number of times
for Remembering the number of times that we are
executing the instructions in a loop Very useful for lists!
while Executing a loop for as long as needed to meet a specific
condition
Robotran Exampleprogram walkervar distancevar anglewhile true do let distance = getRand(3) go forward distance inches let angle = getRand(360) turn right angle degreesend
define getRand (parm max) returns float var number = random/100.0 * max return numberend
Simulations
Different types of simulatorsContinuous Simulations evaluates and
computes results at every instance in timeDiscrete Event Simulations emulate world by
examining when 2+ entities interact What are limitations of using simulations?
Ethics
Common understanding of ethics: Golden Rule – Do unto others as you would have
them do unto you Sniff Test – Does it seem like it is ethical?
Major systems of ethics: Divine dicta -- The divine states what is right Natural law -- Human intuition and conscience guides
what is right Relativism -- Prevailing standards set what is right;
must consider each situation in its environment
Ethics - Dentology
One must fulfill duties defined by law, religion, and societyCannot refuse to perform these duties for any
reason Based upon principle of universality
If an action would be wrong in any situation, then it is wrong in every situation
Ethics – Utilitarianism
Calculates whether actions are moral or immoralEvaluate benefits that arise from an actionCalculate the bad caused by an actionDetermine if good outweighs the bad
“The greatest good for the greatest number of people”
Ethics - Analogies
When deciding if an action is acceptable, people often relate it to a similar situationUse analogous decisions from the past to help
make the moral choice in the present Computers can make this more difficult
Not always clear if situations are comparableSomething that is good normally may not be once
the power and speed of computers are included
Ethics for the Final
Important consideration: Always clearly state and justify your arguments If needed, pick a side and argue itCorollary: Even the best opinion must be
backed up by a strong argument
Semantic Networks
Method of representing knowledge Focuses on relationship between items Typically shown as directed multi-graph
Data items are the vertices (points)Relationships are the edges (lines)
Relationships are one-way Know how to create & read these
Artificial Neuron Operation
Effective weight of an input is the input value multiplied by input’s weight
If sum of effective weights is equal to or above threshold neuron outputs 1When sum of effective weights is less than the
threshold, neuron outputs 0
Artificial Neuron Example
Consider the following neuron:
Output would be a 1 when threshold is 0.3 + (-3) + 0 + 4 = 1.3 or lower
Value Weight Effective Weight1 0.3 0.31 -3 -30 2 01 4 4
Ring Topology
Each machine connected to 2 others All data flows in one fixed direction
Source0
Target0
1
1
Source1
Target1
1
1
0
Star Topology
All data flows through central node Need to be careful to handle collisions
Source1
Target1
1
1
1
Source0
Target0
0
0
Bus Topology
Machines connected via shared bus But needs sophisticated collision handler
Source1
Target1
11
1
1
11
Target0
Source0
HTML & XML
What HTML tags are and how they workLimitations of HTML to describe the contents
of the page How to define a DTD and how to use this
in an XML document
Essay on Final Grading rubric used to grade your final:
Stating clear thesis 20%in opening paragraph
(Correctly) citing at least 1 20%ethical system
Making convincing arguments 25%to support your argument
Length 5% Spelling 5% Grammar 10% Organization 10% Clarity 5%
For the Final
I will be in my office most of Monday through Wednesday Can answer questions, discuss any issues
you may have, anything students would like