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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
If the polar bear were taken out of the food chain what would happen to the seal population the seal population would diminish the seal population would grow dramatically the seal population would stay the same the seal population would decrease slightly
Answers: 1
question
Computers and Technology, 22.06.2019 15:10
Consider a direct-mapped cache with 216 words in main memory. the cache has 16 blocks of 8 words each. it is a word-addressable computer (rather than a byte-addressable computer which we normally discuss). (a) how many blocks of main memory are there? (b) what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, cache block, and block offset fields (if they apply)? (c) to which cache block will the memory reference db6316 map?
Answers: 1
question
Computers and Technology, 22.06.2019 19:10
10. when you create a pivottable, you need to specify where to find the data for the pivottable. is it true
Answers: 2
question
Computers and Technology, 24.06.2019 21:40
Clunker motors inc. is recalling all vehicles in its extravagant line from model years 1999β€”2002 as well as all vehicles in its guzzler line from model years 2004β€”2007. a boolean variable named recalled has been declared. given a variable modelyear and a string modelname, write a statement that assigns true to recalled if the values of modelyear and modelname match the recall details and assigns false otherwise.
Answers: 2
You know the right answer?
1. The following pseudocode tests how quickly a user can type a given sentence without making any mi...
Questions
question
Geography, 01.07.2020 15:01
question
Mathematics, 01.07.2020 15:01
question
Mathematics, 01.07.2020 15:01
question
Mathematics, 01.07.2020 15:01
Questions on the website: 13722367