# C Programming And Assembly Language Assignment 1 Answers

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

## C Programming And Assembly Language Assignment 1 Answers 2022

Only numbers prefixed by “0x” are hexadecimal, all other numbers are decimal.

1. What are the values of the registers AX and BX after the following assembly code executes ?

• a. AX=2, BX=1
• b. AX=1, BX=2
• c. AX=3, BX=1
• d. AX=2, BX=3
`Answer:- c`

2. What is the value of the zero flag at the end of this program’s execution

a. 0
b. 1

`Answer:- a`

3. For the following instructions

When MOV EAX,01 is reached it is necessarily the case that ECX = 0

a. True
b. False

`Answer:- a`

4. Say the following 7 bytes are stored in the extra segment
with 83 being stored at ST ART_ADDR and the addresses increasing as

you go up the list.
Consider the following program to search for 33.

`Answer:- 4`

5. Say the opcode size of REP MOVSB is 1 byte and at present IP=0x0F21 and CX=09. The instruction REP MOVSB is executed. After the execution, we observe that CX=00. Then, IP=  _________ ?

a. 0x0F22
b. 0x0F29
c. 0x0F2B
d. 0x0F2A

`Answer:- d`

6. Say the opcode size of ADD AX,BX is 01 and IP=0x1265 at Line Number 1 in the following code.

What is the value of IP at Line Number 5 after the execution of the instructions from Line Numbers 1 − 5?

a. 0x1265
b. 0x1266
c. 0x1269
d. 0x126A

`Answer:- d`

7. The value stored in the registers AX, BX after the execution of the following code snippet is

a. AX=2, DX=12
b. AX=12, DX=02
c. AX=06, DX=02
d. AX=02, DX=06

`Answer:- For Answer Click Here`

8. If AX=0x2117, CX=0x2434, SS=0x1041 and SP=0xF612. Analyse the following assembly code snippet. What is the value of SP after the following code executes?

• 0xF610
• 0xF611
• 0xF612
• 0xF613
`Answer:- c`

9. If CS=0x0141, DS=0x1634, SS=0x2512, ES=0x3509, AX=0x0116, BP=0x4567, the Address accessed by the instruction [AX+0x0026] is

• 0x1647C
• 0x1647D
• 0x01771
• 0x01770
`Answer:- a`

10. The value stored in the CX register after the above code snippet executes:

• 6
• 7
• 5
• 4
`Answer:- c`

11. The value stored in the register DI after the above code snippet executes:

• 0x0214
• 0x0215
• 0x0216
• 0x0217
`Answer:- d`

12. What is the value of the Direction Flag after the above code snippet executes

• 0
• 1
• Cannot say
`Answer:- b`

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