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
MA_775_DIABLO [31]
3 years ago
10

Write the definition of a function named alternator that receives no parameters and returns true the first time it is invoked, r

eturns false the next time it is invoked, then true, false and so on, alternating between true/false on successive invocations.
Computers and Technology
1 answer:
Nataly [62]3 years ago
3 0

Answer:

The solution code is written in C++

  1. bool STATUS = true;
  2. bool alternator ()
  3. {
  4.    if(STATUS){
  5.        STATUS = false;
  6.        return true;
  7.    }else{
  8.        STATUS = true;
  9.        return false;
  10.    }
  11. }

Explanation:

We need a global variable to track the status of true or false (Line 1).

Next, create the function alternator (Line 2) and then check if current status is true, set the status to false but return the previous status boolean value (Line 5-6). At the first time of function invocation, it will return true.

The else block will set the STATUS to true and return the false (Line 7-9).

You might be interested in
When creating a multi-dimensional array dynamically in C/C++ the Memory Manager will go to great pains to make sure the array is
yuradex [85]

Answer:

Here the statement is false.  

Explanation:

In C/C++, we can define multidimensional arrays in simple words as an array of arrays. Data in multidimensional arrays are stored in tabular form (in row-major order).  

General form of declaring N-dimensional arrays:  

data_type  array_name[size1][size2]....[sizeN];  

data_type: Type of data to be stored in the array.  

          Here data_type is valid C/C++ data type

array_name: Name of the array

size1, size2,... ,sizeN: Sizes of the dimensions.

Foe example:

Two dimensional array:

int two_d[10][20];  

Three dimensional array:

int three_d[10][20][30];

8 0
3 years ago
computer has a 32-bit instruction word broken into fields as follows: opcode, six bits; two register file address fields, five b
lina2011 [118]

Answer:

a.  2^6, or 64 opcodes.

b.  2^5, or 32 registers.

c. 2^16, or 0 to 65536.

d.  -32768 to 32768.

Explanation:

a. Following that the opcode is 6 bits, it is generally known that the maximum number of opcodes should be 2^6, or 64 opcodes.

b. Now, since the size of the register field is 5 bits, we know that 2^5 registers can be accessed, or 32 registers.

c. Unsigned immediate operand applies to the plus/minus sign of the number. Since unsigned numbers are always positive, the range is from 0 to 2^16, or 0 to 65536.

d. Considering that the signed operands can be negative, they need a 16'th bit for the sign and 15 bits for the number. This means there are 2 * (2^15) numbers, or 2^16. However, the numbers range from -32768 to 32768.

6 0
3 years ago
Instructions:Select the correct answer.
balandron [24]
The answer is installing antivirus software
3 0
2 years ago
How to do 2. Pleaser
V125BC [204]

Answer:

GOD HAS FORSAKEN YOU NOW PRAISE DHAR MANN

6 0
3 years ago
Virtualization, like cloud computing, is a technology that can be useful for _____ sites. hot warm business cold
natima [27]

Answer: Hot sites

Explanation:

 Virtualization in the cloud computing is the technology that are useful for the hot sites. It basically making the virtual image of the network devices so that it can be easily use multiple machine at the similar time.

There are various types of benefits of the virtualization in the cloud computing are as follow:

  • It protect the system from the system failure.
  • It is the cost effective technology.
  • By using this we can easily transfer the data from the physical storage to the virtual server.
8 0
3 years ago
Other questions:
  • I plugged my phone up into a charger, the charger sparked and i unplugged my phone and now it wont charge at all, does anyone kn
    13·1 answer
  • Which of the following describes a BYOD?
    15·1 answer
  • Computer Architecture
    7·1 answer
  • How can an administrator make only the files and folders to which a user has at least Read permissions visible?
    13·1 answer
  • The following types of websites are
    10·1 answer
  • Sometimes a database can contain "bad data," meaning incomplete, incorrect, inaccurate, or irrelevant records, which can be corr
    7·1 answer
  • Does any of yall play rob lox?
    5·2 answers
  • In Super Mario Bros., you become Mario and your friend is Mario’s younger brother Luigi. Your job is to race through Mushroom Ki
    10·1 answer
  • Please do this now
    9·1 answer
  • What is bigger that terbites
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!