Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 2, Problem 2.59HW
Explanation of Solution
C expression for given statement:
The C expression for word containing of least significant byte of “x” and the remaining bytes “y” is shown below.
Expression: (x & 0xFF) | (y & ~0xFF)
From the above expression,
- First, performing the “&” operation for “x” and “0xFF”, then the result producing “0x000000EF”.
- Then performs the “&” operation for “y” and “~0xFF”, then the result producing “0x76543200”.
- After performing “|” operation that is “(x & 0xFF) | (y & ~0xFF)”, the final result is “0x765432EF”.
For the above expression “(x & 0xFF) | (y & ~0xFF)”, a complete program has been developed in the below section:
//Header file
#include <stdio.h>
#include <assert...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a C++ program that reads two items from a data file, the bit string itself and the parity required, and then adjusts the bit string and then expresses both the original string and the parity adjusted string in hexadecimal form.Sample Run:Enter the bit string and parity (EVEN or ODD): 10110101 EVENOriginal Hex Value: B5Parity Adjusted Hex Value: 16B
Please use C++
In this lab, you need to write a program which, given a seven digit binary input given below, it will check to see if there is a single bit error using the Hamming Code method discussed in lab. For a sample of Hamming Code, the input: 1110101 will reveal that ‘110’ is the location of the error (meaning the sixth slot in the input), so the corrected number would be 1010101, and the actual message transmitted, would be 1011, which is 11 in decimal. You can use this example to test your program to ensure it’s working correctly.
Create a program which can, given a 7-bit long input, written in Hamming Code style, do the three following tasks, displaying the results as output.
(1) Determine if there’s an incorrect bit, and if so, where it is.
(2) Display what the CORRECT code should look like (if it needs to be corrected.)
(3) Display the decimal form of the message that was sent, after any needed correction.
Remember, when using Hamming…
Write the equivalent infix expression for the following postfix expressions.a. x y * z + t -b. x y z + * w u / -
c. x y - z u / * t s + -d. x y z w + - *
Chapter 2 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Ch. 2.1 - Practice Problem 2.1 (solution page 143) Perform...Ch. 2.1 - Prob. 2.2PPCh. 2.1 - Prob. 2.3PPCh. 2.1 - Practice Problem 2.4 (solution page 144) Without...Ch. 2.1 - Prob. 2.5PPCh. 2.1 - Prob. 2.6PPCh. 2.1 - Prob. 2.7PPCh. 2.1 - Prob. 2.8PPCh. 2.1 - Practice Problem 2.9 solution page 146 Computers...Ch. 2.1 - Prob. 2.10PP
Ch. 2.1 - Prob. 2.11PPCh. 2.1 - Prob. 2.12PPCh. 2.1 - Prob. 2.13PPCh. 2.1 - Prob. 2.14PPCh. 2.1 - Prob. 2.15PPCh. 2.1 - Prob. 2.16PPCh. 2.2 - Prob. 2.17PPCh. 2.2 - Practice Problem 2.18 (solution page 149) In...Ch. 2.2 - Prob. 2.19PPCh. 2.2 - Prob. 2.20PPCh. 2.2 - Prob. 2.21PPCh. 2.2 - Prob. 2.22PPCh. 2.2 - Prob. 2.23PPCh. 2.2 - Prob. 2.24PPCh. 2.2 - Prob. 2.25PPCh. 2.2 - Practice Problem 2.26 (solution page 151) You are...Ch. 2.3 - Prob. 2.27PPCh. 2.3 - Prob. 2.28PPCh. 2.3 - Prob. 2.29PPCh. 2.3 - Practice Problem 2.30 (solution page 153) Write a...Ch. 2.3 - Prob. 2.31PPCh. 2.3 - Practice Problem 2.32 (solution page 153) You are...Ch. 2.3 - Prob. 2.33PPCh. 2.3 - Prob. 2.34PPCh. 2.3 - Practice Problem 2.35 (solution page 154) You are...Ch. 2.3 - Prob. 2.36PPCh. 2.3 - Practice Problem 2.37 solution page 155 You are...Ch. 2.3 - Prob. 2.38PPCh. 2.3 - Prob. 2.39PPCh. 2.3 - Practice Problem 2.40 (solution page 156) For each...Ch. 2.3 - Prob. 2.41PPCh. 2.3 - Practice Problem 2.42 (solution page 156) Write a...Ch. 2.3 - Practice Problem 2.43 (solution page 157) In the...Ch. 2.3 - Prob. 2.44PPCh. 2.4 - Prob. 2.45PPCh. 2.4 - Prob. 2.46PPCh. 2.4 - Prob. 2.47PPCh. 2.4 - Prob. 2.48PPCh. 2.4 - Prob. 2.49PPCh. 2.4 - Prob. 2.50PPCh. 2.4 - Prob. 2.51PPCh. 2.4 - Prob. 2.52PPCh. 2.4 - Practice Problem 2.53 (solution page 160) Fill in...Ch. 2.4 - Practice Problem 2.54 (solution page 160) Assume...Ch. 2 - Compile and run the sample code that uses...Ch. 2 - Try running the code for show_bytes for different...Ch. 2 - Prob. 2.57HWCh. 2 - Write a procedure is_little_endian that will...Ch. 2 - Prob. 2.59HWCh. 2 - Prob. 2.60HWCh. 2 - Prob. 2.61HWCh. 2 - Write a function int_shifts_are_arithmetic() that...Ch. 2 - Fill in code for the following C functions....Ch. 2 - Write code to implement the following function: /...Ch. 2 - Write code to implement the following function: /...Ch. 2 - Write code to implement the following function: / ...Ch. 2 - You are given the task of writing a procedure...Ch. 2 - Prob. 2.68HWCh. 2 - Write code for a function with the following...Ch. 2 - Write code for the function with the following...Ch. 2 - You just started working for a company that is...Ch. 2 - You are given the task of writing a function that...Ch. 2 - Write code for a function with the following...Ch. 2 - Write a function with the following prototype: /...Ch. 2 - Prob. 2.75HWCh. 2 - The library function calloc has the following...Ch. 2 - Prob. 2.77HWCh. 2 - Write code for a function with the following...Ch. 2 - Prob. 2.79HWCh. 2 - Write code for a function threefourths that, for...Ch. 2 - Prob. 2.81HWCh. 2 - Prob. 2.82HWCh. 2 - Prob. 2.83HWCh. 2 - Prob. 2.84HWCh. 2 - Prob. 2.85HWCh. 2 - Intel-compatible processors also support an...Ch. 2 - Prob. 2.87HWCh. 2 - Prob. 2.88HWCh. 2 - We are running programs on a machine where values...Ch. 2 - You have been assigned the task of writing a C...Ch. 2 - Prob. 2.91HWCh. 2 - Prob. 2.92HWCh. 2 - following the bit-level floating-point coding...Ch. 2 - Following the bit-level floating-point coding...Ch. 2 - Following the bit-level floating-point coding...Ch. 2 - Following the bit-level floating-point coding...Ch. 2 - Prob. 2.97HW
Knowledge Booster
Similar questions
- code required in mips programming language a .s or .asm code not a c code. Write a MIPS procedure that takes as its two parameters the starting address of a (zero-terminated) string, and a character c, and removes all instances of the character from the string. Also, write a main program to test your procedure. Your main program should input a string from the user (you can assume that the string will be at most 40 characters, not including the zero byte delimiter), and then prompt for input of a character c. If the character c that the user inputs is the newline character (ascii code 10), your program should terminate. Otherwise, your program should invoke your procedure, output the modified string, and then prompt for input of another character to be removed from the string, continuing in this manner until the input character is the newline characterarrow_forwardThe following c# application builds a BitArray of five Byte values (1,2,3,4,5) and shows each byte in its correct binary form:arrow_forwardUsing C++, write a program that converts an integer to 32-bit two's complement. Add a space between every 8 bits. Do not use external libraries that provide the calculations automatically.Example outputThis program converts an integer to 32-bit two's complement.Enter an integer: 1999Two's complement: 00000000 00000000 00000111 11001111Enter an integer: -65535Two's complement: 11111111 11111111 00000000 00000001arrow_forward
- Write a C program that counts the number of each digit entered by the user (Input process should be ended using EOF character). You should use switch to compute the number of each digits. For each digit your program should print a line containing that number of adjacent asterisks. Sample Input1: 182183428500560855599 Sample Input2: 77777445521056 Sample Input3: 782222231567799988001332092555 Sample Output1: 0*** 1** 2** 3* 4* 6* 7 8**** 9** Sample Output2: 0* 1* 2* 3 4** 5*** 6* 7***** 8 + in 6 ∞ Sample Output3: 0*** 1** 2******* 3*** 4 5**** 6* 7*** 8*** 9****arrow_forwardWrite a C Code program that performs the following • Prints your name And student number Reads number of positive integers, finds and prints the smallest even integer of them and counts its occurrences. Assume that the input end when the user enters-1 E.g:- if you entered 6 2 1 2 2 2 -1; the program find the smallest even integer is 2 and occurence count for 2 is 4arrow_forwardIn c++ Now write a program for a double floating pointtype.•What are the number of significant bits that the double’s mantissa can hold, excluding the sign bit.•What is the largest number that a double’s mantissa can hold without roundoff error?•Repeat the program shown on the previous page but set to show where the double’s mantissa starts to exhibit roundoff errors.arrow_forward
- Write a C++ function name bitwise that takes input two int arrays of size 5 and then perform bitwise AND, OR and XOR operation between the two adjacent indexes of the array. Display the resulting arrays as output.arrow_forward1. Convert infix to postfix ((A+B)*(C-D)+E)/(F+G) (A+B/C*(D+E)-F) A+(B*C-(D/E-F)*G}*Harrow_forwardWrite a C program that uses a 20element integer amay to store integers as large as 20-digits each. Your code wil only deal with postive integers. Read the large integer in one ine as a single input (ASCII code of character O is 48, charader 1 is 49, character 2 is 50 and continue in this manner). Write the program that inputs two large integers (you may use Ibrary functions) (the number of digits should be less than or equal to 20 digits) and computes and prints the sum of those integers. Note 1: char a2; charb0: intt rab; igets the value 2 Note 2: For example, we are using 21element integer amray and user entered 387567234512345248. The representation of that integer in your code should be: af0] a[1] a(20] [0 |0 |0 |3 ]8 |7 |5 |6 |7 |2 |3 |4 |5 |1|2 |3 |4|5|2 |4 |8| Note 3: Assume that r boh of your integens are 20 digt, the sum of those integers is 20 digt. but in other cases resut may contain dfferent number of digits. Sample Inputi Sample Outputi 12349814548815723 Sample Input:…arrow_forward
- Create a C# application that generates a BitArray of five Byte values (1,2,3,4,5) and displays each byte in its correct binary form (attach output snapshot).arrow_forwardProgramming language: Dr. Racket Write a function encode that consumes a string message. The function produces a string which is encrypted according the following procedure: Only the letters from the original message will be encrypted. Other characters such as spaces, punctuation, numeric digits, etc. are not included in the encrypted message at all. The encrypted message will only contain uppercase letters. Each letter will be replaced by the uppercase letter at the opposite end of the English alphabet.In other words, A or a will become Z, B or b will become Y, C or c will become X, ..., Z or z will become A. The encrypted message will have a single space separating each letter. You may assume that the letters in message are English letters only. For example: > (encode "Cat") "X Z G" > (encode "Is this correct?") "R H G S R H X L I I V X G"arrow_forwardGiven the following expression, Z = [(G +E) * A] – [H * (A + S / L)] i. Convert the expression to postfix notation.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education