Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

1. What does this code do?

 It asks to the user to enter First number, value will be stored in the variable firstNumber
 It asks to the user to enter Second number, value will be stored in the variable secondNumber
 Then adds them together and result is stored in the variable total.
 Total of two numbers will be display.

2. What does this code do?

RECEIVE numberOfTeeth FROM (INTERGER) KEYBOARD


IF numberOfTeeth >= 0 AND length <= 32 THEN
SEND “Seems normal” TO DISPLAY
ELSE
SEND “Too many teeth!” TO DISPLAY
END IF

 The code asks for the number of teeth to be inputted, in the variable numberOfTeeth
 If the number of teeth is between 0 and 32, then "Seems normal" is displayed
 If the number entered is higher than 32, then "Too many teeth" is displayed

3. What does this code do?

 The code contains 2 variables called passMark and mark


 This code contains selection (IF …THEN … ELSE)
 This code compares the mark given to a test with the passMark.
 If the mark is equal or over 75 then it is considered a pass.
 Else the mark is less than 75 then it is considered a fail.

4. What does this code do?

 The sensor keeps on receiving the temperature in temp variable while it is 100 degree Celsius.
 When the value in temp variable reaches 100 degree Celsius, the sensor will switch off the kettle.

Page 1 of 5
5. What does this code do?

 This code contains Definite iteration (FOR …. DO)


 It displays the message “congratulations” 25 times (25 to 50 = 25 times)

6. What does this code do?

 The variable correct is assigned the value as ‘LetMeIn’


 3 times are you allowed to enter your password in
 There is a definite iteration or loop (FOR…DO which will repeat 3 times)
 The code will ask user to enter the password, and the value entered by the user will be stored in the variable
password
 There is selection (IF …. THEN … ELSE)

7. What does this code do?

 There is a nested FOR loop in this code (a loop within a loop)


 The variable student is for iterating through students 1 to 20
 The variable mark is for iterating through 5 slip tests(1 to 5) given by each student
 The value of each slip test marks, for each student will be inputted in the variable nextMark
 All 5 slip test’ mark will be added to the variable sum
 It calculates the average mark achieved by each student in a group of twenty for a series of five slip test
 It will show an output as an average mark for each student

8. Which of the following pseudocode is a variable?


a) SEND ‘Have a good day.’ TO DISPLAY
b) WRITE MyFile.doc Answer1, Answer2, ‘xyz 01’
c) READ MyFile.doc Record

Page 2 of 5
d) SET MyString TO ‘Hello world’

9. To show in pseudocode that you have finished using selection, you must always use?
a) END FOR
b) END IF
c) END PROCEDURE
d) END REPEAT

10. To show in pseudocode that you have finished using a count controlled loop, you must always use?
a) END IF
b) END FOR
c) END PROCEDURE
d) END REPEAT

11. Which of the following pseudocode is the same as “print” in Python?


a) WRITE MyFile.doc Answer1, Answer2, ‘xyz 01’
b) READ MyFile.doc Record
c) SET Numbers TO [1, 2, 3, 4, 5]
d) SEND ‘Have a good day.’ TO DISPLAY

12. Which of the following pseudocode is the same as “input” in Python?


a) SEND ‘Have a good day.’ TO DISPLAY
b) WRITE MyFile.doc Answer1, Answer2, ‘xyz 01’
c) RECEIVE Name FROM KEYBOARD
d) READ MyFile.doc Record

13. The pseudocode below is an example of?

a) Selection
b) Iteration
c) Sequence
d) Nothing

14. The pseudocode below is an example of?


SEND “Enter your namel” TO DISPLAY
RECEIVE Name FROM KEYBOARD
a) Iteration
b) Sequence
c) Selection

PYTHON CODE TO PSEUDOCODE AND PSEUDOCODE TO PYTHON CODE


1. total = first+second
ANS) SET total TO first + second

2. print(“hello”)
ANS) SEND “hello” TO DISPLAY

3. age=int(input(“Enter your age: ”))


ANS) RECEIVE age from (INTERGER) KEYBOARD

Page 3 of 5
4. if age>=18:
ANS) IF age>=18 THEN

5. if password_attempt1==password_attempt2:
ANS) IF password_attempt1= password_attempt2 THEN

6. IF healthPercentage <= 0 THEN


ANS) if healthPercentage <= 0:

7. IF age>=18 THEN
ANS) if age>=18:

8. Name=input(“Enter your name: ”)


ANS) RECEIVE name FROM KEYBOARD

9. SET dateOfBirth TO currentYear - age


ANS) dateOfBirth = currentYear - age

10. SEND “Manchester not in the Champions League” TO DISPLAY


ANS) print(“Manchester not in the Champions League”)

11. What does the following pseudocode mean?


SET MyAge TO 21
ANS) It sets a variable called “MyAge” with the value 21

12. What does the following pseudocode mean?


RECEIVE Name FROM KEYBOARD
ANS) There is a variable called “Name”.
“Name” receives its value from a user who will type in letters using the keyboard

ARITHMETIC OPERATORS

1. An arithmetic operator is?


ANS) An operator that performs a calculation on two numbers

2. MOD is the short form for?


ANS) Modulus/Modulo

3. Modulus will?
ANS) Return the remainder of a division

4. 13 MOD 4= 1

5. 20 MOD 6 = 2

6. 17 MOD 3 = 2

7. Observe the following pseudocode:


“SET remainder TO number MOD 2”.
If number = 7, then remained will be set to?
ANS) 1

8. Observe the following pseudocode:


“SET remainder TO number MOD 4”.

Page 4 of 5
If number = 7, then remained will be set to?
ANS) 3

9. DIV is the short form for?


ANS) Quotient division

10. What is the purpose of DIV (Quotient division)?


ANS) The result from a division, expressed as an integer

11. 11 DIV 4= 2

12. 13 DIV 4 = 3

13. 8 DIV 3 = 2

14. 17 DIV 3 = 5

15. Observe the following pseudocode:


“totalMarks DIV numberTests”.
If totalMarks = 100 and numberTests = 10”
The answer will be?
ANS) 10

16. Observe the following pseudocode:


“SET completeHours To minutes DIV 60”.
If minutes = 121”
The answer will be?
ANS) 2

17. Which is the correct syntax for performing a “division” in Python?


ANS) 9/4 = 2.25

18. Which is the correct syntax for performing a “DIV or Quotient division” in Python?
ANS) 9//4 = 2

Page 5 of 5

You might also like