subject

1. The following pseudocode tests how quickly a user can type a given sentence without making any mistakes. The statement time. clockTick() returns the number of seconds elapsed since the program started followed by the number of characters in the sentence typed.

1 sentence ← "The quick brown fox jumped over the lazy dog"

2 n ← LEN(sentence)

3 OUTPUT "Sentence to type: " + sentence

4

5 mistakeMade ← False

6

7 OUTPUT "Press Enter when you're ready to start typing! Press Enter when finished"

8 ready ← USERINPUT

9 OUTPUT "Go!"

10

11 startTime ← time. clockTick()

12 mySentence ← USERINPUT

13 finishTime ← time. clockTick()

14 totalTime ← finishTime - startTime

15

16 IF mySentence ≠ sentence THEN

17 mistakeMade ← True

18 ENDIF

19 IF mistakeMade THEN

20 OUTPUT "You made one or more errors"

21 ELSE

22 OUTPUT totalTime

23 OUTPUT n

24 ENDIF

(a) What type of variable is each of the following? [4]

(i) mistakeMade

(ii) n

(iii) totalTime

(iv) sentence

(b) What does line 16 do? [2]

(c) Alter the program so that instead of storing the sentence “The quick brown fox jumped over the lazy dog”, the user can enter the sentence on which they will be timed. [3]

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:30, ansonhunter8891
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, arturocarmena10
The initial tableau of a linear programming problem is given. use the simplex method to solve it. x 1 x 2 x 3 s 1 s 2 z 1 2 4 1 0 0 8 3 4 1 0 1 0 10 minus3 minus12 1 0 0 1 0 the maximum is nothing when x 1equals nothing, x 2equals nothing, x 3equals nothing, s 1equals3, and s 2equals0. (be sure to simplify to lowest terms if necessary.)
Answers: 2
image
Computers and Technology, 24.06.2019 09:30, kyreesegordon
Retype the statements, correcting the syntax errors. system. out. println("num: " + songnum); system. out. println(int songnum); system. out. println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
image
Computers and Technology, 24.06.2019 11:00, dirttrackr75
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
You know the right answer?
1. The following pseudocode tests how quickly a user can type a given sentence without making any mi...

Questions in other subjects:

Konu
Mathematics, 06.10.2019 09:10
Konu
Mathematics, 06.10.2019 09:20