click below
click below
Normal Size Small Size show me how
CSC-211 Final Test
Vocab
Question | Answer |
---|---|
Definite Loop | You know exactly how many times you want to perform a particular task. |
Indefinite Loop | You do not know in advance how many times you want to perform a particular task. |
Fencepost Loop | We print "n" numbers, but only need n-1 commas. Add a statement outside the loop to place the initial post. |
While Loop | Repeatedly executes it's body as long as the logical test is true. |
Until Valid Data Loops | Repeatedly prompts the user for input until valid data is entered. |
Sentinel Loops | repeats until a sentinel value is seen. (enter -1 to quit) --> -1=sentinel value |
Priming Reed | Setting a variable to a value before a while loop/sentinel loop. |
Pseudorandom Numbers | Numbers that mimic the properties of numbers chosen at random, though they are actually derived from a mathematical expression. |
Random class | Random name = new Random(); |
Do/While Loops | Performs its test at the end of each repetition; do {statement;} while (test); |
Creating File Objects | To allow access to a file; File name = new File("filename"); |
To Read Files via Scanner | File name1 = new File("filename"); Scanner name2 = new Scanner(name1); OR Scanner name2 = new Scanner(new File("filename")); |
Exception | An object representing a runtime error. FileNotFound= file doesn't exist in the program. InputMismatch= read wrong type of token. NoSuchElement= read past the end of file input. |
Reading Files | scannername.next(); |
PrintStream | An object in the java.io package that lets you print output to a destination (file). PrintStream = new PrintStream(newFile("filename")); DO NOT use the same file for output and reading. |