Question

SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what...

SHORT ANSWER QUESTIONS
Part 1

Classes

Abstraction: What is Abstraction in terms of representation? Specifically what choices does one make when creating a class that is an example of Abstraction?

Encapsulation: What is encapsulation? What is information hiding? What does a public interface to a class consist of (not in the sense of actual java interfaces but what the client uses to manipulate objects of the class)

What is an object of a class? What is the constructor? How do we call the constructor in Java?

How do you correctly override equals? What is the first thing you should check about the object that is passed in? What do you do after this check?

What does toString return? What is the point of toString? What are all the ways one can call toString on an object?

Primitive vs. Object Types
If I have int x; and Integer y; what is stored inside x and y? Which one can you invoke member functions on? If someone says int z=x or Integer p=y — what’s the difference between these two; Specifically, if I change z what happens to x and if I change p what happens to y? Is p a shallow copy or a deep copy? What keyword gives a reference brand new memory on the heap in Jaa? What is a null reference and what should you never do to a null reference?

When is primitive memory released in Java and when is Object memory released in Java?

Inheritance

If class A inherits from class B what keyword is used to indicate that A is inheriting from B? What actually gets inherited from class B? Can you use the inherited private variables directly or do you have to use the public members (getters and setters) to access the private variables? How do you call a method of the parent class explicitly (what keyword do you use?). How to rewrite a method in the parent class (what is this called?) and how does this relate to the term polymorphism?If Class A is composed of Class B we say class A _______ (i.e. what kind of relationship). If a function takes in a Class B can I pass an object of class A in for it?


Composition

What is composition? If class A is composed of class B what would we expect to find in class A (i.e. in the private variables)? If Class A is composed of Class B we say class A _______ (i.e. what kind of relationship)


Interfaces

What is inside an interface definition? What does a class do to an interface and what keyword is involved? How does a class do this to an interface (what should we find in the class)? Can an interface have a generic parameter? How do you instantiate an interface as an object? What methods can’t you use on an interface type?

Abstract Data Types
What does an ADT define? Does an ADT specify programming language and/or data structures to be used? What 2 data structures could did we learn we could use to implement a list ADT?

Searching and Big O
Explain in English how one does a binary search? If I was to Binary search an array for a particular number what must be true about the array before I start the binary search? What is the Big O of binary search? How does this differ from the Big O of a linear search? If I have a sorted array, in ascending order, and I want to search for the 5th biggest element in it, what is the Big O of this algorithm? If I have a sorted linked list, in ascending order, and I want to find the 5th biggest element in it, what is the big O of this algorithm? If I have a 2 Dimensional Array of size N by N unsorted, what is the Big O of finding a particular value in this 2 dimensional Array? What about a 3 dimensional Array of size N by N by N unsorted?

Recursion
How can we tell if a function is recursive? What must every recursive function have to ensure no infinite recursion? Write the recursive function to do factorial.

Sorting
What is the algorithm for bubble sort? What is the algorithm for Bucket Sort with arrays? What is the algorithm for Selection sort? What is the Big O of bubble and selection sort? What is the algorithm for shell sort and what is the optimization for shell sort and what is the Big O of shell sort with this optimization step? What is the recursive algorithm for merge sort? What are the 2 parts to MergeSort and Where does the recursive step occur? In the merging step, are the two arrays being merged already in sorted order (i.e. if we are merging array A and array B, is array A already sorted and is Array B already sorted?). What is the Big O of merge sort

Generics
Why are Generics important in Java, specifically, what do they allow us to do? What can you pass in for a Generic? What 2 functions have we learned that are guaranteed to be callable on a Generic type? How do we create an array of a Generic type?

List ADT, Array Implementation, and Linked Lists
What functionality is outlined in the List ADT. Implementing a List as a partially filled array in java, what will be your private variables? What two things does a Node have inside of it? What is a private inner class and why is node a private inner class in Linked List? What are the restrictions of creating an object of a private inner class (can a node object be created in main? If not where can it be created?). What is the beginning of the linked list called? What is the end of the linked list called? How can you tell if a node is the last node in a linked list? How can you find the first node in a linked list? What does an empty list look like? How do you traverse a linked list to (for example) print out all the contents of the linked list? What kind of loop do you use? What special cases must you check for when looping through a linked list?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

What is Abstraction in terms of representation?

Answer: Abstraction is the process of taking away or removing characteristics from something in order to reduce it to a set of essential characteristics. In object-oriented programming, abstraction is one of three central principles (along with encapsulation and inheritance). Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that abstraction sometimes works in art, the object that remains is a representation of the original, with unwanted detail omitted. The resulting object itself can be referred to as an abstraction, meaning a named entity made up of selected attributes and behavior specific to a particular usage of the originating entity. Abstraction is related to both encapsulation and data hiding.

Specifically what choices does one make when creating a class that is an example of Abstraction?

Answer: When implementing an abstract class, one has the option to make a method abstract or not. An abstract method does not have any implementation of its own and has to be implemented by the child classes inheriting the abstract class.

What is encapsulation?

