Chapter 5
1. (a) The argument of the function SQR(9) is the constant 9.
(b) The value of the function is 3.
2. The value of ABS(-12) is 12.
3. (a) The value of ROUND(7.32) is 7.
(b) The value of TRUNCATE(7.32, 0) is 7.
(c) The value of ROUND(12.85, 1) is 12.9.
(d) The value of TRUNCATE(12.85, 1) is 12.8.
4. You may get unexpected results if you use the ROUND
function to round a number greater than 9999.
5. When you try to take the square root of a negative
number, such as SQR(-9), you get the error message "SQR of negative
number".
6. The function MOD(Num, 2) has a value of 0 if Num is even
and a value of 1 if Num is odd.
7. The value of MAX(100, 101) is 101.
8. The default unit for measuring angles is the radian.
9. The statement OPTION ANGLE RADIANS specifies that
angles will be measured in radians, while the statement OPTION
ANGLE DEGREES specifies degrees.
10. The statement RANDOMIZE starts a new sequence of
random numbers each time it is executed.
11. The valueof LEN("Good try") is 8, the number of
characters in the string.
12. The position of the first comma in the string Line$ is given
by X when the statement LET X = pos(Line$, ",") is executed.
13. The position of the second comma in the string Line$ is given
by Y when the statement LET Y = pos(Line$, ",", X + 1) is executed.
14. The team name in string Line$ is given by the substring
Line$[Y + 1 : Maxnum] or by the substring Line$[Y + 1 : len(Line$)].
15. Use the expression "ucase$(Reply$[1:1])" to extract the
uppercase first letter in Reply$.
16. Use the expression "ucase$(Name1$) = ucase$(Name2$)" to
compare the two string variables without considering the case of
characters.
17. Use the expression "trim$(Name1$) = trim$(Name2$)" to compare
the two string variables without considering leading and trailing
blank spaces.
18. The value of CHR$(65) is the string "A".
19. A bit is the smallest unit of computer memory, having a
value of 0 or 1. A byte is eight bits.
20. You convert a string of digits to a numeric variable with
the statement LET Num = val(Num$).
21. A program that expects a user to enter numbers may be designed to assign
the entered digits to a string variable rather than
to a numeric variable. If a non-numeric character is entered by
mistake, it can either be ignored or the user told to enter the
number again. After entry is finished, the string variable is
converted to a numeric variable.
22. The TAB function can only be used in a PRINT statement.
23. The function KEY INPUT is a logical function and can only
have values of true or false.
24. A value of 65 is assigned to the variable KeyValue when
an uppercase A character is entered from the keyboard.
25. The first thing you should do before starting to write program
code is write out an outline of the program you propose to develop.