What hexadecimal number comes after 9F? Both capital and lowercase letters are accepted if needed.
0xA0
The ~ operation will…
flip all bits.
Convert 0x90C to binary. Use 12 bits: 4 digits in the first blank, 4 digits in the second blank, and 4 digits in the third blank.
0b
100100001100
True or False: 0 >> 1 = 0
True
With selection sort, we find the final position for an element with each step.
True
Which sorting algorithm divides the array into sorted and unsorted sublists?
Selection
Which list correctly orders the numbers in order from smallest to largest?
0x1C,0x31,0xAB,0xC1
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b0101_1011) >> 3 =
0b
00001011
Convert 0b1111_1011 to hexadecimal (type two digits, i.e. use a leading zero if necessary):
0x
FB
The number system with base 16 is called…
hexadecimal
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b0111_1000) & (0b1001_1001) =
0b
00011000
Which list correctly orders the numbers in order from smallest to largest?
0b0101,0b0110,0b1001,0b1010
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b1001_0000) | (0b0111_0000) =
0b
11110000
Given this array: { 16, 32, 7, 12 , 22, 13, 3, 5 }
What is the order of the array after 3 steps of bubble sort?
{ 16, 7, 12, 32, 22, 13, 3, 5 }
Match the following Unix commands with their definition.
rm- remove
scp- secure copy
cd- change directory
ssh- secure shell
chmod- change permissions
cp- copy
ls- list contents
mkdir- create directory
Linear search is more time efficient than binary search.
False
I run an ls -l command inside a directory, and I see this as output:
-rw-r--r--@ 1 ccc staff 2090 Apr 7 10:36 myfile.txt
What are the group’s permissions?
read only
Give the result of the following operation in hexadecimal. Both capital and lowercase letters are accepted if needed. 0xD7 | (1 << 3) =
0x
DF
With insertion sort, we find the final position for an element with each step.
False
Convert 0xDAD to binary. Use 12 bits: 4 digits in the first blank, 4 digits in the second blank, and 4 digits in the third blank.
0b
110110101101
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b0101_1000) ^ (0b0101_1010) =
0b
00000010
I am running the insertion sort algorithm, and currently at element 10 (the third element in the list).
This is the state of my array: {15, 20, 10, 5, 35, 25}.
What step do I take next?
10 will be placed before 15, and 15 and 20 will be shifted to the right by one index
I run an ls -l command inside a directory, and I see this as output:
-rw-r--r--@ 1 ccc staff 2090 Apr 7 10:36 myfile.txt
How would we change the permissions for the user to have read only permissions, the group to have read and write permissions, and the world to keep the same permissions as listed above?
chmod
464myfile.txt
Write the chmod command that gives the user read, write, and execute permissions, but the group and the world have no permissions for myfile.txt.
chmod
700myfile.txt
Given this array: { 5, 2, 7, 9 ,1, 3 }
What is the order of the array after 2 steps of bubble sort?
{ 2, 5, 7, 9 ,1, 3 }
Give the result of the following operation in hexadecimal. Both capital and lowercase letters are accepted. Give two digits for your answer. ~0x22 =
0x
DD
I run an ls -l command inside a directory, and I see this as output:
-rwxr--r-x@ 1 ccc staff 2090 Apr 7 10:36 myfile.txt*
What are the user’s permissions?
read, write, and execute
In a worst case scenario, binary search would not have to access every element of an array in order to find the element.
True
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b0101_1011) << 3 =
0b
11011000
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. ~(0b1011_0110) =
0b
01001001
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. ~(0b1110_0001) =
0b
00011110
Binary search assumes that the array is sorted before the search algorithm begins.
True
Academic Dishonesty and Cheating
True or False: 1 << 0 = 1
True
Give the result of the following operation in hexadecimal. Both capital and lowercase letters are accepted. Give two digits for your answer. 0x22 | 0xA1 =
0x
A3
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b1111_0000) ^ (0b1001_1001) =
0b
01101001
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b1101_0011) << 2 =
0b
01001100
If a hexadecimal number ends in zero, it must be …
even
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b1111_0000) & (0b1001_1001) =
0b
10010000
I run an ls -l command inside a directory, and I see this as output:
-rw-r--r-x@ 1 ccc staff 2090 Apr 7 10:36 myfile.txt
What are the world’s permissions?
read, execute
Linear search assumes that the array is sorted before the algorithm begins.
False
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b0101_1000) | (0b0001_0001) =
0b
01011001
In class, we created a function called clear_bit() to remove a sensor from a smartwatch. The function took one argument, which was a SensorType index - 0 for Heart Rate, 1 for Blood Pressure, 2 for SPO2, and 3 for Speed/Cadence. mySensors is the integer that we store all the sensors connected to the smartwatch and is accessible by the function.
The function is written below with one line missing. Choose the correct statement from the list to remove the given sensor from the smartwatch, and do nothing if it’s already not connected.
1
2
3
4
5
6
7
void clear_bit( SensorType index ) {
int mask = ( 1 << index );
//______________
}
mySensors = mySensors & (~mask);
In class, we created a function called set_bit() to add a sensor to a smartwatch. The function took one argument, which was a SensorType index - 0 for Heart Rate, 1 for Blood Pressure, 2 for SPO2, and 3 for Speed/Cadence. mySensors is the integer that we store all the sensors connected to the smartwatch and is accessible by the function.
The function is written below with one line missing. Choose the correct statement from the list to add the given sensor to the smartwatch, and do nothing if it’s already connected.
1
2
3
4
5
6
7
void set_bit( SensorType index ) {
int mask = ( 1 << index );
//______________
}
mySensors = mySensors | mask;
Convert 127 (decimal) to binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank.
0b
01111111
Convert 0x23 to decimal.
35
What is the largest number (in decimal) that you can hold with 4 binary digits?
15
Give the result of the following operation in binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank. (0b1101_0011) >> 2 =
0b
00110100
Convert 0x51 to binary. Use 8 bits: 4 digits in the first blank, and 4 digits in the second blank.
0b
01010001
The ASCII value of ‘b’ is 0x62. What is the ASCII value of ‘d’?
0x
64
Give the result of the following operation in hexadecimal. Both capital and lowercase letters are accepted. Give two digits for your answer. 0x22 & 0xA1 =
0x
20
Give the result of the following operation in hexadecimal. Both capital and lowercase letters are accepted. Give two digits for your answer. 0x22 ^ 0xA1
0x
83