What does each line of C have to end with
semicolon(;)
what is the variable x equal to after the follow code is ran
int main(void){
uint_32t x =0;
x++;
x++;
}
2
How many bits does each register have
32
What's in R0 after the following code is ran
MOVS R0, #7ADDS R0, #2
SUBS R0, #4
MOVS R1, #3
ANDS R0, R1
#1
What binary value represents true
1
What is the notation for the following boolean operations(operations that return a true or false)
Equals
Greater than
Less than or Equal thanAnd
Or
==
>
<=
&&
||
what is the value of x after this code is ran
int main(void){
uint32_x = 100;
if(x>50){
x = x+50;
}
if(x<100){
x = x-75;
if(x<100){
x = 10;
}
}
if(x&&1){
x++;
}
}
150
What is high voltage for an IO pin in the microcontroller
3.3V
What is in R0 after the code is ran
MOVS R0, #6
MOVS R1, #5
EORS R0, R1
MOVS R2, #1
BICS R0, R2
#2
What registers are not free to use according to AACPS
anything other than R0-R3
ANDS
ORRS
ADDS
SUBS
EORS
LSLS
&
|+
-
^
<<
what is the value of x after this code is ran
uint32_t max(uint32_t a, uint32_t b){
if(a>b){
return a;
}
return b;
}
int main(void){
uint_32t x = 0;
x = max( 12, 10);
x = max( x , max(20,10));
}
20
What is in R0 after the code is ran
LDR R0, =x00FF2398
LSLS R0, R0, #12
ASRS R0, R0, #8
LSRS R0, R0, 8
x00FFF239
What happens to the value of the stack pointer when you push 1 element to the stack
the stack pointer is decreased by 4
What are 3 ways to write a loop in C that adds 1 to a variable x 10 times
int main(void){
uint32_t x=0;
/* loop goes here */
}
for(int i=0; i++; i<10){
x++;
}
int i=0;
while(i<10){
x++;
i++;
}
int i=0;
do{
x++;
i++;
} while(i<10);
what is the contents of array x[ ] after this is run
int main(void){
uint_32t x[ ] = {1,2,3,4,5,6,7,8,9};
for(int i =0; i<9; i++){
x[i]=x[i]+i;
}
}
{1,3,5,7,9,11,13,15,17}
The following addresses have these values
x20389488 F0
x20389489 12
x2038948A F5
x2038948B 90
What is in R0 after the following code is run
LDR R0, =x20389488
LDR R1, [R0]
LDRH R2, [R0, #2]
MOVS R3, #0
LDRSB R4, [R0, R3]
ADDS R0, R1, R2
ADDS R0, R0, R4
x90F5A3D5
x23907984 F9
x23907985 10
x23907886 7C
x23907887 E2
what will be loaded if you read 32bits from address x23907984 little endian
E27C10F9
The following C function takes input x and returns 1+2+3+...+x, Please write this function in Assembly
uint32_t factorial(uint_32 x){
uint_32t output=0;
while(x!=0){
output = output + x;
x--;
}
return output;
}
factorial:
MOVS R1, #0
loop:
CMP R0, #0
BNE done
ADDS R1, R1, R0
SUBS R0, #1
B loop
done:
MOVS R0, R1
What is in R1 after the following code is ran
MOVS R0, #4MOVS R1, #6
MOVS R2, #1
PUSH{R0-R2}
POP{R1-R2}
#4
Where is the stack allocated in memory
in RAM