Answer: Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates.Other way to think about encapsulation is, it is a protective shield that prevents the data from being accessed by the code outside this shield.

What is information hiding?

Answer: Information hiding is the primary criteria of system modularization and should be concerned with hiding the critical decisions of OOP designing. Information hiding isolates the end users from the requirement of intimating knowledge of the design for the usage of a module.

What does a public interface to a class consist of?

Answer: A public interface contains all the APIs using which the client directly communicates with the application.

NOTE: As per Chegg policy, I am allowed to answer only 4 questions (including sub-parts) on a single post. I have gone ahead and answered 5. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.

Add a comment
Know the answer?
Add Answer to:
SHORT ANSWER QUESTIONS Part 1 Classes Abstraction: What is Abstraction in terms of representation? Specifically what...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Interfaces 1. What is inside an interface definition? What does a class do to an interface...

    Interfaces 1. What is inside an interface definition? What does a class do to an interface and what keyword is involved? How does a class do this to an interface (what should we find in the class)? Can an interface have a generic parameter? How do you instantiate an interface as an object? What methods can’t you use on an interface type? Abstract Data Types 2. What does an ADT define? Does an ADT specify programming language and/or data structures...

  • Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the ...

    Sorting Threads Assignment Overview Write a multithreaded sorting program in Java which uses the merge sort algorithm. The basic steps of merge sort are: 1) divide a collection of items into two lists of equal size, 2) use merge sort to separately sort each of the two lists, and 3) combine the two sorted lists into one sorted list. Of course, if the collection of items is just asingle item then merge sort doesn’t need to perform the three steps,...

  • can you guys please help me with these questions thank you 9.Given a Double Linked-List that...

    can you guys please help me with these questions thank you 9.Given a Double Linked-List that contains the values in order: 1,2,3,4,5; and the following class declarations: class List private: Node* head; public: PrintBackwards (); class Node{ friend class List; private: int value; Node* next; Node* prev; Write the algorithm PrintBackwards that prints the whole list backwards. So your functionshould output: “ 5,4,3,2,1" Extra Credit if you instead implement the algorithm for a single linked-list (i.e. only using the Node*...

  • Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up...

    Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping. True/False (11) Chapter 12 - Lists The ADT list only works for entries that are strings. The ADT list is more general than common lists and has entries that are objects of the same type. Adding entries to the end of a list does not change the positions of entries already in the list. The first entry is a list is at...

  • Program this in C There is a lot of sorting algorithms. So far, we have covered...

    Program this in C There is a lot of sorting algorithms. So far, we have covered selection and insertion sort. However, we only covered how selection sort is implemented using an array. Every sorting algorithm implemented using an array can also be implemented using a linked list. In this assignment, you will implement the selection sort algorithm using a linked list instead of an array. You will first create an interface for handling string items. Basically, you will need to...

  • Please use C++ CS3358 Insert and delete a node Programming Project 2: The linked list -...

    Please use C++ CS3358 Insert and delete a node Programming Project 2: The linked list - Reference: chapter 18: Create an array of 15 student records that should not be sorted Create a liked list of 15 student record nodes. Each node is a node of one student record from the above unsorted array. The list of student records should be sorted by student ID. (Insert function without sort function to create a linked list.) (If you insert correctly, the...

  • JAVA coding The Sorted List ADT Implement the SortedList class. The SortedList class extends the ...

    JAVA coding The Sorted List ADT Implement the SortedList class. The SortedList class extends the AbstractList class. Both can be seen here. Your assignment is to implement (recursively) all of the abstract methods of the AbstractList class. They are: insert (recursive) iterator remove (recursive) retrieve search (recursive) You must also implement an Iterator inner class for the SortedList class. You must submit a modified SortedList.java file with your source code. Do not submit and do not modify the List.java or...

  • Chapter 4 describes the ADT Sorted List using an array implementation with a maximum of 25...

    Chapter 4 describes the ADT Sorted List using an array implementation with a maximum of 25 items. The pseudocode for the ADT Sorted List Operations are provided on page 210. Use this information to create an ADT for handling a collection of Person objects, where each object will contain a Social Insurance Number (validate this), a first name, a last name, a gender and a data of birth. This implementation should prevent duplicate entries – that is, the Social Insurance...

  • This Individual Assignment is a set of three problems. The first is a recursion "warm up"...

    This Individual Assignment is a set of three problems. The first is a recursion "warm up" exercise, and the second two are QuickSort variations. The "warm up" should be implemented as a static method in your main App class and the second two will use additional classes (as instructed below). All three problems should be included in the same NetBeans project (exported to ZIP as usual). ----------------- All of your classes should be properly encapsulated, follow all proper coding conventions...

  • In Java, Implement a class MyArray as defined below, to store an array of integers (int)....

    In Java, Implement a class MyArray as defined below, to store an array of integers (int). Many of its methods will be implemented using the principle of recursion. Users can create an object by default, in which case, the array should contain enough space to store 10 integer values. Obviously, the user can specify the size of the array s/he requires. Users may choose the third way of creating an object of type MyArray by making a copy of another...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT