Professional Documents
Culture Documents
Ch1 Test Bank
Ch1 Test Bank
on
m
lra
fA
Sai
g.
En
Tests Bank
Problem Solving
51 | P a g e
Chapter 1 Tests Bank: Problem Solving
1. If the value of the variable A = 5.9 x 10 ^ - 4, then the data type of the A is:
A. Real Number B. Integer Number C. Boolean D. String
2. What is the data type of the variable Y in the following assignment statement:
Y = “Welcome”
A. Real Number B. Integer Number C. Boolean D. String
3. Which of the following assignment statements is correct:
A. X - 1 = Y + 5 B. Y + X = 6 C. 9 = Y D. Y = X + 10
4. Which of the following assignment statements is correct:
A. 5 = C B. 1 + X= m C. C + 3 D. j = p+2
5. Which of the following assignment statements is not correct:
A. X = Z - 5 B. X * 2 = Y C. Z = Z ^ 2 D. Y = Z
6. Which of the following assignment statements store 5 in the variable Y:
A. Y = 5 B. 5 = Y C. Y = Y + 5 D. None of Them
i
on
X = 8 mod 3 * 6 + ( 5 + 3 ^ 2 ) / 7
lra
fA
A. 13.5 B. 10 C. 14 D. 16
Sai
53 | P a g e
27. The output of the following expression is:
Y = 7 mod 3 <> 8 mod 2 ^ 2 and 3 ^ 2 = 2 ^ 3 or Not 2 + 2 / 2 > 2
A. True B. False C. 1 D. 4
28. The output of the following expression is:
Y = 3 ^ 0 < > 1 and not 8 / 2 > 4 or 5 <= 3
A. 8 B. False C. 10 D. True
29. The output of the following expression is:
Y = 5 ^ 0 < > 1 or not 9 / 3 >= 6 and 8 < 4
A. 9 B. 5 C. True D. False
30. The output of the following expression is:
Y = 12 / 3 >= 3 and not 4 < 9 or 1 ^ 5 = 5
A. True B. False C. 13 D. 9
31. The output of the following expression is:
B = not 4 ^ 2 = 8 and 5 mod <= 2 or 3 = 1 ^ 3
A. 0 B. True C. False D. 2
32. What is the output for the following code, assume that the inputs are: 4 , 1 , 8
i
on
1. Start
m
lra
2. a = 4
fA
3. Input x
ai
S
4. If a mod x = 0 then go to 6
g.
En
5. Go to 8
6. Print x
7. Go to step 3
8. Stop
A. 4 1 8 B. 4 1 C. 4 D. None of Them
33. What is the output for the following code
1. C = 9
2. If c >= 1 then go to 4
3. Go to 7
4. Print C
5. C = C - 3
6. Go to 2
7. Stop
A. 9 6 3 0 B. 6 3 C. 9 6 3 D. None of Them
34. What is the output for the following pseudo code, given the following numbers (1 , 3 , 2)
1. C = 1
2. If C < 4 then Go to step 4
3. Go to step 8
4. Input x
5. Print x ^ 2
6. Increment C by 1
7. Go to step 2
8. Print “*”
9. End
A. 1 9 B. 1 3 2 * C. 1 2 3 * * * D. 1 9 4 *
54 | P a g e
35. 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
10. Print max
11. End
A. 7 B. 14 C. 6 D. 5
36. What is the output for the following pseudo code, given the following numbers
(2 , 1 , 4 , 3)
1. Start
2. X = 3
3. Input Y
4. If x < y then print y * y
i
on
5. Decrement X by 1
m
7. stop
ai
A. 4 1 1 6 9 B. 4 1 1 6 C. 9 4 1 0 D. 4 1
S
g.
37. What is the output for the following pseudo code, given the following numbers
En
(2 , 7 , 1 , 6 , 6 , 6 , 1 , 5)
1. Start
2. S = 20
3. Input a , b
4. If a > b then print b else print a + 1
5. Decrement s by 4
6. If s >= 10 then go to step 3
7. stop
A. 3 7 B. 3 2 7 C. 3 7 1 2 D. 2 1 7
38. What is the output for the following pseudo code, given the following numbers
(2 , 6 , 1 , 7 , 6 , 3 , 1 , 5)
1. Start
2. S = 20
3. Input a , b
4. If a > b, then print b else print a + 1
5. Decrement s by 4
6. If s >= 10 then go to step 3
7. stop
A. 2 1 7 B. 3 7 1 C. 3 2 3 D. 3 6 6
55 | P a g e
39. What is the output for the following pseudo code, given the following numbers
(5 , 7 , 4 , 1)
1. Start
2. X = 8
3. Input y
4. If x > y, then print y * y
5. Decrement x by 1
6. If x >= 5 then go to step 3
7. stop
A. 25 49 16 1 B. 25 49 16 C. 25 16 1 D. 25
40. Which of the following pseudo code will read a number and then print whether it’s odd or even
number?
1. Start
lra
2. Count =_____
fA
ai
3. Print Count.
S
g.
56 | P a g e
42. Write the equivalent Pseudo Code for the following flowchart:
i
on
m
lra
fA
Sai
g.
En
57 | P a g e
43. Write the equivalent Pseudo Code for the following flowchart:
i
on
m
lra
fA
A. 1. Input x, j C. 1. let x = 5 , j =1
B. 1. let x = 5 , j =1
ai
2. print x
S
2. Print x
2. print x
g.
3. Increment 3. Increment
En
3. Increment
j by 1 j by 1
j by 1
4. If j <= x then go 4. If j <= x then go D. None of them
4. If j <= x then go
to step 2 to step 2
to step 3 else
5. Decrement 5. Decrement
decrement x by 1
x by 1 x by 1
5. Print x
6. Print x 6. Print x
58 | P a g e
44. Write the equivalent Pseudo Code for the following flowchart:
i
on
m
lra
fA
59 | P a g e
45. Write the equivalent Pseudo Code for the following flowchart:
i
on
m
lra
3. Let s = 0
g.
4. if d < 5 then
Increment s Increment s Increment s
5. Increment s
by 10 by 10 by 10
by 10
Stop Increment d Increment d
6. d = d + 1
6. d = d + 1 by 1, Go to 4 by 1
Print s
7. Print s else Print f else Print f
7. Stop
8. Stop 5. Stop 5. Stop
60 | P a g e
46. Write the equivalent Pseudo Code for the following flowchart:
i
on
m
61 | P a g e
47. Write the equivalent Pseudo Code for the following flowchart:
i
on
m
lra
48. Find the wrong statement in the following pseudo code that is written to find and print the
summation of even numbers between 1 and 10:
1. Start
2. Let Sum = 0
3. Let X = 2
4. Sum = Sum + X
5. X = X + 1
6. If X <= 10 then go to step 4
7. Print Sum
8. Stop
D. Statement 6
A. Statement 2 it B. Statement 4 it C. Statement 5 it
should be If
should be let should be should be
X <= 10 then go to
sum = 10 X = X + Sum X=X+2
step 3
62 | P a g e
49. What are the suitable words to be filled in the blanks so that the following pseudo code
will input 4 numbers and print the summation of positive number only:
1. Start.
2. Count = 1, Sum = 0
3. Input X
4. If __________ then Sum = Sum + X
5. Count = Count + 1
6. If Count <= 4 then go to _________
7. Print Sum
8. Stop
i
on
m
lra
fA
Sai
g.
En
63 | P a g e
The Nerd in Computer Skills for Humanities Schools
حلول اسئلة السنوات للوحدة االول
A
ولكن بالخطوة 4بدل اشارة 36 A 19 D 2
< نضع اشارة > يف السؤال
B
B 48 ولكن بعد ال modنضع 31 C 14
الرقم 2بالسؤال
الرمون.
ي للحصص الخصوصية ،التواصل عىل +962 77 922 8439م .سيف •