
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
JZ wants to create an array list of containing characters. He wants to add 5 elements to the list.
Complete the code below to satisfy the specifications above.
ArrayList <Answer> Answer = new ArrayList();
myArrayList.add('a');
myArrayList.add('g');
myArrayList.add('y');
myArrayList.add('m');
myArrayList.add('c');
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a declaration for a one dimensional array, called List holding letters of the alphabet.arrow_forwardQuestion: Consider the following code segment. int[][] array2D = {{1, 2, 3, 5}, {5, 2, 7, 9), (10, 3, 4, 1}, {8, 3, 5, 6}}; for (int row = 0; row< array2D.length; row++) { for (int col = 0; col < array2D [0].length; col++) { if (array2D [row][col] == num) { System.out.print (row + array2D [row][col] + " "); } 7 What is printed when num has the value 5? A) 4 1 3 B) 5 6 8 C) 6 7 9 D) 857 E) 9 6 8 Response:arrow_forwardCompare and contrast the array and arrayList. Give at least one example that describe when to use arrayList compared to an array.arrow_forward
- Draw a square with a Pentagram hole! The 3×3 square extends from −0.7 to 2.3 on the X axis and from −0.3 to 2.7 on the Y axis. Keep the X and Y arrays named xp and yp, respectively. The template code it's below. I need help with the ellipsis. import matplotlib.pyplot as plt xp = [0, 0.81, 1.62, 1.31, 2.12, 1.12, 0.81, 0.5, -0.5, 0.31, 0] + [None] +[..., ..., ..., ..., ...] yp = [0, 0.59, 0, 0.95, 1.54, 1.54, 2.49, 1.54, 1.54, 0.95, 0] + [None] + [..., ..., ..., ..., ...] plt.axis("equal") plt.axis("off") plt.fill(xp, yp) plt.show() Expected result:arrow_forwardYou will notice that a class named PeriodicTable has been provided to you. Inside the class is a static, two-dimensional arrayof strings named ELEMENTS that contains information about every element in theperiodic table, so: ELEMENTS[0] is { "1", "Hydrogen", "H", "1.007" }; ELEMENTS[1] is { "2", "Helium", "He", "4.002" } and so on ... Add a static method to this class that uses the array to build a datastructure of elements such that it is fast and easy to find an element usingonly its symbol. Your method should match the following signature, but replaceDataStructure with your chosen data structure. public static DataStructure makeFastPeriodicTable() {} Hint: you can use the Integer.parseInt("2") and Double.parseDouble("1.23")methods to create numeric values from strings. _____________________________________________________ public class PeriodicTable {public static final String[][] ELEMENTS = {{ "1", "Hydrogen", "H", "1.007" },{ "2", "Helium", "He", "4.002" },{ "3", "Lithium",…arrow_forward4. What is the running time of the following code? Points] public static List makeList ( int N) ArrayList 1st = new ArrayList (); for ( inti =0; i < N; i++) { 1st.add (i); lst.trimToSize (); } }arrow_forward
- Determine if the following statement are true or false screen shot shows the text's SortedArrayCollection and ArrayCollection When comparing two objects using the == operator, what is actually compared is the references to the objects. When comparing two objects using the equals method inherited from the Object class, what is actually compared is the references to the objects. The text's sorted array-based collection implementation stores elements in the lowest possible indices of the array. The text's array-based collection implementation stores elements in the lowest possible indices of the array.arrow_forwardCode to ::::implement a SnapshotArray that supports the following interface: SnapshotArray(int length) initializes an array-like data structure with the given length. Initially, each element equals 0. void set(index, val) sets the element at the given index to be equal to val. int snap() takes a snapshot of the array and returns the snap_id: the total number of times we called snap() minus 1. int get(index, snap_id) returns the value at the given index, at the time we took the snapshot with the given snap_id Example 1: Input: ["SnapshotArray","set","snap","set","get"] [[3],[0,5],[],[0,6],[0,0]] Output: [null,null,0,null,5] Explanation: SnapshotArray snapshotArr = new SnapshotArray(3); // set the length to be 3 snapshotArr.set(0,5); // Set array[0] = 5 snapshotArr.snap(); // Take a snapshot, return snap_id = 0 snapshotArr.set(0,6); snapshotArr.get(0,0); // Get the value of array[0] with snap_id = 0, return 5...arrow_forwardQuestion 1 Which of the following is NOT true about ArrayLists? ArrayLists can only hold Objects, not primitive types. ArrayLists have built in methods that you can call on them for quick add, delete, search, etc. ArrayLists can hold more elements than an Array. ArrayLists have a flexible size which you do not have to define at declaration.arrow_forward
- Given an ArrayList called myAL that contains the following: ["blue", "red", "yellow"] write code to insert the elements "purple" and "orange" that keeps the list in alphabetical order.arrow_forwardDetermine if the following statements is true or false. Screen shot shows the text's arraycollection and sortedarraycollection With the text's array-based collection implementation, the set of stored elements is scattered about the array. The text's sorted array-based collection implementation stores elements in the lowest possible indices of the array. When comparing two objects using the equals method inherited from the Object class, what is actually compared is the contents of the objects.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education