answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
TiliK225 [7]
2 years ago
13

Write a C translation of the NASM program below, sticking to the assembly code as much as possible. Use single-letter variable n

ames for function parameters (e.g., int foo(int x, int y)) and for local variables within function (e.g., int z) instead of using x86 register names (in fact registers should never appear in your translation). It is expected that your C code is much shorter than the assembly code.
Computers and Technology
1 answer:
vichka [17]2 years ago
6 0

Answer:

See explaination

Explanation:

mov ebp, esp

and esp, 0FFFFFFF0H

sub esp, 16

mov dword [esp], ?_001

call puts

mov eax, 0

leave

ret

End

The C translation is always expected to be shorter than the assembly language code.

You might be interested in
we are given an array a consisting of n distinct integers. we would like to sort array A into ascending order using a simple alg
marta [7]

Answer:

Check the explanation

Explanation:

the js code is as follows

function count_max_group(ar) {

if (ar.length < 2) return ar.length; // if no of elements are 2 then max groups are 2

let st = [0]; // stack to store the groups

for (let i = 1; i < ar.length; i++) {

if (ar[i] >= ar[i - 1]) st.push(i); // pushing elements if if ar[i] is greater than the previous element

for (let j = i; j > 0 && ar[j] < ar[j - 1]; j--) { // finding the max number of grps

swap(ar, j, j - 1); // swapping

if (j <= st[st.length - 1]) st.pop();

}

}

return st.length;

}

function swap(a, i, j) { // function to swap two variables

let t = a[i];

a[i] = a[j];

a[j] = t;

}

//sample solutions

console.log("the sample solutions are\n");

console.log("[2,1,6,4,3,7]\n");

console.log(count_max_group([2,1,6,4,3,7]));

console.log("[4,3,2,6,1]\n") ;

console.log(count_max_group([4,3,2,6,1]));

console.log("[2,4,1,6,5,9,7]\n");

console.log(count_max_group([2,4,1,6,5,9,7]));

4 0
2 years ago
A major clothing retailer has requested help enhancing their online customer experience. How can Accenture apply Artificial Inte
Harrizon [31]

Answer:

Option D

Explanation:

Artificial intelligence is a technology where the information gathered in the past is processed for the future actions.

Here, based on the preferences of customer in the past and purchase history, AI can suggest the customer new products and services

Hence, option D is correct

3 0
2 years ago
A chess-playing computer program that routinely calculates all possible outcomes of all possible game moves best illustrates pro
Evgesh-ka [11]
<span>A chess-playing computer program that routinely calculates all possible outcomes of all possible game moves best illustrates problem solving by means of </span>brute force.
5 0
2 years ago
Create an application that contains an enumeration that represents the days of the week. Display a list of the days, and then pr
IgorLugansk [536]

Answer:

The program to this question can be defined as below:

Program:

import java.util.*; //import package for user input

enum Days{Sunday, Monday, Tuesday, Wednesday, Thusday, Friday, Saturday} //defining enum

public class DayOfWeek //defining class DayOfWeek

{

  public static void main(String[] args) //defining main method

  {

  System.out.println("Days of the Week: "); //print message  

  for (Days d : Days.values()) //defining for loop to print enums values

  {

  System.out.print(d+"\n");//print values

  }

  System.out.println("Enter your day: "); //print message

  Scanner obx= new Scanner(System.in); //create Scanner class object for user input

  Object d= obx.next(); //create object to hold user-input value

  System.out.print("Business Hours "); //print message

   //check conditions  

  if(Days.Sunday.toString().equals(d)) //defining if block to check if day is Sunday

  {

  System.out.println("from 11 to 5"); //print message

  }

  else if(Days.Saturday.toString().equals(d))// check if the day isn't Sunday

  {

  System.out.println("from 10 to 6");  //print message

  }

  else //else block

  {

      System.out.println("from 9 to 9");//print message

  }

  }

}

Output:

please see the attachment.

Explanation:

In the given code first package is import for user input then the enumeration "Days" is used, in which weekday values are defined. In the next line, the class "DayOfWeek" is defined, in this main method is declared, that first uses a loop to print enum value than it will create object "d" for user input and define conditional statement to check values, that can be described as follows:

  • In the if block it will check if the input value is "Sunday", it will print 11 to 5 business hours, otherwise, it will go to the else if block.
  • In this block it will check, that input value is "Saturday", if it is true it will print 10 to 6 business hours.
  • If both above condition is false so, it will print 9 to 9 business hours.

7 0
2 years ago
Convert the following binary number to octal (111000)2​
yKpoI14uk [10]

Answer: (111000)2 = (70)8

Step by step solution:

Step 1: Write down the binary number

   (111000)2

  Group all the digits in sets of three starting from the LSB (far right). Add zeros to the left of the last digit if there aren't enough digits to make a set of three.

   111 000

Step 2: Use the table below to convert each set of three into an octal digit. In this case,

 111=7, 000=0.

So, the number 111000 in binary is equivalent to 70 in octal.

To convert from binary to octal use the following table:

Bin:     000 001    010     011    100 101     110     111

Octal:     0         1        2         3       4       5       6       7

7 0
2 years ago
Other questions:
  • You want to implement a mechanism that automates ip configuration, including ip address, subnet mask, default gateway, and dns i
    14·1 answer
  • Import java.util.scanner; public class sumofmax { public double findmax(double num1, double num2) { double maxval; // note: if-e
    10·1 answer
  • Match each logical function with its description. AND COUNTIF SUMIF IF tests for a certain condition and returns one of two valu
    7·1 answer
  • Which references are updated when you copy the formula =$E6-MAX(H$1:J4)
    10·1 answer
  • ___________ device that uses a light source to read characters, marks, and codes and then converts them into digital data that a
    11·1 answer
  • 3.5 Code Practice
    11·2 answers
  • Which type of network topology lets you see which end devices are connected to which intermediary devices and what media is bein
    9·1 answer
  • Which broad area of data mining applications analyzes data, forming rules to distinguish between defined classes?
    13·1 answer
  • Please can someone help me answer this question.
    11·1 answer
  • Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!