CS101 - Bits 'n Pieces
Looking for something? It may be here already,
but if not, please ask for it
to be added.
This page primarily contains resources for Sections
1, 2 & 3
(though other sections are obviously free to use them too.)
Common resources will be on Moodle this semester.
Optional Extras
Extra material from classes
...placed
here after class, including homework questions to check your
understanding...
- Introduction - (course
organisation, etc.)
Homework:
- Find examples where
computer failures have led to loss of life or limb, or to considerable financial
losses.
- Everyday Algorithms - (Intro to algorithm design) <-- still subject to change!
Homework:
- Design an algorithm to
solve the final step in our supermarket shopping example, i.e. "Go to
checkout and pay for items". Assume a low-tech solution, in which the
cashier has a price list that gives the price for each item in the
market. Graded homework, due in next class.
- Real-World Algorithms (Simple computational algorithms: the area-circumference and exam average examples)
Homework:
- Try extending the solution to the exam average problem to check for
and handle invalid exam grades (i.e. output an appropriate message
should the user enter a grade outside the range 0-10). Can you also
allow the user to enter the minimum and maximum exam grades? How about
asking the user if they want to do another circle computation or exit?
- From Algorithm to Architecture (Computer & program language architecture)
Homework:- Ungraded homework. What
memory locations are needed for the exam average problem? How do you
decide? Trace the exam average algorithm using your proposed memory
locations.
- What is virtual memory and how does it work?
- What is cache memory and how does it help improve system performance?
- How
do modern hard disks work? How fast are they (in other words, how long
does it take to store and retrieve information to/from a disk?) What is
the difference in speed between modern primary and secondary memory
technologies? Are there any new technologies that might allow us to use
just one technology in our machines? What characteristics should it
possess?
- Current CPUs are 32 bits with newer ones said to be 64
bits. What does this refer to and what difference does it make to the
overall system?
- What does the clock speed, often quoted in
advertisements for computer systems, refer to? Does it offer a
meaningful way to compare different machines? What is overclocking?
What function do clocks serve in digital systems? Are they necessary?
- Is it possible to reverse the compilation process and recover the source code from the machine code?
- Java combines compilation and interpretation. Why? Are/were there any similar systems?
-
JavaCoding (Introducing
Java syntax for comments, identifiers, data types, variables, constants,
input, output & assignment statements, plus CS101 template program!)
Homework:
- Why do computer systems use a binary (base-two) representation for
numbers, rather than base-ten?
- How do you perform binary addition? How are negative values
represented? Subtraction?
- What is octal? What is hexadecimal?
- Most high-level languages offer several numeric data types to chose
from, e.g. in Java you have integer types such as byte, int & long, and
real types including float and double. Clearly, int can represent all
the values that byte can, and long can represent all those of int.
Similarly double can do all the float values and (at least on the face
of it) all those of long too. So, why have all these different types?
Why not just have double?
- ASCII is one of the earliest and best known computer codes. Can you
name another? Why does Java not use ASCII? The brave may like to take a
deeper look into the UNICODE
standardthat Java uses to represent character data.
- Why have numeric types when you can obviously represent any number
as a sequence of digit characters?
- Devise a code to represent the days of the week? Is your code
minimal? What is the minimum number of bits required?
- Test example using
NumberFormat & printf in
different Locales.
-
Java Coding 2 (Syntax
& examples of decision "if" statements in Java)
Course Documents
Installing Java, JCreator on your own computers
- We will be using Java 7.x and JCreator 5.00LE for CS101 &
CS102. The lab machines should already be setup ready for you to use.
To setup your own computers simply follow these instructions for
installing & using Java & JCreator.
Selected Online resources
Online Textbooks
- An absolutely excellent online Java book with quizzes and
programming exercises
is David Eck's "Introduction
to Programming Using Java"
{ This uses TextIO.get to read from the keyboard and TextIO.put instead
of System.out.println to output to the console. Other than that it
follows almost exactly the sequence I am doing and includes a number of
good worked design examples -although not as top-down or thorough as I
would like!}
- For another very good online Java tutorial complete with
quizzes
and programming exercises see
Introduction to Computer Science using Java by Bradley Kjell of
Central Connecticut State University.
{ Uses standard Java input & output, and does all the "thinking" in
Java rather than at the pseudocode level. Other than that, very good,
with lots of examples and step-by-step problem solving.}