4. Write a program that reads number of bytes (int) from user and convert it into Megabytes (MB) and Kilobytes (KB). 1 KB = 1024 bytes 1 MB = 1024*1024 bytes Sample i/o: Enter a number of bytes = 1049604 There are 1 Megabytes and 1 Kilobytes and 4 bytes %3D
Q: write a few lines of code that demonstrates the problem with attempts to convert a binary 64-bit…
A: sample output
Q: 1. Convert binary - decimal - hexadecimal numbers (and vice versa) 2. Operations addition,…
A: The answer for the Above given question is given below:
Q: Suppose we have a dataset with 1000 images, each image has resolution 1080 by 1920 pixels, and it's…
A: Of Pixels X Bit Depth ÷ 8 ÷ 1024 ÷ 1024 = File Size in Megabytes (MB)
Q: Problem F. Cities Input file: Output file: Time limit: standard input standard output 1 second 256…
A: Let's understand step by step : To keep track of cities consisting of which country , here using…
Q: A set of eight data bytes is stored in memory locations starting from XX70H. Write a program to…
A: The Answer is in Below Steps
Q: 19) A single bit may be used to display each pixel in a black-and-white picture. (Is it a T or a F)?…
A: Please see the next step for solution
Q: Write a program in 8085 to find a numbers which DI is 1 for aset of numbers stored at memory…
A: #ORG 0000H LXI D,3000H ;LOAD THE DESTINAITON ADDERSS IN DE LXI H,2000H ;LOAD THE…
Q: If the code is compiled on a 32-bit machine. The next code will print? short s; printf("Size of…
A: When compiled on a 32-bit machine, the program will print the following: Size of short = 2 bytes =…
Q: Write an assembly program that calculates a special sum that behaves as follows: • It requests a…
A: Assembly language code which takes user input integer and sum the integer value which is divisible…
Q: Consider the following variable: variable1 DWORD 14253647h Assuming that the computer uses little…
A: little endian for the variable1 DWORD 14253647H
Q: int a = 5; int b = 12; int tmp = a; 3 = b; D = tmp; if (a < b) { System.out.print (a + < " + b); //…
A: In the given code the respective lines define as follows: Line 1: In line 1 the variable a of data…
Q: 10. I Love CCS by Jemar Jude Maranga Write a program that will take as input an integer n, and will…
A: We will use Java programming language for this question Algorithm: Ask user to input an integer…
Q: 2.1. Background In C++, fundamental type int is used to store signed integers. If no length…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: Write a program from decimal to any base, ask the user for a decimal number and convert entered base…
A: Python code for the given problem :- # method to convert decimal num to any other base def…
Q: (Convert C to MIPS) #include int main() { int A=15; int B=10; int C=7; int D=2; int…
A: MIPS is a simple, streamlined, highly scalable RISC architecture. The MIPS architecture is one of…
Q: Write a program which takes in two 16 bit numbers and finds the total sum of all the numbers that…
A: The solution for the above given question is given below:
Q: Write a program that computes the value of a using repeated multiplication. That is, given positive…
A: According to the information given:- We have to write a program that compute the value of ab
Q: Write an assembly language program that requests input from the keyboard for two positive integers…
A: The Program is given below: .model small .stack 100 .data no1 dw 0120 no2 dw 0090 gcd…
Q: Write a program that total 5 bytes of data. Each byte represents the daily wages of a worker. This…
A: The following things need to be understood: Each byte represents the daily wages of worker. total…
Q: 12 You are writing code that is equivalent to: X = A/ (5 + B) Assume signed bytes and the following…
A: Solution: Given,
Q: Suppose that x and y are of type int, z is of type double, and ch is of type char. cin >>x >» y If…
A: The given small code belongs to C++. Correct answer is provided below with an explanation why it is…
Q: 4(**). Write a MASM program that program that reads an integer digit from the keyboard and prints…
A: Assembly language which refers to the computer programming that it is called as the low level of the…
Q: Which of the following statements are true? A. A char typically uses twice as many bits as a short.…
A: Find the required answer with explanation given as below :
Q: Write an assembly language program that requests input from the keyboard for two positive integers…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: Write a program which defines three integer variables, var1, var2 and var3, & initializing them to…
A: Write a program which defines three integer variables, var1, var2 and var3, & initializing them…
Q: * let x=1, 33, 22, 10, 2, 7, 6, 5, 9, 13 .2 s1=s2=n1=n2=D0 for k in range(10): x=int(input('enter a…
A: here we have given the result for the first 10 numbers provided. you can solution in step 2.
Q: Write a program to generate the below series: 4,32,128,256, ...n Input and Output Format: The first…
A: As no programming language is mentioned, it is solved using basic C++
Q: Write a program which takes in two 16 bit numbers and finds the total sum of all the numbers that…
A: The question is on write a program that finds total sum of all the numbers that are divisible by 4…
Q: What does the following code display? var a = 1; function f() { function n() {…
A: above program can shows that the following information: The console.log() is a function in…
Q: 1.(a) float y=1.50, *py: px=&x; printf("%d", *px); * O 1 O 1.5 O 2 O None of the above 1.(b) int…
A: The code segment declares a float variable named y with value 1.50 and a pointer variable named py.…
Q: Assume you have a base 10 computer that stores floating-point numbers using a 5 digit normalized…
A:
Q: 1. Write a Python code which takes a sequence of comma-separated four-digit binary numbers as an…
A: Algorithm: Start Read comma separated data Store them in a list L Convert the numbers into decimal…
Q: ored in memory locations starting at XX70H, and the
A: Algorithm step 1.Load the BYTE1 in accumulator to register B step 2.Substract the 50H from the…
Q: You compile the following piece of code on a little-endian machine that encodes integers as four…
A: unsigned int number has value 100000 The pointer int* pointer points towards the address of the…
Q: Give the address of each of the following variables assuming the base address of V is 20. Eg: V[O].x…
A: Address of variable is a location where that variable is stored. Every variable has a different…
Q: Write a programme to print the storage sizes in bytes of short int, int, long int, float, double and…
A: NOTE: As the programming language is not mentioned in the question. So, we have solved this question…
Q: Write an assembly language program that requests input from the keyboard for two positive integers…
A: Given:
Q: *Write a MIPS program* *Using MIPS program* Write a program that asks the user to enter an unsigned…
A: Code :- #include<bits/stdc++.h>using namespace std; int main(){ int number;…
Q: Could someone help describe what this program is doing please im quite stuck , thanks int main()…
A: Here, the given C code contains the following bugs : Used undeclared variables Entering a value in…
Q: 1. What is the output of this code? int x=3, y=8; C++ y>2 ; %3D %3D cout << x-y; (a) 64 (b) -64 (c)…
A: << in second line refers to left shift and >> in third line refers to right shift
Q: 5 Write the result or output of the following program. M=5 N=2 P-M/N P-M//N P-P+N P-P+M print(“…
A: Given: M=5N=2P=M/NP=M//NP=P+NP=P+Mprint("First and second value of P is:" ,P,P)print("Third and…
Q: 5 Write the result or output of the following program. M-5 N-2 P M/N P-M//N P-P+N P-P+M print(“…
A:
Q: Consider the code below: main() { float b, *y; char c, *z; int a, X = &a; y = &b; z = &c; Given the…
A: Given: Given the memory representation of the variables of type int, char, and float. Which is the…
Q: Write a program that asks the user to enter a signed number and read it. Then display the content of…
A: Note1: As per our guidelines, we are supposed to answer only the first question multiple questions.…
Q: Write a program to move data from internal memory location 25H to R1, 30H to R2 and 40H to R3…
A: ANS: - MOV 90h, #0a5h; a constant number is moved into the port 1 MOV p1, #0a5h; a constant number…
Q: Write a program to process a collection of savings account transactions (deposits or withdrawals).…
A: Pseudo code: Select option Repeat 1: Make withdrawal 2: Make deposit 3: Show balance 4: quit
Q: A junior programmer was assigned to write a subroutine which divides a word NUMX by a byte NUMY and…
A: The sequence of program instructions is called as subroutine when they are used to perform certain…
c++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Create a three address statement and convert the three address statement into machine code fromthe following snippet of program input:int i, a, b;a=0;b=0;for (i=10; i>0; i=i--){if (a%2 ==0 && a<b) b = b + 4;else b = b + 5;}A string of readings is stored in memory locations starting at XX70H, and the end of the string is indicated by the byte 0DH. Write a program to check each byte in the string, and count the number of bytes in the range of 30H to 39H (both inclusive). Store the result in memory locations starting from XX90H Data(H) 35, 2F, 30, 39, 3A, 37, 7F, 31, 0D, 32Interestingly some numbers can be perfectly represented in Base 10, but not in Base 2. An example is one-tenth (in Base 10, this is 0.1; in Base 2 this is a repeating decimal. Suppose we set both f and g to one-tenth using the statements below. f = 0.1; g = 0.1; Answer the following questions. For each, mark the best answer. Which will be closer to the actual value of one-tenth? f g Which can hold higher values? f g Which takes more memory? f g When using real values I should always use type double, to be safe. True False
- calculate number of memory bytes accessed by this program: void my_dgemv(int n, double* A, double* x, double* y) { for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { y[i] += A[i * n + j] * x[j]; } } }Consider the following C++ code snippet: int cards[3]; for (int i = 0; i < 3; i++) cards[i] = 0; Choose the best statement: A) This code will compile and run but causes an out-of-range memory write. B) This code will compile and has no apparent issues. C) This code will not compile as written. D) This code shows an example of dynamic memory allocation.Write programs that will accomplish the desired tasks listed below, using as few lines of code as possible.Use only opcodes that have been covered in class. Comment on each line of code. m) Copy the external code byte at address 007Dh to the SP n) Copy the data in register R5 to external RAM address 032Fh o) Copy the internal code byte at address 0300h to external RAM address 0300h p) Swap the bytes in TIMER 0 ; put TL0 in TH0 and TH0 in TL0 q) Store DPTR in external RAM locations 0123h (DPL) and 02BCh (DPH) r) Exchange both low nibbles of registers R0 and R1 ; put the low nibble of R0 in R1, and the low nibble of R1 in R0
- Write a program that will take n floating point numbers as input and print the sum, average and maximum of the numbers. Use dynamic memory allocation and pointers to do the task. Sample input file: 5 12 24 34 45 56 Sample output file: Sum : 171.0 Average : 34.2 Maximum : 56Create a three address statement and convert the three address statement into machine code fromthe following program input snippet:int x=0, k = 0;do{if (k%2==0 && x>0) x++;else x--;k++;} while (k<5);How will a number that is mathematically equivalent to be stored in memory as an 'int' value? Draw a small memory map for the int value to be starting at address 1000 (decimal). Be clear in your working. No marks for direct answer.
- Write a general-purpose program that is able to add two 8 bytes length numbers. Numbers are saved in EBX: EAX and EDX: ECX Consider this sample call: Number1 QWORD = 1234567898765432h Number2 QWORD = 1234567898765432h Please write code in Masm (Microsoft assembly) No High-Level Assembly. And please don't separate the variables, keep it as it is. If you do split it please do it in the code part. If possible please use 1 loop anything more than inc, dec, mov, xchg, I don't know how to do that yet.Write programs that will accomplish the desired tasks listed below, using as few lines of code as possible.Use only opcodes that have been covered in class. Comment on each line of code. m) Copy the external code byte at address 007Dh to the SPn) Copy the data in register R5 to external RAM address 032Fho) Copy the internal code byte at address 0300h to external RAM address 0300hp) Swap the bytes in TIMER 0 ; put TL0 in TH0 and TH0 in TL0q) Store DPTR in external RAM locations 0123h (DPL) and 02BCh (DPH)r) Exchange both low nibbles of registers R0 and R1 ; put the low nibble of R0 in R1, and the lownibble of R1 in R0s) Store the content of register R3 at the internal RAM address contained in R2. (Be sure the addressin R2 is legal)t) Store the content of RAM location 20h at the address contained in RAM location 08hu) Store register A at the internal RAM location address in register AA. The original Caesar cypher shifts each character by one: a becomes b, z becomes a, and so on. Let's make it a bit harder, and allow the shifted value to come from the range 1..25 inclusive. Moreover, let the code preserve the letters' case (lower-case letters will remain lower-case) and all non-alphabetical characters should remain untouched. Your task is to write a program which: asks the user for one line of text to encrypt; asks the user for a shift value (an integer number from the range 1..25 - note: you should force the user to enter a valid shift value (don't give up and don't let bad data fool you!) Test your code using the data we've provided. Test data Sample input: abcxyzABCxyz 123 2 Sample output: cdezabCDEzab 123 Sample input: The die is cast 25 Sample output: Sgd chd hr bzrs