Recall that computer memory is comprised of individual bits of data. A bit (short for binary digit) can store one of only two values, commonly referred to as 0 and 1. However, using two bits, you can represent four different values through the bit patterns 00, 01, 10, and 11. With three bits, you can represent eight different values—via 000, 001, 010, 011, 100, 101, 110, and 111. In general, N bits of memory enable you to represent 2N different values.

Create a Web page named bits.html that contains a text box where the user can enter a number, call it N. At the click of a button, your page should compute and display 2N, the number of values that can be represented using the specified quantity of bits. For example, if the user entered 10 in the text box, the page would display the message:
Create a Web page named bits.html that contains a text box where the user can enter a number, call it N. At the click of a button, your page should compute and display 2N, the number of values that can be represented using the specified quantity of bits. For example, if the user entered 10 in the text box, the page would display the message:

With 10 bits, you can represent 1024 different values.

Once you have created your page, use it to determine the number of values that each of the following can represent:

8 bits (1 byte)

16 bits (2 byte)

32 bits (4 bytes)

64 bits (8 bytes)


```









Bit Values



Bit Values



Enter a number of bits:









-------------

8 bits 256 values
16 bits 65536 values
32 bits 4294967296 values
64 bits 18446744073709552000 values
```

Computer Science & Information Technology

You might also like to view...

What happens when you close the virt-manager console window of a run- ning VM? What happens if you reboot the host system without first shutting down a VM?

What will be an ideal response?

Computer Science & Information Technology

The project charter is a written narrative that is a contract between the chief analyst or project manager, the analysis team, and the users. It clarifies the following questions:

What will be an ideal response?

Computer Science & Information Technology

A(n) ____ loop is a special loop that is used when a definite number of loop iterations is required.

A. while B. for C. else D. do…while

Computer Science & Information Technology

Sara, an application developer, implemented error and exception handling alongside input validation. Which of the following does this help prevent?

A. Buffer overflow B. Pop-up blockers C. Cross-site scripting D. Fuzzing

Computer Science & Information Technology