T F T F T F T F T F T F T F T F T F T F 6-(10 points) True/False Questions a- Re
ID: 3903439 • Letter: T
Question
T F T F T F T F T F T F T F T F T F T F 6-(10 points) True/False Questions a- Reading Stack memory is based on LIFO reading c- In the assembly language, ORIG x3000 means PC x3001 d- Assembly language is a machine language e- JMP instruction changes program counter value f-%x is used in printf() to display a number in hexadecimal b- FILL is a pseudo instruction g-%p is used in printf() statement to display plus sign h- (loat)(12/8) is 1.5 i-An auto variable is the same as global variable j- sizeoffloat) function return 2 bytes 7-(15pts a)Write all the print outs #include int main0 { int i=132,j=97; for (int i-0;i0) funG/3); printf("%d"J%3); }Explanation / Answer
Question 6:
a) True, Reading stack memory is last in first out as elements are added at the top and removed from the top.
b) True, FILL is pseudo instruction which declares a memory location
c) True, with this instruction PC is set to start up at the specified location
d) False, it’s a low level programming language which is near to machine.
e) True, yes when a jump instruction executes it changes the address location in program counter.
f) True, %x signifies unassigned hex value
g) False, it is used for pointer address
h) True.
i) False, there are declared within a block.
j) False, it is 4 bytes
Question 7:
i = 132
j = 97
loop from i = 0 to i<5
1) i = 0
j = 0
j++; so here j becomes 1
printf("%d ",j);//this will print j which is 1 and then goes to next line
printf("%d %d",i,j); this prints i then goes to next line and then j 0, 1
1
0
1
2) i = 1
Now as this is static hence it is shared among the program so we get the j values which was changed during first iteration of loop
so j = 1
j++; so here j becomes 2
printf("%d ",j);//this will print j which is 2 and then goes to next line
printf("%d %d",i,j); this prints i then goes to next line and then j 1, 2
1
0
12
1
2
3) i = 2
Now as this is static hence it is shared among the program so we get the j values which was changed during second iteration of loop
so j = 2
j++; so here j becomes 3
printf("%d ",j);//this will print j which is 3 and then goes to next line
printf("%d %d",i,j); this prints i then goes to next line and then j 2, 3
1
0
12
1
23
2
3
4) i = 3
Now as this is static hence it is shared among the program so we get the j values which was changed during third iteration of loop
so j = 3
j++; so here j becomes 4
printf("%d ",j);//this will print j which is 4 and then goes to next line
printf("%d %d",i,j); this prints i then goes to next line and then j 3, 4
1
0
12
1
23
2
34
3
4
5) i = 4
Now as this is static hence it is shared among the program so we get the j values which was changed during fourth iteration of loop
so j = 4
j++; so here j becomes 5
printf("%d ",j);//this will print j which is 5 and then goes to next line
printf("%d %d",i,j); this prints i then goes to next line and then j 4, 5
1
0
12
1
23
2
34
3
45
4
5
Now i = 5 5<5 condition false loop termintes Hence the output is
1
0
12
1
23
2
34
3
45
4
5
b) We need to solve fun(17)
Here we have fun(int j)
So this means j = 17
Now inside function body
if(j>0) i.e. 17>0 true
fun(j/3) i.e. fun(5) and for printf values goes in stack 17%3 is 2
Now j becomes 5 -
5>0 true
fun(j/3) i.e. fun(1) and for printf values goes in stack 5%3 is 2
1>0 true
fun(1/3) is i.e. fun(0) and for printf values goes in stack 1%3 is 1
Now j = 0
0>0 false and now The control goes to printf - which is going to j%3 which is 0%3 is 0 and now it print the stack values in reverse order
Hence output is 0122
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.