Chapter 1 - Introduction Flashcards
(57 cards)
Describe the two components of a computer
1] Hardware (tangible) - Physical, tangible pieces that support the computing effort
2] Software (intangible) - Consists of programs and the data those programs use
What are programs? What other name do they go by?
Programs, also called applications, are a series of instructions that the hardware executes one after another
What is a programming language?
Programs are written in a particular programming language that uses specific words and symbols to express the problem solution
What are programming statements?
Instructions that are carried out when a program is executed. The rules of the programming language define how words and symbols can be combined into programming statements.
Provide a brief background of Java.
- A relatively new programming language developed in early 1990s by James Gosling of Sun Microsystems
- Java has gone through changes since its creation. The most recent Java technology is the “Java 2 Platform” which includes Java 2 Platform, Standard Edition (J2SE)
- Java is an object oriented programming language -> objects are fundamental elements of the language
What does it mean to say something is deprecated?
Deprecated means that something is considered old fashioned and not to be used.
What is the Java API (AKA The Standard Class Library)?
A library of extra software we can use when developing programs.
What is the meaning of a software library?
(1) When talking about a program or programming a software library refers to a collection of files, programs, routines, scripts or functions that can be referenced in the programming code
(2) A software library is a collection of software owned by a single company
Describe the purpose of comments in a Java program?
- First few lines of a program are comments
- Comments don’t affect what the program does but are included to make the program easier to understand by humans
- Can and should be included throughout a program to clearly identify the purpose of the program
- Comments allow programmers to communicate their thoughts independent of the code
- Comments can be any text whatsoever as they do not affect how the program executes
What is documentation?
What is inline documentation?
Documentation - Any written comments or documents, including a user’s guide and technical references
Inline Documentation - Comments included in a program (i.e. inside the source code)
What is a class definition? What makes up the class definition?
The rest of any program (after any comments at the beginning) is a class definition and goes from the first opening brace ({) to the final closing brace (}) on last line of the program.
A class definition is made up of:
- Method: A group of programming statements that is given a name
- Main Method: A method with the name main where processing in a Java program always begins
- Main method definition is always proceed by “public”, “static” and “void”
What does “invoke” or “call” mean?
Invoke or call means to execute a method, i.e. “invoke a method” or “call a method”
Can main methods contain other methods?
Yes, for e.g. we see the println method used often within the text:
public static void main (string[] args)
{
System.out.println(“A quote by Abraham Lincoln:”);
System.out.println(“Whatever you are, be a good one”);
}
What is the println method?
Println is a method that prints specified characters to the screen
Why are methods part of the system.out object not defined in Java programs?
Because methods part of the system.out object are part of the Java Standard Class Library so can just be referenced in the code
What are the two ways of writing inline comments?
1]
(A) Begin with a double slash & go to the end of the line, eg:
// This is a comment
(B) Comment and code on same line
system.out.println(“Monthly Report”); // always us this title
2] Anything between slash asterisks (/) & (/), eg:
/* This is another comment /
This type of comment can extend multiple lines, eg:
/
This is one comment
That spans several lines
*/
What are identifiers and reserved words?
-Identifiers are the various words used when writing programs
-There are three categories of identifiers:
(1) Words that we make up when writing a program. E.g. Lincoln, the name of a class in the text’s examples
(2) Words that another programmer chose.
E.g. predefined code like println or system or out from the Java Standard Library (not technically part of the Java language)
(3) Words that are reserved for special purposes in the language
I.e. Identifiers that have a special meaning in a programming language and can be used only in pre-defined ways e.g. class, public, static, void
What are the rules for “made up” identifiers
-Can have any combination of
(1) Letters
(2) Digits
(3) Underscore character ( _ )
(4) Dollar sign ( $ )
-But cannot begin w/ a digit
-Identifiers are case sensitive
E.g. total, Total, ToTal, are all different identifiers
What should you consider when it comes to the readability of identifiers you use?
Identifiers should be as readable and descriptive as possible. Avoid meaningless names, identifiers that are too long, and abbreviations that others and even yourself may have trouble understanding months later.
What is white space?
- Consists of blanks, tabs & new line characters
- White space is important because it can be used to emphasize parts of the code & can make a program easier to read
- White space is ignored by computer except when used to separate words -> i.e. it does not affect execution of the programs
- Lines of program should be divided in logical places
- Certain lines should be indented so that the program’s structure is clear
What are the different programming language levels?
- Machine language
- Assembly language
- High level languages
- Fourth generation languages
Describe what is machine language?
- For a program to run on a computer, it must be expressed in the computer’s machine language
- Each CPU has its own language
- Machine language instructions can accomplish only simple tasks, e.g. it might take four machine language instructions to add two numbers. However, a computer can do millions of these instructions in a second.
- Machine language code is expressed as a series of binary digits and is extremely difficult for humans to read and write
What is assembly language?
- Replaced binary digits with mnemonics, short English like words
- Cannot be directly executed on a computer, needs to first be translated into machine language
- Considered to be an “improvement” over machine language from a programmer’s perspective, but still tedious
What are low-level languages?
- What programmer use to write software
- High level language expressed in English like phrases and thus easier to read and write
- One high level programming language statement can accomplish many, perhaps hundreds of machine language instructions
- “high level” comes from the fact that programming statements expressed in a way far removed from machine language that is ultimately executed
- Examples of high level languages include Java, ADA, C++, Small T all and many others