# NPTEL C Programming And Assembly Language Week 2 Assignment Answers 2023

NPTEL C Programming And Assembly Language Week 2 Assignment Solutions

## NPTEL C Programming And Assembly Language Week 2 Assignment Answers 2023

1. What expression will the register EAX bear immediately after the execution of statement 11?

• EAX=((a&b)|x)⊕(x&y)
• EAX=(a|b|x)⊕(x+y)
• EAX=((a&b)|x)⊕(x+y)
• EAX=(a|b+x)⊕(x|y)
`Answer :-For Answer Click Here`

2. What value will the register EAX bear immediately after the execution of statement 11?

`Answer :- For Answer Click Here`

3. If after statement 11, we added the statements

what value will the register EDX bear immediately after the execution of statement 13?

`Answer :- For Answer Click Here`

4. What is the value in EAX when the program reaches statement 14?

`Answer :- For Answer Click Here`

5. If the instructions were executing on a 32-bit processor, what is the largest value one can assign to N in statement 3 such that the program reaches statement 14 without an overflow of the accumulator in statement 9?

`Answer :- For Answer Click Here`

6. Let the answer to question 5 be k. If we replace N=5 (in statement 3) by N=k, what is the value in EAX when the program reaches statement 14?

`Answer :- For Answer Click Here`

7. Which of the following C statements do not get compiled to assembly statements when compiled for maximumoptimizations ?

• statement 3
• statement 4
• statement 5
• statement 6
• statement 7
• None of the above
`Answer :- For Answer Click Here`

8. If statement 4 was changed to a=s+z and statement 6 was changed to r=a−s , then which of the following C statements do not get compiled to assembly statements when compiled for maximumoptimizations ?

• statement 3
• statement 4
• statement 5
• statement 6
• statement 7
• None of the above
`Answer :- For Answer Click Here`

9. If statement 7 was changed to return x , then which of the following C statements do not get compiled to assembly statements when compiled for maximumoptimizations ?

• statement 3
• statement 4
• statement 5
• statement 6
• statement 7
• None of the above
`Answer :- For Answer Click Here`

10. After the execution of the following code snippet, what is the value by which the pointer variables pB and pA are incremented respectively?

• 4, 8
• 4, 4
• 2, 8
• 8, 4
• None of the above
`Answer :- For Answer Click Here`

11. Which of the following is the purpose of the assembly statement 3?

• To initialise the C variable count
• To load the register ECX with the value of C variable count
• To load the register ECX with the address of the C variable pA
• To load the register ECX with the value in the address pointed by the C variable pA
`Answer :- For Answer Click Here`

12. Which of the following assembly statement(s) implement the functionality of the C statement 4?

• statement 3
• statement 4
• statement 5
• statement 6
• statement 7
• statement 8
• statement 9
• statement 10
`Answer :- For Answer Click Here`

13. Statement 5 in the C code maps to assembly statement _____.

`Answer :- For Answer Click Here`

14. If arrlenfn is called from main, as shown below, it will print out len= ______?

`Answer :- For Answer Click Here`

15. If statement 1 of the C code is changed to int arrlenfn(short int pA), then which of the following will statement 5 of the compiled assembly code change to?

• cmp WORD PTR [ecx+eax2], 0
• cmp DWORD PTR [ecx+eax2], 0
• cmp WORD PTR [ecx+eax4], 0
• cmp DWORD PTR [ecx+eax*4], 0
`Answer :- For Answer Click Here`

16. Mark the valid option/s that will be printed once the above C program is executed.

• Print=160,60
• Return Value=160
• Print=60,160
• Return Value=60
• Print=160,160
• Return Value=160
• Print=60,160
• Return Value=160
`Answer :- For Answer Click Here`

17. What is the value in the C variables a and b after statement 6 executes? (Assume that the main() function is executed first and control has been transferred to the function swap(int x, int y))

• a=160, b=60
• a=60, b=60
• a=60, b=160
• a=160, b=160
`Answer :- For Answer Click Here`

18. What is the value in the C variables a and b after statement 7 executes? (Assume that the main() function is executed first and control has been transferred to the function swap(int x, int y ))

• a=60, b=160
• a=60, b=60
• a=160, b=60
• a=160, b=160
`Answer :- For Answer Click Here`

19. Mark the valid option/s that will be printed once the above C program is executed.

• Print=160,60
• Print=60,60
• Print=160,160
• Print=60,160
`Answer :- For Answer Click Here`