Big Java, Late Objects Flashcards Preview

3. Procedural Programming (CSC 1025) > Big Java, Late Objects > Flashcards

Flashcards in Big Java, Late Objects Deck (84)
Loading flashcards...

What is a computer?

Machine that stores data, interacts with devices + executes programs. At heart of comp is CPU.


What is the CPU?

Central Processing Unit, composed of millions of transistors. Performs program control + data processing + executes programs, carries out arithmetic operations + fetches + places processed data into storage, of which there are 2 kinds. May not be obvious where this data resides on a networked comp.


What are the 2 kinds of storage?

Primary + secondary storage.


What is primary storage?

Made from memory chips, electronic circuits that can store data so long as they have electric power.


What is secondary storage?

Provides slower, less expensive storage which persists without power. Data + programs located here + loaded into memory when program starts. Program then updates program in memory + writes modified data back to sec storage. e.g. hard disk


What is a hard disk?

Secondary storage. Consists of rotating platters coated with magnetic material + read/write heads which can detect + change magnetic flux on platters.


What is magnetic flux?

Quantity/strength of magnetic lines produced by magnet.


How does comp interact with user?



How do high level programming languages work?

Created to make writing program instructions less tedious. Specify actions your program should carry out + compiler translates these into language of CPU.


What are applets?

Java code that can be located anywhere on internet. Java was first created for programming consumer devices but successfully used to write these in 1995.


Why is Java so good?

Has rich library so you can write portable programs that can bypass proprietary operating systems. Micro + enterprise edition of this to allow for a wide range of uses. It is safe + portable as it as designed for the internet. Safety features allow it to be run in browsers without fear of attack. Help you learn lang faster too as when you make an unsafe error, it tells you what's wrong.


What makes Java portable?

The compiler doesn't translate it directly into CPU instructions but instructions for the Java virtual machine, which simulates a real CPU.


What are the cons of Java?

It's not simple to write basic programs + you need a certain amount of technical machinery to write even the simplest program.


What is an editor?

Program for entering + modifying text, such as a Java program.


What is a compiler?

Java compiler translates source code (java) into class files which contains the info for the virtual machine. The VM then executes the program.


What should be pointed out in relation to backups?

Back up often, rotate backups (where you backup), pay attention to the backup direction (don't overwrite newer files with older files), check your backups + relax, then restore.


What are classes?

These are the fundamental building blocks of Java programs. Each java program contains a class with a main method. When app starts, instructions in main method are executed. Each class contains declarations of methods which contain sequence of instructions.


What does it mean if a program crashes?
What if it is hung?

It has quit spontaneously.
It failed to respond to your input.


What is pseudocode?

An informal description of a sequence of steps for solving a problem. Use indentation to indicate which statements should be selected/repeated.


What are the steps to creating a program?

Understand problem, develop + describe algorithm, test algorithm with simple inputs, translate into java + compile + test program.


What are the steps to describing an algorithm with pseudocode?

Determine inputs + outputs, break down problem into smaller tasks, describe each subtask in pseudocode + test pseudocode by working out example problem.


What does initialise mean?

To specify the value stored in the variable.


What is a number literal?

When a value such as 6 or 0.335 occurs in a Java program.


What is an assignment statement?

Used to name variable. Stores new value in variable, replacing previously stored value e.g. cans = 8; Doesn't include data type.


What is a variable declaration?

Used to name variable but includes data type + doesn't necessarily include value.


What is a constant?

A variable defined using reserved word 'final'. Its value can never change. Written with capital letters + underscores e.g. final double BOTTLE_VOLUME = 2;


Why are roundoff errors a fact of life?

There isn't always an exact representation of the decimal number you want in floating point numbers.


What is a magic number?

A numeric constant that appears in code without explanation e.g. totalVolume = bottles * 2. Name variable e.g. totalVolume = bottles * BOTTLE_VOLUME; Also allows us to change value rather than having to go back and find and change every 2.


What do you do if you want to compute with really large nums?

Use big number objects e.g. BigInteger + BigDecimal classes in java.math package. No limits on size + precision. However, computations using them is much slower + have to use diff operators e.g. add, subtract, multiple, not +, -, *. e.g. BigInteger oneHundred = new BigInteger ("100"); \n System.out.print(oneHundred.multiply(fiftyMillion)); BigDecimal carries out floating point calculations without roundoff errors.


What is an expression?

Combination of variables, literals, operators +/or method calls.