Answer:
I have made the required file and it is attached. Hope that helps :)
Answer:
I am writing a Python function:
def is_maxheap(list):
#finds the length of the list
size=len(list)
#loop has a variable i which starts traversing from root til end of last #internal node
for i in range(int((size - 2) / 2) + 1):
if list[2 * i + 1] > list[i]: #If left child is greater than its parent then return #false
return False
if (2 * i + 2 < size and
list[2 * i + 2] > list[i]): #checks if right child is greater, if yes then #returns false
return False
return True
Explanation:
The function is_maxheap() traverses through all the internal nodes of the list iteratively. While traversing it checks if the node is greater than its children or not. To check the working of this function you can write a main() function to check the working on a given list. The main() function has a list of integers. It then calls is_maxheap() method by passing that list to the function. The program displays a message: "valid max heap" if the list represents valid max-heap otherwise it returns invalid max heap.
def main():
list = [10,7,8]
size = len(list)
if is_maxheap(list):
print("Valid Max Heap")
else:
print("Invalid Max Heap")
main()
The program along with its output is attached in a screenshot.
Answer:
Following are the code in java language
abstract interface PointingDevice // interface PointingDevice,
{
// abstract method getXCoord()
public abstract int getXCoord();
// abstract method getYCoord()
public abstract int getYCoord();
// abstract method attentionRequired()
public abstract boolean attentionRequired();
// abstract method setResolution( )
public abstract double setResolution(double a);
}
Explanation:
In this code we have declared a abstract interface "PointingDevice" which contains the four abstract method getXCoord of type int , getYCoord() of type int , attentionRequired() of type boolean and setResolution() of type double .
These method have only declaration not definition any interface or class which inherit the inteface PointingDevice must define all these four method otherwise it also be abstract .
D is the answer to that problem
These are the correct answers to the following questions:
<span>
1. Which stride number should you use to reverse the order of characters in a slice?
A. -1
2. What is forking?
c. Taking code from a currently developed project to make a different version
3. What is a bug?
B. An error in a program's code
4. The turtle program is a/an _________ included with Python that can be imported for use in Python code.
c. Module
5. What is a graphical user interface (GUI)?
b. The windows, buttons, menu items, icons, and dialog boxes with which a computer user interacts
6. Which of the following is an advantage of using variables?
D. It makes it less likely that an error will be introduced into the code.
7. What would you expect as the result of the code "happy" + "birthday"?
D. "happybirthday"
8. When you make copies of a class, those copies are called _________ of the class.
D. Instances
9. What are methods?
A. The functions associated with a class
10. What are comments meant to do?
C. Explain what some code is doing
11. Which of the following types of software hides its code and doesn't let other people change it?
D. Proprietary software
12. If you want to save a program so you can run it later, you should create the program in which window?
b. The text editor window
13. A _____________ is a clickable graphical object that makes something happen when the user clicks it, usually with the left mouse button.
A. Button
14. A/an ____________ development method is one in which the development does not follow a predictable or planned course of action.
A. Informal
15. What are shortcuts useful for?
A. Making it easier and quicker to open a file
</span>