Unit One Flashcards
What is “bit” and acronym for?
Binary Digit
How many bits in a byte?
8
What does ASCII stand for?
American Standard Code for Information Interchange
What are the two categories of translation programs?
Interpreter & Compiler
What is object code?
Machine Language
How does an interpreter program translate code?
Line by line, translating then executing.
How does a compiler program translate code?
Translates entire source code.
Does a compiler execute code?
No
What kind of code does Java compile to?
Byte code
Which is faster, compiler or interpreter?
Compiler
What are the two main programming paradigms?
Procedural & Object Oriented
What is the difference between procedural and object oriented programming?
How you analyze a problem
Breaking down a process into atomic tasks
Task Analyses or Decomposition
What is an Algorithm?
A procedure or series of steps for solving a problem
What are the two components of an algorithm?
What are the tasks, what order are they to be done
What was the software crisis?
’60s programming was costly and inefficient due to a lack of cohesive standards
What was a major coding component of the Software Crisis?
GOTO statements leading to “spaghetti code”
What are the 3 control structures necessary for any program?
1) Sequence
2) Selection (conditional “IF” “THEN”)
3) Repetition (looping)
What is an “Object” in programming?
Some computer code that models a self contained entity in the real world
What two things comprise an object?
Data (Variables) and Actions (Methods)
What programming language is Java based on?
C++
What is the Java compiler called?
javac.exe
What makes Byte Code unique?
It cannot run on any CPU
What is the JVM?
Java Virtual Machine, software that interprets Byte code
Where is data that has been typed stored?
The Keyboard Buffer
What is the Java API?
Application Programmer Interface, holds thousands of useful classes in “packages” or class libraries
To access a package from the API, what must you do?
Import the package with an import statement
How do you perform a manual flush of the keyboard buffer?
input.nextLine( );
What operations require a manual buffer flush? (3)
next( );
nextInt( );
nextDouble( );
What is the character at the end of typing called?
End of Line character
New Line character
Carriage Return
What is a variable?
A storage location in the computer’s memory, or RAM.
What two things must a variable have?
1) A name
2) A data type
What are three other ways to say variable name?
1) Identifier
2) Reference
3) Handle
To create a variable, you must _______ it.
Declare
What are we doing when we declare a variable?
Binding to a memory address
What can a variable name NOT start with?
A number
What CAN a variable name start with?
A letter (A,a) A dollar sign ($) An underscore (_)
What words can’t be variable names?
Java Reserved Words
Why do we specify data types when declaring a variable?
It tells the computer how many bytes of memory to allocate the variable
ASCII and UNICODE share ___ characters.
256, or 2^8
What are the two data types?
1) Primitive
2) Object
What is the difference between primitive and object data types?
Primitive have no method associated with them.
How many primitive data types are there?
8
6 Numeric
2 Non-numeric
What are the 6 numeric primitive data types?
Byte Short Int Long Float Double
How may bits in a “short” data type?
16 bits, or 2 bytes
How many bits in an “int” data type?
32 bits, or 4 bytes
How many bits in a “long” data type?
64 bits, or 8 bytes
How many bits in a “float” data type?
32 bits, or 4 bytes
How many bits in a “double” data type?
64 bits, or 8 bytes
What are the 2 default numeric data types?
Int and Double
How many bits in a “char” data type?
16 bits, or 2 bytes
How many bits in a “boolean” data type?
1 bit
How is floating data stored?
As a mantissa and an exponent
What is the naming convention for constants?
UPPER_CASE_LETTERS
What keyword is used to declare a constant?
final
What is a String?
A sequence of characters
What is a string literal?
Surrounding a String of characters with quotation marks (“ “)
What kind of operators are “+, -, *, /, and %” and why?
Binary operators, because they appear between two operands.
What is a unary operator?
”+, -“ do denote positive and negative.
What is the increment operator?
++
What is “–” called?
The decrement operator
For increment operations, which type is most common?
Post-increment
What is type casting?
Converting a value of one data type into a value of another data type.
if Statements are ______-selection type.
Single
What type of statement is an “if-else”?
Double-selection type.
How do you get a “true” result from an && operation?
Both conditions bust be true.
How do you get a “false” result from an || operation?
Both conditions must be false.
Why do we use the double “&&, ||” when the single will do?
Single “&” is the bitwise operator, and both sides will be evaluated regardless of first result.
What is the “!” operator?
The “NOT” operator.
What are some other names for the XOR operator?
EXCLUSIVE OR, Bitwise Comparison Operator
What is the symbol for XOR?
What does the XOR compare?
Boolean values, only returning TRUE if they are DIFFERENT.
Can a switch statement evaluate a floating data type?
No
A switch can only test for ________.
Equality “==”
What unique character is used in switch statements?
The colon, “:”
What is the syntax for the ternary operator?
condition ? value if true : value if false
What are the three types of programming errors?
1) Syntax Error
2) Runtime Error
3) Logic Error
Which type of error stops code from compiling?
Syntax error
Which type of error gives the wrong result?
Logic error
Which type of error lets the program compile, but stops it from executing?
Runtime error