0% found this document useful (0 votes)
43 views4 pages

CS2 HW1 Fall2022-1

This document contains a homework assignment on problem solving with 15 multiple choice questions. The questions cover topics like data types, order of operations, flowcharts, pseudocode, and conditionals. Students are asked to choose the correct answer for each question about expressions, algorithms, and programming concepts.

Uploaded by

Темыр
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views4 pages

CS2 HW1 Fall2022-1

This document contains a homework assignment on problem solving with 15 multiple choice questions. The questions cover topics like data types, order of operations, flowcharts, pseudocode, and conditionals. Students are asked to choose the correct answer for each question about expressions, algorithms, and programming concepts.

Uploaded by

Темыр
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Due Date

King Abdullah II School of Information Technology


Computer Skills for Humanities
Problem Solving Homework
Student ID: Student Name:
Section No:

Choose the correct answer for each of the following questions:

1. What is the data type of the variable y in the following assignment statement: y = “Welcome”
a. String b. Boolean c. Text d. Integer

2. What is the value of X after solving the following equation?


X = 2 ^ 4 + ( 15 / 3 * 4 ) / 4 mod 5 + 1
a. 16 b. 20 c. 17 d. 22

3. What is the value of X after solving the following equation?


X = 3 ^ 2 ^ 1 – 2 + ( 3 ^ 3 * 3 ^ -3 + 2 ) * 5 mod 3

a. 9 b. 22 c. 7 d. 12

4. What is the value of Y after solving the following expression?


Y= ((2*5+4^2 >2^4) or False) and not (2^3 + 4*3) mod 30 < 3
a. False b. True c. 3 d. -2

5. What is the value of Y after solving the following expression?


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
6. What is the output for the following pseudo code, given the following numbers (7,12,14)?
1. C = 2
2. Increment C by 2
3. If C <= 6 then Go to step 5
4. Go to step 8
5. Input x
6. Print “x” , x+1
7. Go to step 2
8. End

a. 7 12 12 14 14 b. 8 8 13 13 14 14 c. x 7 x 12 x 14 d. x 8 x 13 x 15

1
7. The following Flowchart symbol presents:

a. Processing b. Input/output c. Start/Stop d. Decision Box

8. What is the output for the following flowchart?

a. Large Good 10 b. Small Good 10 c. Small Good d. Large Good

9. What is the equivalent Pseudo Code for the flowchart in question 8?

a) b) c) d)
1.Start 1. Start 1. Start 1. Start
2.x=8 , y=10 2. x=8 , y=10 2. X=8, y=10 2. x=8 , y=10
3. If x>y+3 then print 3. If x>y+3 then print 3. If x>y+3 then print 3. If x>y+3 then print
“Large” else print “Small” else print “Large” “Large” else print
“Small” “Large” 4. print “Small”, Print “Small”
4. Print “Good” 4. Print “Good” “Good” 4. Print y
5. If y<> 13 then print y 5. If y<> 13 then 5. If y <> 13 then print y 5. If y<> 13 then
6.Stop print y 6. Stop print “Good”
6. Stop 6. Stop
10. Which of the following assignment statements is not correct?
a. x=z-5 b. x*2 = y c. z=z^2 d. y=z
2
11. What is the output for the following flowchart?

a. 7 12 Finish b. 7 Finish c. 7 7 7 Finish d. 7 12 17 Finish

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 = 1, y = 2 2. Let x = 1, y = 2 2. Let x = 1, y = 2 2. Let x = 1, y = 2
3. Let z = 4 3. Let z = 4 3. Let z = 4 3. Let z = 4
4. y = y + x + z 4. y = y + x + z 4. y = y + x + z 4. y = y + x + z
5. print y 5. print y 5. print y 5. print y
6. If y < 15 then 6. If y < 15 then 6. If y < 15 then 6. If y < 15 then
Print “Finish” Goto 4 y=y+x+z Goto 3
Stop 7. Print “Finish” print y 7. Print “Finish”
7. y = y+x+z 8. Stop 7. Print “Finish” 8. Stop
8. print y 8. 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 2. if x mod 2= 0 then 2. if x mod 2 = 0 then
then Print “x is Print “x is odd” Print “x is even” else
even” 3. Print “x is even” Print “x is odd”
3. Print “x is odd”

3
14. What is the output for the following flowchart?Assume
that the inputs are: 15 , 16 , 17 , 18 , 22

a. *** b. ### c. *** d. ###


### ### *** ***
*** *** ### ###
### *** ### ***
### ### *** ###
15. What are the suitable words to be filled in the blanks so that the following pseudo code will:
Print the odd(‫ )فردي‬numbers between 1 to 9.
1. Start
2. count=
3. print
4. count=count+2
5. if count<=9 then goto
6. Stop
a. 2. 1 b. 2. 1 c. 2. 0 d. 2. 1
3. “odd” 3. count 3. count 3. count
5.step 3 5. step 3 5. step 3 5. step 2

You might also like