1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marysya12 [62]
3 years ago
7

Explain how class (static) variables and methods differ from their instance counterparts. Give an example of a class that contai

ns at least one class variable and at least one class method. Explain why using a class variable and method rather than an instance variable and method would be the correct choice in the example you select.
Computers and Technology
1 answer:
irakobra [83]3 years ago
5 0

Answer:

Static variables and functions differs from their instance counterparts in that you don't need to instantiate an object of a class to access them (variables) or call them (functions). The class itself can be used to access or call static variables and functions.

Explanation:

Example:

Suppose we have a class that represents a word editor. To save progress, we need a file location on the disk.

We can define file location as a static variable, since all instances of the class will use the same file location value.

Also, to access the static variable outside of class definition, we can define a static method to get/set the value of the static variable.

A static save to file function can also be defined in the class (to perform the work to update the file on disk). Again this function would be defined as static, because all instances of the class will need the same method whenever they want to write to file.

You might be interested in
What is the awnser ?
Igoryamba

Its the second one. Hope this helps.   :)

4 0
4 years ago
You have configured your organization's dhcp server to dynamically assign ip addresses to ghcp clients using a lease duration of
Nikitich [7]

When a user's workstation power is turned on and receives addressing information from this DHCP (Dynamic Host Configuration Protocol) server Monday morning at 8 am, the client will contact the DHCP server to renew the lease on Wednesday morning.

7 0
3 years ago
Several steps are involved in creating a presentation. What is the last step in the process before preparing to present it?
kupik [55]
The answer to this is B.
8 0
3 years ago
Read 2 more answers
Which type of topology describes the physical arrangement, installation, and connection of cables, computer, and other devices?
Nutka1998 [239]
<span>The network topology describes the physical arrangement, installation, and connection of cables, computer, and other devices.
The network topology can be bus topology (a</span><span> network topology that uses a single cable or conductor to connect all nodes on the network.) ,</span>star topology (a network topology in which cables running from each node connect to a single point, such as a hub.), ring (a network topology that consists of a single cable that runs continuously from node to node), mesh, hybrid, hub topology,... according the arrangement of the nodes. 

8 0
3 years ago
Read 2 more answers
Modify the guessing-game program so that the user thinks of a number that the computer must guess.
Triss [41]

Answer:

import random

import math

smaller = int(input("Enter the smaller number: "))

larger = int(input("Enter the larger number: "))

count = 0

print()

while True:

   count += 1

   myNumber = (smaller + larger) // 2

   print('%d %d' % (smaller, larger))

   print('Your number is %d' % myNumber)

   choice = input('Enter =, <, or >: ')

   if choice == '=':

       print("Hooray, I've got it in %d tries" % count)

       break

   elif smaller == larger:

       print("I'm out of guesses, and you cheated")

       break

   elif choice == '<':

       larger = myNumber - 1

   else:

       smaller = myNumber + 1

Explanation:

The code to be Modified is as indicated below:

# Modify the code below:

import random

smaller = int(input("Enter the smaller number: "))

larger = int(input("Enter the larger number: "))

myNumber = random.randint(smaller, larger)

count = 0

while True:

   count += 1

   userNumber = int(input("Enter your guess: "))

   if userNumber < myNumber:

       print("Too small")

   elif userNumber > myNumber:

       print("Too large")

   else:

       print("You've got it in", count, "tries!")

       break

Detailed Explanation:

Line 3 and 4 of the codes prompts the user to enter a smaller and larger number. Line 5 we initiate the formula for minimum number of guesses. Line 14 and 17 prints out the output  I'm out of guesses, and you cheated and Hooray, I've got it in X after validating the conditions.

7 0
3 years ago
Other questions:
  • Q3** Write a query to create a new price list for books written by the same author. Allow the user to enter only the first 4 let
    15·1 answer
  • Suppose that a is a one-dimensional array of ints with a length of at least 2. Which of the following code fragments successfull
    8·1 answer
  • Write a c++ application that computes gross salary for Mr.A,given that during the interview session and before started work, it
    5·1 answer
  • According to the SANS Institute, a __________ is typically a document that outlines specific requirements or rules that must be
    13·1 answer
  • Encryption is the key to keeping your personal information secure online.<br><br> True<br><br> False
    11·1 answer
  • Which of the following is true of a procedure? Check all that apply.
    10·2 answers
  • If anyone wants to ft heres the link
    6·1 answer
  • This software application can be used to organize, analyze, and illustrate data?
    12·2 answers
  • BRAINLIEST TO RIGHT ANSWER!! TIMED QUIZ HELP ASAP PLS!!
    5·1 answer
  • True or false: Securing intellectual property digitally is the only security because that's how all IP is stored.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!