Quiz 10

AMES 5

Quantitative Computer Skills

Quiz 10, Mar. 9, 1999

(Closed book and notes, Choose one best answer, Use green scantron form)

1. True BASIC is one of the first commercial versions of the Full BASIC programming language conforming to ANS BASIC standards. BASIC is one of the most widely used programming languages. It was first developed at Dartmouth College in 1964 by John G. Kemeny and Thomas E. Kurtz who created True BASIC in:

(a) 1966 (b) 1996 (c) 1974 (d) 1983 (e) 1998.

2. What statement is required in every True Basic program?

(a) Print (b) End (c) Run (d) Rem (e) Input

3. When using Command S or Save under the File pull down menu, the file will be saved to:

(a) the Catlin disk (b) the hard drive (c) the workspace (d) your school account (e) wherever the file was opened from or saved to, whichever is more recent.

4. The keyword Let is required in an assignment statement:

(a) only when assigning a value to a numeric variable (b) only when assigning a value to a string variable (c) but is not required when used with an Option Nolet statement (d) but is not required when used with a Rem statement (e) at all times, regardless if used with a numeric or string variable or with any other statement.

5. The Data statement:

(a) can be placed anywhere in the program (b) must come before the Read statement (c) must come after the Read statement (d) must be paired with the Next statement (e) isn't a True Basic statement.

6. How many times will the For loop execute in the program FOR count = 1 to 5 step -1 (new line) PRINT Count (new line) NEXT Count (new line) END ?

(a) 6 (b) 5 (c) 4 (d) 1 (e) 0

7. How do you stop a program that is executing an infinite loop?

(a) By quitting the application True Basic by using the Command and Q keys (b) By using the Command and period keys or Stop option under the Run menu (c) An infinite loop can't be stopped (d) By typing in End in the output window while the program is running (e) By double clicking the mouse

8. What statement must be included in a program to prevent the Rnd function from always producing the same sequence of random numbers?

(a) Next Rnd (b) Randomize (c) Round (d) Option Nolet (e) Select Case

9. If the value of Ord("A") is 65, what is the value of Chr$(65)?

(a) 65 (b) Null because Chr$ is not a True Basic Function

(c) 0 because 65 is not an ASCII value (d) Z (e) A

10. What is the value of Len("Good try")? (a) 9 (b) 10 (c) 7 (d) 8 (e) 0

11. The Command and C key combination, while in True Basic, will: (a) cut the highlighted text (b) copy the highlighted text to temporary storage (c) capitalize all program statements and indent loop and branching bodies (d) clear the entire screen (e) compile the program

12. The value returned by posr("ABCDEABCDEABCDE","B",3) is: (a) 12 (b) 4 (d) 7 (e) 2

13. The output of the program DATA 1,2,3,4,5,6 (new line) FOR i=1 to 3 (new line) READ x (new line) LET sum = sum+x (new line) NEXT i (new line) LET sum1=sum (new line) LET sum=0 (new line) FOR i=1 to 3 (new line) READ x (new line) LET sum = sum+x (new line) NEXT i (new line) LET sum2=sum (new line) PRINT sum2;sum1 (new line) END is

(a) an error message (b) 15 6 (c) 6 15 (d) 0 15 (e) 6 0

14. Noninteger numeric values in an equality statement are usable to control a decision branch or loop. (a) true (b) false (c) maybe (d) whatever (e) 8

15. No value is associated with a subroutine name: (a) true (b) false (c) maybe (d) whatever (e) 8

16. Function parameters are one way or value parameters:

(a) true (b) false (c) maybe (d) whatever (e) 8

17. If an array is dimensionalized with the statement DIM Name$(20), a value is assigned to element Name$(0): (a) true (b) false (c) maybe (d) whatever (e) 8

18. If an array is dimensionalized with the statement DIM Name$(20), a value is assigned to element Name$(20): (a) true (b) false (c) maybe (d) whatever (e) 8

19. What is the the value of logical function More#1 if the logical function End#1 has a value of true?: (a) true (b) false (c) maybe (d) whatever (e) 8

20. Strings may be compared in logical expressions as well as numbers: (a) true (b) false (c) maybe (d) whatever (e) 8

21. Which of the following is NOT a file type? (a) record (b) matrix (c) stream (d) byte (e) random

22. When a text file containing text is opened for viewing, you can write only

(a) at the beginning (b) wherever you please, unconditionally (c) wherever you please, provided you specify the location (d) at the end (e) in the margin

23. The result of the statement: PRINT using "##^^^": 87654321 is

(a) 8.7E+7 (b) 87E+6 (c) 88e+6 (d) 8.8e+7 (e) 8

24. The following is not a palindrome

(a) hannah (b) bob (c) ma'am (d) madam I'm Adam (e) they are all palindromes

25. The value of 5! is (a) 5, and I mean it!! (b) 25 (c) 125 (d) 120 (e) 8

26. The value of 0! is: (a) 0, and I mean it!! (b) 1 (c) -1 (d) i (square root of -1) (e) 8

27. One of the disadvantages of the binary search as compared to the sequential search is that

(a) the binary search only works with a sorted list (b) the binary search only works with pairs (c) the binary search works only with sequential text files (d) the binary search only works with processed byte files (e) 8

For questions 28-30 refer to the matrix 1 2 3

4 5 6

7 8 9

28. The element (3,2) of the matrix has a value of (a) 6 (b) 8 (c) 5 (d) there is no value associated with that element pair.

