Quiz Answer Key and Fun Facts
1. The most direct way to store a date is to use an alphanumeric format. You store it as YYYYMMDD in 8 bytes. What is the COBOL definition of this field?
2. Instead of an alphanumeric definition of a date we can use Pic 9(8). Assuming no further modifiers, what would be the advantage over alphanumeric?
3. If we are limited to 5 bytes of storage, is there be a way to store a complete 8 digit date? (yyyymmdd)
4. Let's try an even smaller space. What if we only have 4 bytes available? Choose a format that would allow an 8 digit date. (yyyymmdd)
5. Now let's go to the extreme. You only have 2 bytes available. Can you store an 8 digit date as an 8 digit number? (yyyymmdd)
6. Let's say that the user said it was ok to remove the century from the year. Now there are only 6 digits. (yymmdd) Is there any way to store it in 2 bytes? Look at all possibilities.
7. Now we are just going to refer to binary bits without any consideration of computer storage. How many bits would it take to store a 2 digit year? (yy)
8. How many binary digits does it take to store a month? (mm)
9. Now let's store our last field. How many binary bits to hold a day? (dd)
10. We have three sets of binary bits. Year yyyyyyy; Month mmmm; and Day ddddd. That is a total of 16 bits that will will fit into 2 bytes. How can we create the actual value to move into the 2 bytes using COBOL?
Source: Author
denmarks
This quiz was reviewed by FunTrivia editor
crisw before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.