Skip to content

Commit 0e0cab7

Browse files
author
l
committed
run on all pr label events
1 parent c098dab commit 0e0cab7

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

number-systems/README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,61 @@ Do not convert any binary numbers to decimal when solving a question unless the
55
The goal of these exercises is for you to gain an intuition for binary numbers. Using tools to solve the problems defeats the point.
66

77
Convert the decimal number 14 to binary.
8-
Answer:
8+
Answer: 1110
99

1010
Convert the binary number 101101 to decimal:
11-
Answer:
11+
Answer: 45
1212

1313
Which is larger: 1000 or 0111?
14-
Answer:
14+
Answer: 1000
1515

1616
Which is larger: 00100 or 01011?
17-
Answer:
17+
Answer: 01011
1818

1919
What is 10101 + 01010?
20-
Answer:
20+
Answer: 11111
2121

2222
What is 10001 + 10001?
23-
Answer:
23+
Answer: 100010
2424

2525
What's the largest number you can store with 4 bits, if you want to be able to represent the number 0?
26-
Answer:
26+
Answer: 15
2727

2828
How many bits would you need in order to store the numbers between 0 and 255 inclusive?
29-
Answer:
29+
Answer: 8
3030

3131
How many bits would you need in order to store the numbers between 0 and 3 inclusive?
32-
Answer:
32+
Answer: 2
3333

3434
How many bits would you need in order to store the numbers between 0 and 1000 inclusive?
35-
Answer:
35+
Answer: 10, but you'd have 23 spare values, so you can actually store between 0 and 1023 with 10 bits.
3636

3737
How can you test if a binary number is a power of two (e.g. 1, 2, 4, 8, 16, ...)?
38-
Answer:
38+
Answer: Test that it has exactly one 1.
3939

4040
Convert the decimal number 14 to hex.
41-
Answer:
41+
Answer: E
4242

4343
Convert the decimal number 386 to hex.
44-
Answer:
44+
Answer: 182
4545

4646
Convert the hex number 386 to decimal.
47-
Answer:
47+
Answer: 902
4848

4949
Convert the hex number B to decimal.
50-
Answer:
50+
Answer: 11
5151

5252
If reading the byte 0x21 as a number, what decimal number would it mean?
53-
Answer:
53+
Answer: 33
5454

5555
If reading the byte 0x21 as an ASCII character, what character would it mean?
56-
Answer:
56+
Answer: !
5757

5858
If reading the byte 0x21 as a greyscale colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
59-
Answer:
59+
Answer: Dark grey
6060

6161
If reading the bytes 0xAA00FF as an RGB colour, as described in "Approaches for Representing Colors and Images", what colour would it mean?
62-
Answer:
62+
Answer: Purple.
6363

6464
If reading the bytes 0xAA00FF as a sequence of three one-byte decimal numbers, what decimal numbers would they be?
65-
Answer:
65+
Answer: 170, 0, 255

test-sdc.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if [[ "$1" == "individual-shell-tools" ]]; then
2424
if [[ "$exercise" == *"stretch"* ]]; then
2525
# echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this."
2626
echo "" >> ../../testoutput.txt
27+
total=$(($total-1))
2728
else
2829
echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt
2930
fi
@@ -34,7 +35,7 @@ if [[ "$1" == "individual-shell-tools" ]]; then
3435
cd ..
3536
rm test.tmp
3637
echo "You passed $pass/$total tasks." >> testoutput.txt
37-
if [ $pass -eq $total ]; then
38+
if [ $pass -ge $total ]; then
3839
echo "This task is complete!" >> testoutput.txt
3940
fi
4041
cat testoutput.txt
@@ -51,12 +52,7 @@ elif [[ "$1" == "shell-pipelines" ]]; then
5152
if [ $? -eq 0 ]; then
5253
pass=$(($pass+1))
5354
else
54-
if [[ "$exercise" == *"stretch"* ]]; then
55-
# echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this."
56-
echo "" >> ../../testoutput.txt
57-
else
58-
echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt
59-
fi
55+
echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt
6056
fi
6157
done
6258
cd ..

0 commit comments

Comments
 (0)