Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
181 Cards in this Set
- Front
- Back
Flow of if/else statement |
Is the test true? Yes: Execute the if controlled statement No: Execute the else controlled statement Execute the statement after the if/else statement |
|
Relational operators |
== (equal to) != (not equal to) < less than > greater than <= less than or equal to >= greater than or equal to |
|
==, !=, <, >, <=, >= are what kind of operators? |
Relational operators |
|
If you want to execute any combination of controlled statements, what should you use? |
Sequential ifs |
|
Sequential ifs are used for what? |
To execute any combination of controlled statements |
|
If you want to execute zero or one of the controlled statements, what should you use? |
Nested ifs ending in test |
|
Nested ifs ending in a test are used for what? |
To execute one or zero of the controlled statements |
|
If you want to execute exactly one of the controlled statements, what should you use? |
Nested ifs ending in else |
|
Nested ifs ending in else are used for what? |
To execute exactly one of the controlled statements |
|
What method should you use to check string equality? |
s.equals("yes"), the equals method |
|
Will this statement work? s == 'yes' |
No, for strings, you always have to use the equals method |
|
What is factoring? |
Where you factor out the common pieces of code from the difference branches of an if/else statement |
|
What is the process when you factor out the common pieces of code from the difference branches of an if/else statement? |
Factoring |
|
What is a cumulative algorithm? |
An operation in which the overall value is computed incrementally, often using a loop |
|
What is an operation in which the overall value is computed incrementally, often using a loop? |
A cumulative algorithm |
|
What is a roundoff error? |
A numerical error that occurs because floating point numbers are stored as an approximation rather than as exact values |
|
What is a numerical error that occurs because floating point numbers are stored as an approximation rather than as exact values? |
A roundoff error |
|
If you need to store an exact value, what should you use? |
An int |
|
What value is an approximation, not exact? |
A floating point or double |
|
What is text processing? |
Editing and formatting strings of text |
|
What is editing and formatting strings of text? |
Text processing |
|
What does Character.getNumericValue(ch) do? |
Converts a character that looks like a number into that number |
|
What method converts a character that looks like a number into that number? |
Character.getNumericValue(ch) |
|
What does the method Character.isDigit(ch) do? |
Boolean check if character is one of the digits 0 - 9 |
|
What method checks if a a character is numeric? |
Character.isDigit(ch) |
|
What does the method Character.isLetter(ch) do? |
Boolean check if the character is in the range a -z or A - Z |
|
What method checks if a character is actually a character? |
Character.isLetter(ch) |
|
What does the method Character.isLowerCase(ch) do? |
Boolean check if the character is a lowercase letter |
|
What method checks if the character is lowercase? |
Character.isLowerCase(ch) |
|
What does the method Character.isUpperCase(ch) do? |
Boolean check if the character is an uppercase letter |
|
What method checks if the character is uppercase ? |
Character.isUpperCase(ch) |
|
What does the method Character.toUpperCase(ch) do? |
The uppercase version of the letter |
|
What method would you use to ensure a character is uppercase? |
Character.toUpperCase(ch) |
|
What does the method Character.toLowerCase(ch) do? |
The lowercase version of the letter |
|
What method would you use to ensure a character is lowercase? |
Character.toLowerCase(ch) |
|
What is system.out.printf? |
A method that accepts a specially written String called a format string that specifies the general appearance of the output, followed by any parameters to be included in the output |
|
What does %d refer to? |
An integer format of printf |
|
What does %f refer to? |
A real number format of printf |
|
What does %s refer to? |
A string format of printf |
|
What does %Wd refer to? |
An integer, W characters wide, right-aligned format of printf |
|
What does %-Wd refer to? |
An integer, W characters wide, left-aligned format of printf |
|
What does %Wf refer to? |
A real number, W characters wide, right-aligned format of printf |
|
What does %.Df refer to? |
A real number, rounded to D digits afterdecimal format of printf |
|
What does %W.Df refer to? |
A real number, W chars wide, rounded to Ddigits after decimal format of printf |
|
What does %-W.Df refer to? |
A real number, W chars wide (left align), rounded to D digits after decimal format of printf |
|
What is a precondition? |
A condition that must be true before a method executes in order to guarantee the method can perform its task |
|
What is a condition that must be true before a method executes in order to guarantee the method can perform its task? |
A precondition |
|
What is a postcondition? |
A condition that the method guarantees will be true after it finishes executing, as long as the preconditions were true before the method was called |
|
What is a condition that the method guarantees will be true after it finishes executing, as long as the preconditions were true before the method was called? |
A postcondition |
|
What is the general syntax of a throw statement? |
throw ; |
|
Flow of a while loop |
Is the test true? Yes: Execute the if controlled statement. Go back to test. Repeat until > No: Execute the statement after the while statement |
|
When does a while loop perform it's test? |
At the top of the loop |
|
What are pseudorandom numbers? |
Numbers that, although they are derived from predictable and well-defined algorithms, mimic the properties of numbers chosen at random |
|
How do you construct a random object? |
Random r = new Random(); |
|
What is priming a loop? |
Initializing variables before a loop to prime the pump and guarantee the loop is entered |
|
Flow of a do/while loop |
Execute the controlled statement(s) Is the test true? Yes: Execute the controlled statements(s) No: Execute the statement after the do/while loop |
|
When does a do/while loop perform it's test? |
At the bottom of the loop |
|
What is a sentinel? |
A special value that signals the end of an input |
|
What is a special value that signals the end of an input? |
A sentinel |
|
What are logical operators? |
&& - AND (conjunction) || - OR (disjunction) ! - NOT (negation) |
|
What are &&, ||, and ! examples of? |
Logical operators |
|
What is a short-circuited evaluation? |
The property of the logical operators && and || that prevents the second operand from being evaluated if the overall result is obvious from the first operand |
|
What does robust mean? |
The ability of a program to execute even when presented with illegal data |
|
What is kind of program has the ability to execute even when presented with illegal data? |
A robust program |
|
What is an assertion? |
A declarative sentence that is either true or false |
|
What is a declarative sentence that is either true or false? |
An assertion |
|
What is a provable assertion? |
An assertion that can be proven to be true at a particular point in program execution |
|
What is an assertion that can be proven to be true at a particular point in program execution? |
A provable assertion |
|
What is formal verification? |
A field of computer science that involves reasoning about the formal properties of programs to prove the correctness of the program |
|
What is the field of computer science that involves reasoning about the formal properties of programs to prove the correctness of the progam |
Formal verification |
|
What is a file? |
A collection of information that is stored on a computer and assigned a particular name |
|
What is a collection of information that is stored on a computer and assigned a particular name? |
A file |
|
How to check if you can read a file? |
boolean canRead(): Returns whether file is able to be read |
|
What is a checked exception? |
An exception that must be caught or specifically declared in the header of the method that might generate it |
|
What is an exception that must be caught or specifically declared in the header of the method that might generate it? |
A checked exception |
|
What is a throws clause? |
A declaration that a method will not attempt to handle a particular type of exception |
|
What is a declaration that a method will not attempt to handle a particular type of exception? |
A throws clause |
|
What is token based processing? |
Processing input by token |
|
What is processing input by token? |
Token-based processing |
|
What is an input cursor? |
A pointer to the current position in an input file |
|
What is a pointer to the current position in an input file? |
An input cursor |
|
What is consuming input? |
Moving the input cursor forward past some input |
|
What is moving the input cursor forward past some input? |
Consuming input |
|
What is line-based processing? |
The practice of processing input line by line |
|
What is the practice of processing input line by line? |
Line-based processing |
|
What is boilerplate code? |
Code that tends to be the same from one program to another |
|
What is code that tends to be the same from one program to another? |
Boilerplate code |
|
What is cyclomatic complexity? |
A way of testing complexity and how many tests to do, the number of decision trees + 1 |
|
What is the System.out a variable of? |
The PrintStream object |
|
What are print and println methods calling on? |
The PrintStream class |
|
How do you construct a PrintStream Object? |
PrintStream output = new PrintStream(new File("results.txt"))) |
|
What error does a Printstream throw if the file cannot be created? |
A FileNotFoundException |
|
How would you both output a file and show the text on screen? |
Replace the System.out.print(ln) with output.print(ln) |
|
How do you check that files can be read? |
if.canRead() |
|
What is a class constant? |
A named value that cannot be changed. Can be accessed anywhere. |
|
How do you declare a class constant? |
In the class with final or public static final |
|
What is a named value that cannot be changed, and can be accessed anywhere? |
A class constant |
|
What is a parameter? |
Any of a set of characteristics that distinguish different members of a family of tasks |
|
What is a set of characteristics that distinguish different members of a family of tasks? |
A parameter |
|
What is a formal parameter? |
A variable that appears inside parentheses in the header of a method that is used to generalize a method's behavior |
|
What is a variable that appears inside parentheses in the header of a method that is used to generalize a method's behavior? |
A formal parameter |
|
What is an int? |
Integers or whole numbers |
|
What is an integer or whole number? |
An int |
|
What is a double? |
A floating point number, real numbers |
|
What is a real number? |
A double |
|
What is an actual parameter? |
A specific value or expression that appears inside parentheses in a method call |
|
What is aspecific value or expression that appears inside parentheses in a method call? |
An actual parameter |
|
What is a method signature? |
The name of a method, along with its number and type of parameters |
|
What is the name of a method, along with its number and type of parameters? |
A method signature |
|
What is method overloading? |
The ability to define two or more different methods with the same name but different method signatures |
|
What is theability to define two or more different methods with the same name but different method signatures? |
Method overloading |
|
What is a Math class? |
A predefined Java library of constants and common functions |
|
What is a predefined Java library of constants and common functions? |
The Math class, also applies to other common classes |
|
What is an object? |
A programming entity that contains state (data) and behavior (methods) |
|
What is aprogramming entity that contains state (data) and behavior (methods)? |
An object |
|
What is a char? |
Single characters (!, x, A) |
|
What is a boolean? |
Logical values, true and false |
|
What is an expression? |
A simple value or a set of operations that produces a value |
|
What is asimple value or a set of operations that produces a value? |
An expresssion |
|
What is casting? |
Converting one type into another |
|
What is converting one type into another? |
Casting |
|
What is an algorithm? |
A step by step description of how to accomplish a task |
|
What is astep by step description of how to accomplish a task? |
An algorithm |
|
What is a program? |
A list of instructions carried out by a computer |
|
What is alist of instructions carried out by a computer? |
A program |
|
What is digital based on? |
On numbers that increase in discrete increments such as integers |
|
What are binary numbers? |
A number composed of just 1's and 0's, also known as base-2 |
|
What is anumber composed of just 1's and 0's, also known as base-2? |
Binary numbers |
|
How do you convert digital to binary? |
Look at the number and take the nearest 2^x that doesn't go over (2^7 = 128), go out that far (1000000) subtract difference and go again |
|
What is a compiler? |
A program that translates a computer program in one language into another (usually) machine language |
|
What is a Java Virtual Machine? |
A theoretical computer whose machine language is Java bytecode |
|
What is a variable? |
A memory location with a name and a type that stores a value |
|
What is a declaration? |
A request to set aside a new variable, with a given name and type |
|
What is Java runtime? |
A program that executes compiled Java bytecodes |
|
What are Java Class libraries? |
A collection of preexisting Java code that provides solutions to common programming problems |
|
Flow of a for loop |
Perform initialization once Is test true? Yes: Execute the controlled statements Perform the update Is the test true? No: Execute the statement after for loop |
|
What is scope? |
The part of a program in which a particular declaration is valid |
|
What is the part of a program in which a particular declaration is valid? |
The scope |
|
What is s.IndexOf(String)? |
Index of a particular character/string |
|
How to find theIndex of a particular character/string> |
s.IndexOf(String) |
|
What is s.endsWith(string)? |
Whether or not string ends with some text. Returns true/false |
|
How to findWhether or not string ends with some text and returns true/false |
s.endsWith(string) |
|
What is the standard code intro? |
public class { public static void main (String[] args) { statement...; } } |
|
What is next() |
A scanner method that reads and returns the next token as a string |
|
What is a scanner method that reads and returns the next token as a string? |
next() |
|
What is nextDouble() |
A scanner method that reads and returns the next token as a double |
|
What is a scanner method that reads and returns the next token as a double? |
nextDouble() |
|
What is nextInt() |
A scanner method that reads and returns the next token as an int |
|
What is a scanner method that reads and returns the next token as an int? |
nextInt() |
|
What is nextLine() |
A scanner method that reads and returns the next line as an string |
|
What is a scanner method that reads and returns the next line as an string? |
nextLine() |
|
How do you set up a scanner? |
import java.util.* Scanner console = new Scanner(System.in) |
|
What is s.charAt(x)? |
Finds the character at a specific index |
|
How do you find the character at a specific index? |
s.charAt(x) |
|
What is an assignment statement? |
Assigning a value to a variable |
|
What is assigning a value to a variable? |
An assignment statement |
|
What is s.substring(x,y) |
Characters from the start index to just before the stop index |
|
What is s.length()? |
Number of characters in a string |
|
\t |
Tab character in "" |
|
How to do a tab character in "" |
\t |
|
How to do a new line character in "" |
\n |
|
\n |
A new line character in "" |
|
\" |
A quotation mark in "" |
|
How to do a quotation mark in "" |
\"" |
|
\\ |
Backslash character in "" |
|
How to do a backslash character in "" |
\\ |
|
What is a syntax error? |
An error that occurs when you misuse Java, equivalent of bad grammar. Caught by compiler |
|
What isAn error that occurs when you misuse Java, equivalent of bad grammar? |
A syntax error |
|
What are logic errors? |
An error that occurs when you write code that doesn't perform the intended task |
|
What is anerror that occurs when you write code that doesn't perform the intended task? |
Logic errors |
|
What are runtime errors? |
Logic errors so severe that Java stops program from executing |
|
What are Logic errors so severe that Java stops program from executing? |
Runtime errors |
|
How to delete a file? |
boolean delete(): Deletes the given file |
|
How to see if the file exists on the system? |
boolean exists(): Whether or not this file exists on the system |
|
How to get the full path of a file? |
String getAbsolutePath(): The full path to where this file is located |
|
How to get the name of a file? |
String getName(): The name of this file as a String, without any path attached |
|
How to see if this file is a directory or folder? |
boolean isDirectory(): Whether this file represents a directory/folder on the system |
|
How to see if file is a file (nonfolder)? |
boolean isFile() :Whether this files represents a file (nonfolder)on the system |
|
How to check the number of characterse in a file? |
long length() :The number of characters in this file |
|
How to create a directory, if it does not exist? |
boolean mkdirs(): Creates the directory represented by thisfile, if it does not exist |
|
How to rename a file? |
boolean renameTo(file) |