NPTEL C Programming And Assembly Language Assignment 2 Answers 2022:- Hello students in this article we are going to share NPTEL C Programming And Assembly Language Assignment week 2 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 2 Answers 2022
1. What expression will the register EAX bear immediately after the execution of statement 11?
a. EAX =((a&b)|x) ⊕ (x&y)
b. EAX = (a|b|x) ⊕ (x&y)
c. EAX = (a|b|x)&(x&y)
d. EAX = (a|b|x) ⊕ (x|y)
Answer:- a
2. What value will the register EAX bear immediately after the execution of statement 11?
Answer:- 7
Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
3. If statement 11 was changed to MUL EBX, what value will the register EDX bear immediately after the execution of statement 11?
Answer:- 0
4. What is the value in AX when the program reaches statement 14?
Answer:- 8
5. If the instructions were executing on a 16-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:- 23
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 AX when the program reaches statement 14?
Answer:- 46368
👇For Week 03 Assignment Answers👇
7. Which of the following C statements do not get compiled to assembly statements when compiled for maximum optimizations?
a. statement 4
b. statement 5
c. statement 6
d. statement 7
e. statement 8
f. None of the above
Answer:- a, c, d
8. If statement 9 was changed to return q, then which of the following C statements do not get compiled to assembly statements when compiled for maximum optimizations?
a. statement 4
b. statement 5
c. statement 6
d. statement 7
e. statement 8
f. None of the above
Answer:- a, b, c, d, e
9. If statement 9 was retained as return r and statement 6 was changed to s = a, then which of the following C statements do not get compiled to assembly statements when compiled for maximum optimizations?
a. statement 4
b. statement 5
c. statement 6
d. statement 7
e. statement 8
f. 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?
Answer:- e
11. Which of the following is the purpose of the assembly statement 3?
Answer:- c
12. Which of the following assembly statement(s) implement the functionality of the C statement 4?
Answer:- c, d
13. Statement 9 in the C code maps to assembly statement __________
Answer:- For Answer Click Here
14. If statement 1 of the C code is changed to int arrlenfn(short int *pA), then which of the following will statement 10 of the compiled assembly code change to?
Answer:- a
15. If arrlenfn is called from main, as shown below, what value will be printed?
Answer:- 3
16. Mark the valid option/s that will be printed once the above C program is executed.
Answer:- a
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))
Answer:- b
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))
Answer:- c
19. Mark the valid option/s that will be printed once the above C program is executed.
Answer:- a
For More NPTEL Answers:- CLICK HERE
Join Our Telegram:- CLICK HERE
What is C Programming and Assembly Language?
Students who complete their bachelors degree (BE/ BTech) in computer science or electrical engineering do extensive course work in Microprocessors and then in C programming. However, what is missing in the current curriculum is to explicitly establish the link between the two. Specifically we look at how a C program is translated to assembly language and how it eventually gets executed on a microprocessor. Through, animations we show what happens in the stack, data and code segment, of the microprocessor when a C program is executed.
COURSE LAYOUT
- WEEK 1: Introduction to Microprocessors and Assembly language
Programming Microprocessor Architecture
Machine Language Execution sequence in a MuP
Memory in a microprocessor Instruction Set ADDRESSING SCHEMES MOV ARITHMETIC AND LOGICAL INSTRUCTIONS FLAG REGISTER STACK INSTRUCTIONS CALL and RET HARDWARE LOOPS - WEEK 2: Introduction to C and Inline Assembly Data types and their sizes Simple examples of Inline assembly ALU operations String length Multiplication using repeated addition Swap two variables in C Swap two variables in inline Assembly Function to swap two variable in C Inline code to swap the two variables using a function
- WEEK3: Compiling C to Assembly Language Compiling a simple program to Assembly – first order Passing parameters Prologue Epilogue Local variables
- WEEK4: C++ and Some special Functions C and C++ at assembly language level Recursion vs Loops with factorial as example Special functions memcpy strlen
CRITERIA TO GET A CERTIFICATE
Average assignment score = 25% of average of best 3 assignments out of the total 4 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100
Final score = Average assignment score + Exam score
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.