C Programming And Assembly Language Assignment 3 Answers

NPTEL C Programming And Assembly Language Assignment 3 Answers 2022:- Hello students in this article we are going to share NPTEL C Programming And Assembly Language Assignment week 3 answers. All the Answers are provided below to help the students as a reference, You must submit your assignment with your own knowledge.

NPTEL C Programming And Assembly Language Assignment 3 Answers 2022

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

Answer:- c

2. Regarding pre-compilation and then compilation, which of the following statement/s are true?

a. Statement-2 is a global variable declaration.
b. The compilation replaces MACRO by it’s value ‘a’ only where it appears as a C macro.
c. The pre-compilation replaces MACRO by it’s value ‘a’ only where it appears as a C macro.
d. None of the above

Answer:- c

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW

C Programming And Assembly Language Assignment 3 Answers

3. 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. Syntactical mistakes yield compilation errors.
f. Syntactical mistakes yield pre-compilation errors.

Answer:- a, b, e

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

Answer:- b

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

Answer:- a

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

Answer:- a

👇For Week 04 Assignment Answers👇

C Programming And Assembly Language Assignment 3 Answers

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?

Answer:- 12

In statement 13 of the above C Program, a function call SurfAr(3,5,2) is made which translates into appropriate assembly code. The values of the non-negative integers N1, N2 and N3 respectively are:

8. N1= ____________

Answer:- 2

9. N2= ____________

Answer:- 5

10. N3= ____________

Answer:- Click Here

11. When statement-13 of the C Program in main() is executed, it performs a function call as shown in the assembly equivalent code at the code segment address 0xC306. 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

Answer:- b

12. 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

Answer:- d

13. With respect to the SurfAr() function as shown above and its local variable space, answer this question. What is the minimum value of N5?

Answer:- 10

14. With respect to the SurfAr() 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

Answer:- c

15. N6=  ______________

Answer:- 6

16. N7=  ______________

Answer:- 12

17. N8=  ______________

Answer:- 16

18. Analyse the function SurfAr() and answer this question. What is the value of VAL1, as in the address location 0xC50C?

VAL= _______

Answer:- 0

19. What is the value of VAL2, as in the address location 0xC307?

VAL2= _______

Answer:- 12

20. Which of the following statements are true about the function call SurfAr() from main()?

a. __ccdecl 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.

Answer:- Click Here

21. 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. Statement in the address location 0xC307 is used to perform explicit stack clean up by the CALEE.
d. Statements in the address location 0xC302 and 0xC502 are used to set the local variable context for its respective function.
e. Statement in the address location 0xC511 is used restore the context of the main() function.

Answer:- a, c, d, e

22. 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

Answer:- a, c

23. Which of the following will be the assembly statements corresponding to which statement 10 of the above C++ code compiles to?

Answer:- b, c, d, e

24. 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?

Answer:- 4

For More NPTEL Answers:- CLICK HERE

Join Our Telegram:- CLICK HERE

Leave a Comment