1

1.א

10011011_2 \to 1\times2^0+1\times2^1+1\times2^3+1\times2^4+1\times2^7=155_{10}

456_7 \to 6\times7^0+5\times7^1+4\times7^2=237_{10}

38A_{16} \to 10\times16^0+8\times16^1+3\times16^2=906_{10}

2214_5 \to 4\times5^0+1\times5^1+2\times5^2+2\times5^3=309_{10}

1.ב

Convert 1744_8
4_8=100_2
7_8=111_2
1_8=1_2
1 111 100 100
1111100100_2


Convert \text 6D1A_{16}
\text A_{16}=1010_2
1_{16}=0001_2
\text D_{16}=1101_2
6_{16}=110_2
110 1101 0001 1010
110110100011010_2


Convert 458_{10}

DIV MOD
458 X
229 0
114 1
57 0
28 1
14 0
7 0
3 1
1 1
0 1

111001010_2


Convert 456_7

456_7 \to 6\times7^0+5\times7^1+4\times7^2=237_{10}

DIV MOD
237 X
118 1
59 0
29 1
14 1
7 0
3 1
1 1
0 1

11101101_2

1.ג

Convert 1101011_2

1 101 011
1_2:1\times2^0=1
101_2:1\times2^0+1\times2^2=5
011_2:1\times2^0+1\times2^1=3
1 5 3
153_8


Convert \text 3EA_{16}

3 E A
3_{16}=3_{10}=11_2
\text E_{16}=14_{10}=1110_2
\text A_{16}=10_{10}=1010_2
11 1110 1010

1111101010_2

1 111 101 010
1_2=1_8
111_2=7_8
101_2=5_8
010_2=2_8
1 7 5 2
1752_8


Convert 895_{10}

DIV MOD
895 X
111 7
13 7
1 5
0 1

1577_8

1.ד

Convert 127_{10}

DIV MOD
124 X
62 0
31 0
15 1
7 1
3 1
1 1
0 1

01111100_2


Convert -24_{10}

DIV MOD
24 X
12 0
6 0
3 1
1 1
0 1

00011100_2

\begin{tabular}{ccccccccc}    & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\    & 0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\  + & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \hline    & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 0 \\ \end{tabular}

11101000_2


Convert -109_{10}

DIV MOD
109 X
54 1
27 0
13 1
6 1
3 0
1 1
0 1

01101101_2

\begin{tabular}{ccccccccc}    & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\    & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 1 \\  + & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \hline    & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 \\ \end{tabular}

10010011_2


Convert 108_{10}

DIV MOD
108 X
54 0
27 0
13 1
6 1
3 0
1 1
0 1

01101100_2

1.ד

00011110_2 \to 1\times2^3+1\times2^2+1\times2^1+1\times2^4=30

11100110_2 \to -1\times2^7+1\times2^6+1\times2^5+1\times2^2+1\times2^1=-26

00101101_2 \to 1\times2^5+1\times2^3+1\times2^2+1\times2^0=45

10011110_2 \to -1\times2^7+1\times2^4+1\times2^3+1\times2^2=+1\times2^1-100

Pseudo-Code Legend

Arithmetic operators: + - * / ^(power)
Range operators: < > = <= >=
read <type constraints> to <variable> - puts user input in variable
set <value> to <variable> - sets the value of a variable
if <range condition>
"<text>" - Defines a string literal
print <value> [, ...] - Prints values to screen
print new line - Moves the cursor to the start of the next line
go to <number> - Moves the flow of command to the specified instruction number
div(dividend, divisor) - takes 2 natural numbers and returns the quotient
mod(dividend, divisor) - takes 2 natural numbers and returns the remainder
abs(number) - takes an integer and returns it's absolute value

2

1) read real number to a
2) read real number to b
3) if a = 0
3.1) print "There are infinite solutions"
3.2) exit
4) print -1 * b/a

3

1) read positive integer to num
4) set 10 to previousDigit
5) if num > 0
5.1) set mod(num, 10) to digit
5.1) set div(num, 10) to num
5.2) if previousDigit <= digit
5.2.1) print "לא"
5.2.2) exit
5.3) previousDigit = digit
5.4) go to 5
6) print "כן"

4

1) read natural number n
2) set 1 to i
4) if i <= n
4.1) set 1 to j
4.2) if j <= n
4.2.1) print i * j
4.2.2) print space untill start of column
4.2.3) set j + 1 to j
4.2.4) go to 4.2
4.3) print new line
4.4) set i + 1 to i
4.5) go to 4

5

1) read natural odd number n
2) set n to i
3) if i >= -1 * n
3.1) set abs(i) to numStars
3.2) set n - numStars to numSpaces
3.3) set 0 to j
3.4) if j < numSpaces
3.4.1) print " "
3.4.3) set j + 1 to j
3.4.4) go to 3.4
3.5) set 0 to j
3.5) if j < numStars
3.5.1) print "*"
3.5.3) set j + 1 to j
3.5.4) go to 3.5
3.3) print new line
3.4) set i - 2
3.5) go to 3

6

Code:

/* infoprinter.cpp
 * This program prints my name (Saggi Mizrahi),
 * the course name (Intoduction to Computer Science) and my ID (03243124) in
 * two lines
 *
 * Saggi Mizrahi 22 October 2013
 * ---------------------------------------------------------------------------
 */
#include <iostream>

using namespace std;

int main()
{
    cout << "Saggi Mizrahi, Introduction to Computer Science\n032493124\n";
    return 0;
}

Output:

Saggi Mizrahi, Introduction to Computer Science
032493124