29. The trace of the matrix is equal to (a) 6 (b) 12 (c) 15 (d) 45.

30. The matrix is considered an identity matrix. (a) true (b) false.

31. The volume of the box as printed out by the program is (a) 1 (b) 2 (c) 3 (d) 6

32. The second Print statement would have the output (a) 123123 (b) 123000 (c) 000123 (d) it wouldn't output anything - there would be a run-time error.

33. The 2 was given in the function call. This is an example of (a) pass by value (b) pass by reference (c) pass functional default (d) pass the gravy, ma'am

34. The x & z given in the function call are examples of (a) passing by value (b) passing by reference (c) passing by functional default (d) passing the winning touchdown For questions 31-36, consider the program fragment below:

 

! Main Program

DECLARE FUNCTION Volume

LET x=1

LET y=2

LET z=3

PRINT "Volume of the Box is"; Volume(x,2,z)

PRINT x;y;z;a;b;c

END

! Function Procedure

EXTERNAL Function Volume(a,b,c)

LET volume = a*b*c

END FUNCTION

35. The variables a,b&c are examples of (a) carryover variables (b) functional variables (c) local variables (d) global variables.

36. The variables x,y&z are examples of (a) carryover variables (b) functional variables (c) local variables (d) global variables.

37. Which of the following is NOT a command to transform a graphics image? (a) shear (b) rotate (c) shift (d) tilt

38. The screen width/height is known as the (a) aspect ratio (b) cartesian ratio (c) slope (d) screen trace.

39. The smallest screen element is known a (a) quantum dot (b) quantum singularity (c) pixel (d) quark.

40. How many bits comprise a byte? (a) 2 (b) 4 (c) 16 (d) 8

41. An algorithm is best described as a (a) background beat (b) flowchart (c) detailed code (d) sorting technique.

42. If N=7, is MAT(N) an acceptable initializing statement for a seven element array? (a) yes (b) no

43. The command INPUT name$ produces a question mark and expects you to type in a value for name$. What is name$?

(a) a numeric variable (b) a string variable (c) a numeric constant (d) a string constant (e) 8.

44. In the single line IF-THEN-ELSE structure LET a$ = 4 (new line) IF a=4 then PRINT "helium" else PRINT "hydrogen" (new line) END the output will be: (a) hydrogen (b) helium (c) ending doesn't match beginning (d) wrong type (e) a different error message

45. The output of the program at the right is

(a) hydrogen (b) helium (c) ending doesn't match beginning (d) neither hydrogen nor helium (e) a different error message LET a = 5

SELECT CASE a

CASE 1 to 2

PRINT "hydrogen"

CASE 3 to 4

PRINT "helium"

CASE else

PRINT "neither hydrogen nor helium"

END SELECT

END

46. The value of LET X = 2*5 + (9/3)^3 - 1 is: (a) 1.e1 (b) 12 (c) 25 (d) 19 (e) 36.

47. The program OPEN #1: name "test.file", create newold (new line) ERASE #1 (new line) PRINT #1: "the first line of test.file" (new line) END produces:

(a) a file with one line (b) a blank file (c) #1 on the screen (d) an error message (e) disaster.

48. The result of the program LET x = 100 (new line) PRINT using "###.#": log(x),log2(x),log10(x) (new line) END is

(a) 0 (b) an error message (c) 6.6 2.0 4.6 (d) 2.0 6.6 4.6 (e) 4.6 6.6 2.0

49. The result of the program LET string$ = "abcdeabcdeabcde" (new line) PRINT posr(string$,"e",7) (new line) END is: (a) an error message (b) 0 (c) 10 (d) 1 (e) 5

50. The result of the program PRINT ord("A"); (new line) PRINT chr$(66); (new line) PRINT chr$(90); (new line) PRINT ord("a") (new line) END is 65 BZ 97. What is the result of the program PRINT ord("b"); (new line) PRINT chr$(67); (new line) PRINT chr$(89); (new line) PRINT ord("B") (new line) END ?

(a) 65 BZ 97 (b) 98 CY 66 (c) 99 DW 68 (d) 1 (e) 97 DW 67

51. The output of the program LET a$="tinkywinky" (new line) PRINT len(a$); (new line) PRINT a$[posr(a$,"t",10):cpos(a$,"y",6)] (new line) END is

(a) an error message (b) 10 tinky (c) 10 winky (d) 10 tinkywinky (e) 9 tinky

52. The output of the program OPEN #1:screen .2,.8,0.08,.92 (new line) SET WINDOW -1,1,-1,1 (new line) PLOT LINES:-.2,-.2;.2,-.2;.2,.2;-.2,.2;-.2,-.2 (new line) END is

(a) an error message (b) a centered rectangle (c) a loop (d) a blank screen (e) a centered square

53. The output of the program DIM list$(1) (new line) MAT READ list$(3) (new line) DATA b,a,c (new line) CALL sort(list$) (new line) MAT PRINT list$; (new line) END (new line) SUB sort(a$()) (new line) DO (new line) LET sorted$="true" (new line) FOR i = 1 to 2 (new line) IF a$(i)<a$(i+1) then (new line) LET c$=a$(i) (new line) LET a$(i)=a$(i+1) (new line) LET a$(i+1)=c$ (new line) LET sorted$="false" (new line) END IF (new line) NEXT i (new line) LOOP until sorted$="true" (new line) END SUB is

(a) an error message (b) abc (c) cba (d) cab (e) bac