C Programming & Assembly Language Nptel Week 3 Answers
Are you looking for C Programming & Assembly Language Nptel Week 3 Answers ? All weeks solutions of this Swayam course are available here.
Table of Contents

C Programming & Assembly Language Nptel Week 3 Answers (July-Dec 2025)
Course link: Click here to visit course on Nptel Website
Question 1. Which of the following statement/s will be printed when the above C code executes?
a) MACRO=MACRO
b) a=MACRO
c) MACRO=a
d) a=a
e) None of the above
Question 2. Which of the following statement/s is/are true?
a) Linker combines all object files and generates an executable.
b) If statement-1 of the C code is removed, a compiler error is thrown.
c) If statement-1 of the C code is removed, a linker error is thrown.
d) If statement-1 of the C code is removed, no error is reported.
e) The compilation replaces MACRO by its value ‘a’ only where it appears as a C macro.
f) The pre-compilation replaces MACRO by its value ‘a’ only where it appears as a C macro.
Question 3. What error/s occur when the following code is compiled and executed?
a) Compiler error
b) Linker error
c) Assembler error
d) The above code does not produce any error
These are C Programming & Assembly Language Nptel Week 3 Answers
Question 4. What error/s occur when the following code is compiled and executed?
a) Compiler error
b) Linker error
c) Assembler error
d) The above code does not produce any error
Question 5. What error/s occur when the following code is compiled and executed?
a) Compiler error
b) Linker error
c) Assembler error
d) The above code does not produce any error
Question 6. What error/s occur when the following code is compiled and executed?
a) Compiler error
b) Linker error
c) Assembler error
d) The above code does not produce any error
Question 7. With respect to the main() function as shown above and its local variable space, answer this question. What is the minimum value of N0?
Question 8. In statement 13 of the above C Program, a function call Pythagoras(3,4) is made which translates into appropriate assembly code. The values of the non-negative integers N1, N2 and N3 respectively are:
N1 = ________
N2 = ________
N3 = ________
These are C Programming & Assembly Language Nptel Week 3 Answers
Question 9. After the assembly code executes instruction at 0xC306, what is ADDR 1 and the value in the address pointed by ESP, i.e., [ESP] respectively?
a) ADDR 1= 0xC300 and [ESP]=0xC500
b) ADDR 1= 0xC500 and [ESP]=0xC307
c) ADDR 1= 0xC500 and [ESP]=0xC300
d) ADDR 1= 0xC307 and [ESP]=0xC500
Question 10. In the case of a function call, it is required to restore the context of the CALEE when the CALLED function returns back to the CALEE. With this premise, determine what REG 1 and REG 2 respectively are?
a) REG_1 = ESP and REG_2 = EBP
b) REG_1 = EIP and REG_2 = ESP
c) REG_1 = EBP and REG_2 = EIP
d) REG_1 = EBP and REG_2 = ESP
Question 11. With respect to the Pythagoras() function as shown above and its local variable space, answer this question. What is the minimum value of N5?
Question 12. With respect to the Pythagoras() function as shown above and its local variable space, answer this question. What is the value of QUAL?
a) QUAL = BYTE
b) QUAL = WORD
c) QUAL = DWORD
d) QUAL = QWORD
These are C Programming & Assembly Language Nptel Week 3 Answers
Question 13. With respect to the Pythagoras() function as shown above and its local variables, answer this question. The values of the non-negative integers N6 and N7 respectively are:
N6 = ______
N7 = ______
Question 14. Which of the following statements code lines are wrongly added in the implementation of Pythagoras()?
a) 0xC509
b) 0xC503
c) 0xC50C
d) 0xC50E
Question 15. What is the value of VAL2, as in the address location 0xC307?
VAL2 = ______
Question 16. Which of the following statements are true about the function call Pythagoras() from main()?
a) __cdecl convention is used.
b) __stdcall convention is used.
c) CALLER performs the necessary operations for stack clean up.
d) CALLEE performs the necessary operations for stack clean up.
These are C Programming & Assembly Language Nptel Week 3 Answers
Question 17. Which of the following statements are true about the above C program and its assembly code?
a) Statements in the address location 0xC300 and 0xC500 are used to store the context of its respective CALEE function.
b) Statement in the address location 0xC306 performs the task of storing the return address in the register EAX.
c) Statements in the address location 0xC302 and 0xC502 are used to set the local variable context for its respective function.
d) Statement in the address location 0xC511 is used to restore the context of the main() function.
Question 18. Which of the following will be the assembly statements corresponding to which statement 5 of the above C++ code compiles to?
a) PUSH EBP
b) PUSH ECX
c) MOV EBP, ESP
d) None of the above
Question 19. Which of the following will be the assembly statements corresponding to which statement 10 of the above C++ code compiles to?
a) PUSH EBP
b) PUSH ECX
c) MOV EBP, ESP
d) SUB ESP, 12
e) SUB ESP, 8
f) SUB ESP, 4
g) None of the above
Question 20. When statement 14 compiles, one of the assembly statements it translates to:
LEA ECX, DWORD PTR [EBP-VAL]
What is the non-negative integer VAL?
VAL = ______
These are C Programming & Assembly Language Nptel Week 3 Answers