![]() ![]() after this, each next number is the sum of the previous 2: 1, 1, 2, 3, 5, 8, and 13. Fibonacci numbers form a pattern starting with 1, 1. primitives: 0, boolean: true, objects: nullĪnswer: initialized or default values of arraysġ1. ![]() primitives: 0, boolean: false, objects: nullĭ. primitives: 1, boolean: false, objects: nullĬ. primitives: 1, boolean: true, objects: nullī. When arrays are declared, what are the elements initialized for automatically (default values)?Ī. Can statements following an array's initialization reassign data to a new array of a specified length?Īnswer: for example, after initialization: data = new double now has a fixed length of 40ġ0. What is a data structure used to implement a list object, where elements in the list are of the same typeĩ. arr will change from 30 to 20+30=50 arr will change from 40 to 50+40=90 arr will change from 50 to 90+50=140Ĩ. Which of the following for loops will give the same output as the code segment?Īnswer: the loop will run 3 times: the 10 & 20 values will remain untouched. Accessing individual elements in the middle of a list is easier for an array than for an ArrayList.Īnswer: definition of array of primitive dataĥ. An array of primitive data is more efficient to manipulate than an ArrayList of wrapper objects that contain numbers.ĭ. Insertion of new elements into a list is easier to code for an array than for an ArrayList.Ĭ. Removal of elements from a list is easier to code for an array than for an ArrayList.ī. Which of the following is the best reason to implement each list with an array, rather than an ArrayList of Integer (or Double) objects?Ī. Consider writing a program that produces statistics for long lists of numerical data. ![]() ![]() The array, though, may go out of bounds.Īnswer: using arrays here will avoid the possible problem of going out of boundsĤ. If any text file is long, ArrayList will automatically be resized. The size method of ArrayList gives instant access to the length of the list.ĭ. The get and set methods of the ArrayList are more convenient than the notation for arrays.Ĭ. The String methods are easier to use with an ArrayList than with an array.ī. If you have a program that reads the lines of a text file into a sequential list of lines, which of the following is a good reason to implement the list with an ArrayList of String objects rather than an array of String objects?Ī. □ Study AP CSA, Unit 6.1: Array Creation and Accessģ. Which of the following can replace / missing code / so that it works as intended? *The following questions were not written by CollegeBoard and although they cover information outlined in the AP Computer Science A Course and Exam Description the formatting on the exam may be different.ġ. That means it should take you around 34 minutes to complete 15 questions. įacts about the test: The AP Computer Science A exam has 40 multiple choice questions and you will be given 90 minutes to complete the section. Click here for the practice questions: AP Computer Science A Unit 6 Multiple Choice Questions. ⛔STOP!⛔ Before you look at the answers make sure you gave this practice quiz a try so you can assess your understanding of the concepts covered in unit 6. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |