Question
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
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 whats 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 cant 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?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started