Académique Documents
Professionnel Documents
Culture Documents
a. 10 b. 2 c. 3 d. 7
a. 4 b. 3 c. 7 d. 25.5
a. 0 b. 1 c. True d. False
a. False b. True c. 5 d. -1
7. What is the output for the following pseudo code, given the following numbers (1,3,2,7,6)
1. C=1
2. Input x
3. Max =x
4. If C<=5 then Go to step 6
5. Go to step 10
6. Input x
7. If x> max then max =x
8. Increment C by 1
9. Go to step 4
1
10. Print max
11. end
a. 7 b. 14 c. 6 d. 5
a.
c. d.
b.
9. What is the output for the following flowchart?
a. 8 7 8 b. 2 7 8 c. 2 5 8 d. 2 7 2
10. What is the equivalent Pseudo Code for the flowchart in question 9?
a. 1. Start b. 1. Start c. 1. Start d. 1. Start
2. Let x = 5, y = 8 2. Input x, y 2. Let x = 5, y = 8 2. Let x = 5, y = 8
3. If x < y then 3. If x < y then 3. If x < y then 3. If x < y then
Print y-6 else Print x Print y-6 else Print x Print y-6 Print y-6 else Print x
4. If y <>2 then 4. If y <>2 then 4. Print x 4. If y <>2 then
Increment x by 2 Increment x by 2 5. If y <>2 then Increment x by 2
5. Print x, y 5. Print x, y Increment x by 2 else Print x, y
6. Stop 6. Stop 6. Print x, y 5. Stop
7. Stop
2
11. What is the output for the following flowchart?
a. 3 b. 6 c. 8 d. 123
12. What is the equivalent Pseudo Code for the flowchart in question 11?
a. 1. Start b. 1. Start c. 1. Start d. 1. Start
2. Let x = 3 2. Let x = 3 2. Let x = 3 2. Let x = 3
3. Let f = 1 3. Let f = 1 3. Let f = 1 3. Let f = 1
4. Let i = 1 4. Let i = 1 4. Let i = 1 4. Let i = 1
5. If i <=x then 5. If i <=x then 5. If i <=x then 5. If i <=x then
Print f f=f*i f=f*i f=f*i
Stop Increment i by 1 Increment i by 1 Increment i by 1
6. f = f * i 6. Print f Go to 5 Go to 4
7. Increment i by 1 7. Stop 6. Print f 6. Print f
7. Stop 7. Stop
13. Which of the following pseudo code will read a number and then print whether it’s odd فرديor even
زوجيnumber?
a. 1. Input x b. 1. Input x c. 1. Input x d. None of them
2. if x mod 2= 0 then 2. if x mod 2= 0 2. if x mod 2 = 0
Print “x is even” then Print “x is then Print “x is
3. Print “x is odd” odd” even” else Print “x
3. Print “x is is odd”
3
even”
14. What are the suitable words to be filled in the blanks so that the following pseudo code will print
the result of 2*4?(Note that: 2*4 = 2+ 2+2 + 2)
1. Start
2. ______ , count =1
3. sum = sum+2
4. count= count+1
5. If count<=4 then _____
6. Print sum
7. Stop
a. 2. sum = 0 b. 2. sum = 0 c. 2. sum = 0 d. 2. sum = 0
5. sum= sum *2 5. goto 3 5. goto 2 5. sum= sum +2