Download Sample Problems for SDS2 Exam

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Positional notation wikipedia , lookup

Halting problem wikipedia , lookup

Arithmetic wikipedia , lookup

Mechanical calculator wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Location arithmetic wikipedia , lookup

Transcript
Below are some sample problems which MAY be helpful in preparing for the test.
Sample problem #1
You are given a seven digit number
Example:
1126345
1 = add
2 = subtract
The first digit tells the function (add, subtract, multiply, divide)
The second digit is the horizontal length
The third digit is the vertical length
The fourth digit is the row number for the first value
The fifth digit is the column number for the first value
The sixth digit is the column number for the second value
The seventh digit is the row number for the second value
=
=
=
=
6
3
4
5
Length = 1
#=2
Length = 2
# = 53
Thus 2 + 53 = 55
Red = column/Row number
Black = value
1
2
3
4
5
6
1
1
4
9
8
9
7
2
5
6
1
5
7
1
3
7
9
2
2
6
2
4
3
1
3
4
5
3
5
8
2
4
3
1
5
Example #2:
24 3 7 7 2 3
Since there is no row or column 7, subtract 6 for row,
SLLRCCR
or 5 for column
Operation = 2 (Subtract)
1st # Row = 1 (7 - 6) Column = 2 Length = 4
5738
nd
2 # Row = 3
Column = 2 (7 - 5) Length = 3
157
Sample problem #2
Bank Transfers
This is a batch program with savings and checking accounts. One of the fields will tell
whether the transaction is a deposit or a withdrawal; another will tell you whether it is a checking
or savings account; another will tell the transaction amount. Follow the code until you get 0 in
one of the accounts. It also asked you to print the amount, follow how many times you printed,
and how many times you went through the program.
Sample problem #3
Accumulator
Drawer 1
Drawer 2
Drawer 3
Instructions:
F
F
D
Where F = function
D = Drawer #
The Function (below) is multiplied by the drawer number
Functions
13 = Print
7 = Read
11 = put to accumulator
10 = add to accumulator
15 = move to drawer
650 = end
Write a program that will read two numbers, add them, and print the result.
Numbers can only be added in accumulator.
Numbers can only be read into drawers from 3 to 1
MUST end program.
1.
2.
3.
4.
5.
6.
7.
213
142
333
202
151
131
650
(Read into drawer #3)
(Read into drawer #2)
(Put the contents of drawer #3 into the accumulator)
(Add drawer #2 to accumulator)
(Move the accumulator to drawer #1)
(Print the contents of drawer #1)
(End program)