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
Python help.
15) The code for the add method for the ArrayBag class is shown below. What is the missing code?
def add(self, item):
self.items[len(self)] = item
a. self.items +=1
b. self.len = self.items
C. self = self + 1
d. self.size += 1
16) What word is best defined as the use of common names for operations on different types of collections?
a. anachronism
b. polymorphism
C. concatenation
d. modularization
20) When a programmer calls the next function on an iterator object, what happens if there is no current item in the sequence?
a. a Stoplteration exception is raised
b. the compiler generates an error
C. the previous item is returned
d. the None item is returned
22) Consider the following program:
class Animal:
def __init__(self, name="Dog"): self._name name
def getName(self):
print(self._name)
class Dog(Animal):
def __init__(self,name):
super().__init__("Cat")
dog Dog("Dog")
dog.getName()
What is displayed when it executes?
a. Dog
b. ldogl
c. Cat
d. Nothing is displayed
e. The program crashes
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps
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
- using C++ 1- Creates a class called Member with two integer x and y.a. Add a constructor able to create a Member object with tow integers and the default values 0,0.b. Add the methods setX and setY to modify the attributes x and y; [2 Markc. Add the method display able to display the attributes. 2- A Stack is a special array where the insertion and deletion will be via a specific index called "head". A Stack is characterized by 3 attributes:a. capacity (int): the maximum number element Member that can be contained into the Stack.b. head: presents the index where we can add/remove element to the Stack. The head value presents also the current number of elements into the Stack. When a Stack is created the initial value of head is 0.c. Member content[]: an array of elements of type Member. Creates the class Stack with the following methods:a. bool empty(): this method returns true if no element exists in the Stack. b. bool full(): this method returns true if there are no place to add a…arrow_forwardhelparrow_forwardJava (LinkedList) - Grocery Shopping Listarrow_forward
- Data Structure & Algorithm: Describe and show by fully java coded example how a hash table works. You should test this with various array sizes and run it several times and record the execution times. At least four array sizes are recommended. 10, 15, 20, 25. It is recommended you write the classes and then demonstrate/test them using another classarrow_forwardSmart Pointer: Write a smart pointer class. A smart pointer is a data type, usually implemented with templates, that simulates a pointer while also providing automatic garbage collection. It automatically counts the number of references to a SmartPointer<?> object and frees the object of type T when the reference count hits zero.arrow_forwardJAVA CODE Learning Objectives: Detailed understanding of the linked list and its implementation. Practice with inorder sorting. Practice with use of Java exceptions. Practice use of generics. You have been provided with java code for SomeList<T> class. This code is for a general linked list implementation where the elements are not ordered. For this assignment you will modify the code provided to create a SortedList<T> class that will maintain elements in a linked list in ascending order and allow the removal of objects from both the front and back. You will be required to add methods for inserting an object in order (InsertInorder) and removing an object from the front or back. You will write a test program, ListTest, that inserts 25 random integers, between 0 and 100, into the linked list resulting in an in-order list. Your code to remove an object must include the exception NoSuchElementException. Demonstrate your code by displaying the ordered linked list and…arrow_forward
- use replit please Thank youarrow_forward1)Write a Java program which stores three values by using singly linked list.- Node class1. stuID, stuName, stuScore, //data fields2. constructor3. update and accessor methods- Singly linked list class which must has following methods:1. head, tail, size// data fields2. constructor3. update and accessor methodsa. getSize() //Returns the number of elements in the list.b. isEmpty( ) //Returns true if the list is empty, and false otherwise.c. getFirstStuID( ), getStuName( ), getFirstStuScore( )d. addFirst(stuID, stuName, stuScore)e. addLast(stuID, stuName, stuScore)f. removeFirst ( ) //Removes and returns the first element of the list.g. displayList( ) //Displays all elements of the list by traversing the linked list.- Test class – initialize a singly linked list instance. Test all methods of singly linked list class. 2. Write a Java program which stores three values by using doubly linked list.- Node class4. stuID, stuName, stuScore, //data fields5. constructor6. update and…arrow_forwardData Structure & Algorithm: Show by fully java coded examples how any two sorting algorithms work. You should test these with various array sizes and run them several times and record the execution times. At least four array sizes are recommended. 15, 20, 25, 30. It is recommended you write the classes and then demonstrate/test them using another class. Discuss the comparative efficiencies of your two chosen sorting algorithms.arrow_forward
- Java - Gift Exchange *** Please include UML Diagram and notes in code Minimum requirements are: At least 1 loop An Array or ArrayList At least 3 Java classes Use methods I am trying to make it so that the program will: Prompt for the number of people included in exchange - If not even it will state that there has to be an even number and ask for the number of people included again (loops). Prompt to enter a participant's first name Prompt for the participant's age Print out the random matching of participants so that everyone gets a gift and everyone gives a gift. Please include UML Diagramarrow_forwardThe below cod is the code that it’s mentioned in the question. Write your cod and show it in a picture, please.arrow_forwardIN C++ Lab #6: Shapes Create a class named Point. private attributes x and y of integer type. Create a class named Shape. private attributes: Point points[6] int howManyPoints; Create a Main Menu: Add a Triangle shape Add a Rectangle shape Add a Pentagon shape Add a Hexagon shape Exit All class functions should be well defined in the scope of this lab. Use operator overloading for the array in Shape class. Once you ask the points of any shape it will display in the terminal the points added.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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