6005276391 | for loop syntax | all 3 parts at top (initialization; test; update) | 0 | |
6005276392 | for loop steps | 1. Initialization 2. Test 3. Loop Body 4. Update 4. Re-test | 1 | |
6005276393 | type of loop for loop usually is | count controlled | 2 | |
6005276394 | When you declare a variable in a for loop the variable only exists where? | in the for loop and no where else | 3 | |
6005276395 | sum = sum + k; → | sum+=k; | 4 | |
6005276396 | How many returns can you have | multiple | 5 | |
6005276397 | What does 1 return have to be if have multiple | conditionalized | 6 | |
6005276398 | Where return statements usually used | value returning methods (can be in void but not often) | 7 | |
6005276399 | What happens when you return | leave the method | 8 | |
6005276400 | break | gets out of loops (NEVER USE) | 9 | |
6005276401 | What kind of structure is an array | data structure | 10 | |
6005276402 | What do arrays do | combine bunch of different values into a variable | 11 | |
6005276403 | what kind of data type an array is | composite data type | 12 | |
6005276404 | Everything in an array has to have the same | data type | 13 | |
6005276405 | element | each item in array | 14 | |
6005276406 | size or length | # of items that can fit | 15 | |
6005276407 | index/subscript | use in order to access values | 16 | |
6005276408 | Default value upon initialization for boolean | false | 17 | |
6005276409 | Default value upon initialization for int | 0 | 18 | |
6005276410 | Default value upon initialization for String | null "" | 19 | |
6005276411 | first position of an array | 0 | 20 | |
6005276412 | last element in an array | #-1 | 21 | |
6005276413 | once set an array it's set for how long | forever | 22 | |
6005276414 | explicit array creation | have to know data type, order, and # of elements | 23 | |
6005276415 | NullPointerException error | accessing items in an array that don't exist | 24 | |
6005276416 | ArrayIndexOutOfBoundsException error | go off end in array by accessing indices that don't exist | 25 | |
6005276417 | Array length vs. string length | don't have () for arrays | 26 | |
6005276418 | length array method or attribute? | attribute | 27 | |
6005276419 | 2D length ROWS | c.length; | 28 | |
6005276420 | 2D length COLS | c[0].length; | 29 | |
6005276421 | 1D array declaration | data type [] name = new data type [#]; | 30 | |
6005276422 | 2D array declaration | data type [] [] name = new data type [#] [#]; | 31 | |
6005276423 | 1D making array | data type name = {#, #, #} | 32 | |
6005276424 | 2D making array | data type name = { {#, #, #}, {#, #, #} }; | 33 | |
6005276425 | for each loop | use for traversing arrays (looking at EVERY element) in order (first → last) | 34 | |
6005276426 | when don't use for each loop | if want to look at index | 35 | |
6005276427 | if primitive data type, why can't you change in a for each loop | because just getting copy of thing you're pulling out | 36 | |
6005276428 | what do you get when you pass for primitive in for each loop | get a copy | 37 | |
6005276429 | what do you get when you pass for reference in for each loop | get memory address (where it is_ | 38 | |
6005276430 | primitive data type | char, int, double, boolean | 39 | |
6005276431 | reference data type | String | 40 | |
6005276432 | when can you change a variable in a for each loop | if give the same memory address | 41 | |
6005276433 | add element from an array | shift a few elements toward end of the array (starting from last element) to create an empty slot in the position you want | 42 | |
6005276434 | remove element from an array | shift all elements that follow it by one toward the beginning of the array | 43 | |
6005276435 | if removing element from an array there is no way to remove the last value that you don't want. What do you do? | know how many elements are relevant and only focus on those | 44 |
AP Computer Science A Chapter 7-9 Flashcards
Primary tabs
Need Help?
We hope your visit has been a productive one. If you're having any problems, or would like to give some feedback, we'd love to hear from you.
For general help, questions, and suggestions, try our dedicated support forums.
If you need to contact the Course-Notes.Org web experience team, please use our contact form.
Need Notes?
While we strive to provide the most comprehensive notes for as many high school textbooks as possible, there are certainly going to be some that we miss. Drop us a note and let us know which textbooks you need. Be sure to include which edition of the textbook you are using! If we see enough demand, we'll do whatever we can to get those notes up on the site for you!