Question

Question 1: 1). Mr. Mahmood is a diploma student from engineering department. He is studying computer programming for engine
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:-


The procedure for line by conversion of a C program is shown below.

  • Process of compilation does the conversion of C program into object file which the is passed on to the assembler which does job of converting to machine code.
  • Which will be hex values or binary values.

Example:-

1. Let's compile the c program for Fibonacci series. line by line:-

#include <stdio.h> int main(void) { int x, y, z; while (1) { X = 0; y = 1; do { printf(%d\n, x); z = x + y; X = y; y = z; }

  • Now if we try to see the working, what it simply does is,
  • Choses first two numbers, adds them and stores in third variables, prints the values and stores back third value to second variable and value from second variable to first.

NOW Let's decode:

OK8 x % cat fib.c #include <stdio.h> int main(void) { int x, y, z; 1 7 while (1) { X = 0; y = 1; do { 2 printf(%d\n, x); fi

  • On the left you see the converted hex code and aside of it is the respected Assembly code.
  • SO first it has to be converted to assembly then to hex and binary.
  • The numberings you see are the sequences of the C program ( on right) being converted to assembly.
  • 1. The vales of X = 0 and Y =0 is set using move instruction. Pushed in stack.
  • The Values of $0x0 are the memory location on which values will be temporarily stored. On RAM.
  • 2. Printing of Value from X is done.
  • Then comes the summation and assignment part.
  • Then at the end shuffle of values takes place.
  • and then comes the looping part ( In assembly loops comes last as the condition is to be checked)
  • That's how control of execution of a c program actually works.
Add a comment
Know the answer?
Add Answer to:
Question 1: 1). Mr. Mahmood is a diploma student from engineering department. He is studying "computer...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1...

    Jubail University College Computer Science & Engineering Department Assessmen Assignment Course Code CS120/C5101 t Type: 1 Semester: 403 Course Title Programming Submission 27-06-2020 Total Points 8 Date Submission Instructions: • This is an individual assignment. • Please submit your program (Java fle) in Blackboard. You can create one java project, named as Assignment1_id and add separate java file for each question. You can name your javá files as 01.02.... etc. • Make sure that you include your student ID name...

  • Question II (5 marks) 1. Suppose a computer wants to subtract decimal number 58 from decimal...

    Question II (5 marks) 1. Suppose a computer wants to subtract decimal number 58 from decimal number 70. As we studied, the computer will do this using a method called 2's Complements. a. Show the step by step solution of the subtraction process using 2's Complements for the above given scenario. b. In your own words, describe each step you have done from question (a) above and explain why the step is important for the whole process to be successful....

  • QuesTION 1 In order to supplement his income working in a craft store, Mr. John Collins...

    QuesTION 1 In order to supplement his income working in a craft store, Mr. John Collins has decided to start a home-based business that will specialize in selling used vintage records. Mr. Collins has always been passionate about music. The business will be run out of space that he has set aside in his residence. This space involves 25 percent of the total floor space in the residence. The residence was acquired on January 1, 2017 at a total cost...

  • PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class...

    PART I: Create an abstract Java class named “Student” in a package named “STUDENTS”. This class has 4 attributes: (1) student ID: protected, an integer of 10 digits (2) student name: protected (3) student group code: protected, an integer (1 for undergraduates, 2 for graduate students) (4) student major: protected (e.g.: Business, Computer Sciences, Engineering) Class Student declaration provides a default constructor, get-methods and set-methods for the attributes, a public abstract method (displayStudentData()). PART II: Create a Java class named...

  • Need help with java programming. Here is what I need to do: Write a Java program...

    Need help with java programming. Here is what I need to do: Write a Java program that could help test programs that use text files. Your program will copy an input file to standard output, but whenever it sees a “$integer”, will replace that variable by a corresponding value in a 2ndfile, which will be called the “variable value file”. The requirements for the assignment: 1.     The input and variable value file are both text files that will be specified in...

  • Sky Plasties: Activity-Based Costing System Case Study Mr. Sami Sultan, Chairman of Sky Plastics, was studying...

    Sky Plasties: Activity-Based Costing System Case Study Mr. Sami Sultan, Chairman of Sky Plastics, was studying a schedule showing the product costs for each of the company's three plastic water containers. He had been thinking of how to increase the while facing the international competition for plastic water containers. Usually, Sami time to review company's performance reports. Since profits were being made, Sami believed that company's exports did not spend a lot of accounting to was the responsibility of the...

  • The purpose of this assignment is to develop solutions that perform File IO and objects. Problem specifications are shown below with my changes in blue. 1. File Previewer Write a program that asks...

    The purpose of this assignment is to develop solutions that perform File IO and objects. Problem specifications are shown below with my changes in blue. 1. File Previewer Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been...

  • Please help me with the following C Programming project. I am providing the code I used...

    Please help me with the following C Programming project. I am providing the code I used which needs to be reworked to add the following requirements. Here is my code #include<stdio.h> char input; int main() { int i = 0; while (true){ scanf_s("%c", &input); if (input == 'X') break; printf("%c", input); } return 0; } Here are the requirements for the code plus and additional note what the code should have. Goals Understand the ASCII representation of character values. Understand...

  • MULIJ Use choices only once unless otherwise indicated. MATCHING 12-1: KEY TERMS AND DESCRIPTIONS Match each key te...

    MULIJ Use choices only once unless otherwise indicated. MATCHING 12-1: KEY TERMS AND DESCRIPTIONS Match each key term with the best description Key Terms (1-20) Descriptions Accession number Aerosol _Aliquot Bar code Biobank Breach Central processing Centrifuge Cloud Cursor Data DOT A Area where specimens are received and prioriti B. Computer equipment used to process data C. Connect for the purpose of interaction D. Data Leak E. Department of Transportation F. Electronic medical records G. Enter data into a computer...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT