Computer Science: An Overview (12th Edition)
12th Edition
ISBN: 9780133760064
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 2, Problem 36CRP
a.
Program Plan Intro
- Initialize the variable “bit_pattern1” as “00000000”.
- Initialize the variable “bit_pattern2” as “11110000” which is the mask value.
- Perform logical “OR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to display “1’s” in upper 4-bits, store the resultant value in the variable “result”.
- Print the result.
b.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “00000000”.
- Initialize the variable “bit_pattern2” as “10000000” which is the mask value.
- Perform logical “XOR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to find complement of most significant bit in pattern, store the resultant value in the variable “result”.
- Print the result.
c.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “00000000”.
- Initialize the variable “bit_pattern2” as “11111111” which is the mask value.
- Perform logical “XOR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to find complement of 8-bits pattern, store the resultant value in the variable “result”.
- Print the result.
d.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “00000000”.
- Initialize the variable “bit_pattern2” as “01111111” which is the mask value.
- Perform logical “AND” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to find “0” in least significant bit, store the resultant value in the variable “result”.
- Print the result.
e.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “00000000”.
- Initialize the variable “bit_pattern2” as “01111111” which is the mask value.
- Perform logical “OR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to find “1” in all bits except the most significant bit, store the resultant value in the variable “result”.
- Print the result.
f.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “111111111111111111111111”.
- Initialize the variable “bit_pattern2” as “111111111111111111111111” which is the mask value.
- Perform logical “XOR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to find change the color to black, store the resultant value in the variable “result1”.
- Initialize anremaining variable “bit_pattern3” as “111111110000000011111111” which is the mask value to filter all the green components.
- Perform logical “OR” operation between the value of the variables “result1” and “bit_pattern3” to filter out all green color components, store the resultant value in the variable “result2”.
- Print the result.
g.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “111111111111111111111111”.
- Initialize the variable “bit_pattern2” as “111111111111111111111111” which is the mask value.
- Perform logical “XOR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to invert all bits, store the resultant value in the variable “result”.
- Print the result.
h.
Program Plan Intro
Program plan:
- Initialize the variable “bit_pattern1” as “111111111111111111111111”.
- Initialize the variable “bit_pattern2” as “000000000000000000000000” which is the mask value.
- Perform logical “XOR” operation between the value of the variables “bit_pattern1” and “bit_pattern2” to invert all bits, store the resultant value in the variable “result”.
- Print the result.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
14. For this question, mark all answers that apply.
Assuming that i, j, and k are all 32-bit int and a, b, and c are all normal 32-bit float, and that no values go out of range,
which of the following must be true?
a* (b*c) = (a*b)*c
If a>0 and b>0, then (a+b) >a
i+(j+k)
i*(j*k)
(i+j)+k
==
==
==
(i+j)+k
(i*j)*k
k+(j+i)
7. A pair of 7-bit floating point formats, based on the IEEE standard, is described
below:
• Format (a) has k = 3 and n = 4. The exponent bias is 3.
Format (b) has k = 4 and n = 3. The exponent bias is 7.
(a)
Convert the bit patterns below, given in format (a) to bit
patterns in format (b). Convert exact values when possible, otherwise
use the round-to-even rule.
Also, write the values of each bit pattern, for the (a) and (b) formats.
Write the values, in decimal, as rational numbers, or whole integers.
Bits (a) Value
Bits (b)
Value
1
0111 000
011 0000
101 1010
110 1011
000 0011
1
(b)
What is the smallest positive denormalized number in format
(b)? What is the largest positive denormalized number in format (b)?
1. two digits 8 & 3, Convert it to a 7-bit binary number (83 → 0010111) 3. Do the analysis of state-tape contents as in diagram (*) in ex.1 for a task of generating parity bit for the number. For the example, initial tape contents should be ΦΦ0010111Φ, and the parity bit is then 0 → final contents on the tape is Φ00010111Φ
Chapter 2 Solutions
Computer Science: An Overview (12th Edition)
Ch. 2.1 - What sequence of events do you think would be...Ch. 2.1 - What information must the CPU supply to the main...Ch. 2.1 - Prob. 3QECh. 2.2 - Prob. 1QECh. 2.2 - In the text, JUMP instructions were expressed by...Ch. 2.2 - Is the instruction If 0 equals 0, then jump to...Ch. 2.2 - Write the example program in Figure 2.7 in actual...Ch. 2.2 - The following are instructions written in Vole...Ch. 2.2 - What is the difference between the instructions...Ch. 2.2 - Here are some instructions in English. Translate...
Ch. 2.3 - Prob. 1QECh. 2.3 - Suppose the Vole memory cells at addresses 0xB0 to...Ch. 2.3 - Suppose the Vole memory cells at addresses 0xA4 to...Ch. 2.3 - Suppose the Vole memory cells at addresses 0xF0 to...Ch. 2.4 - Prob. 1QECh. 2.4 - Prob. 2QECh. 2.4 - Prob. 3QECh. 2.4 - a. Suppose you XOR the first 2 bits of a string of...Ch. 2.4 - Prob. 5QECh. 2.4 - Prob. 6QECh. 2.4 - Prob. 7QECh. 2.4 - Prob. 8QECh. 2.4 - Prob. 9QECh. 2.4 - Prob. 10QECh. 2.4 - Using Vole machine language (Appendix C), write a...Ch. 2.4 - Prob. 12QECh. 2.5 - Prob. 1QECh. 2.5 - Prob. 2QECh. 2.5 - Prob. 3QECh. 2.6 - The hypotenuse example script truncates the sides...Ch. 2.6 - Prob. 2QECh. 2.6 - The Python built-in function str () will convert a...Ch. 2.6 - Use the Python built-in bin () to write a script...Ch. 2.6 - Prob. 6QECh. 2.7 - Referring back to Questions 3 of Section 2.3, if...Ch. 2.7 - Prob. 2QECh. 2.7 - Suppose there were two central processing units...Ch. 2 - a. In what way are general-purpose registers and...Ch. 2 - Answer the following questions in Vole machine...Ch. 2 - Prob. 3CRPCh. 2 - What is the value of the program counter in the...Ch. 2 - Prob. 5CRPCh. 2 - Prob. 6CRPCh. 2 - Prob. 7CRPCh. 2 - Suppose a machine language is designed with an...Ch. 2 - Translate the following instructions from English...Ch. 2 - Rewrite the program in Figure 2.7 assuming that...Ch. 2 - 11. Classify each of the following instructions...Ch. 2 - Prob. 12CRPCh. 2 - Prob. 13CRPCh. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Suppose the memory cells at addresses 0x00 through...Ch. 2 - Prob. 18CRPCh. 2 - If the Vole executes an instruction every...Ch. 2 - Prob. 20CRPCh. 2 - Prob. 21CRPCh. 2 - Prob. 22CRPCh. 2 - Prob. 23CRPCh. 2 - Write a program in Vole to compute the sum of...Ch. 2 - Prob. 26CRPCh. 2 - Prob. 27CRPCh. 2 - Suppose the following program, written in Vole, is...Ch. 2 - Summarize the steps involved when the Vole...Ch. 2 - Summarize the steps involved when the Vole...Ch. 2 - Summarize the steps involved when the Vole...Ch. 2 - Suppose the registers 0x4 and 0x5 in the Vole...Ch. 2 - Prob. 33CRPCh. 2 - Prob. 34CRPCh. 2 - Prob. 35CRPCh. 2 - Prob. 36CRPCh. 2 - Prob. 37CRPCh. 2 - Prob. 38CRPCh. 2 - Prob. 39CRPCh. 2 - Prob. 40CRPCh. 2 - Prob. 41CRPCh. 2 - Prob. 42CRPCh. 2 - a. What single instruction in the Vole machine...Ch. 2 - Write a Vole program that reverses the contents of...Ch. 2 - Write a Vole program that subtracts the value...Ch. 2 - Prob. 46CRPCh. 2 - Suppose a person is typing forty words per minute...Ch. 2 - Prob. 48CRPCh. 2 - Suppose the Vole communicates with a printer using...Ch. 2 - Write a Vole program that places 0s in all the...Ch. 2 - Prob. 51CRPCh. 2 - Prob. 52CRPCh. 2 - Suppose you are given 32 processors, each capable...Ch. 2 - Prob. 54CRPCh. 2 - Prob. 55CRPCh. 2 - Describe how the average of a collection of...Ch. 2 - Write and test a Python script that reads in a...Ch. 2 - Write and test a Python script that reads in a...Ch. 2 - Prob. 59CRPCh. 2 - Suppose a computer manufacturer develops a new...Ch. 2 - Prob. 2SICh. 2 - Prob. 3SICh. 2 - Prob. 4SICh. 2 - Suppose a manufacturer produces a computer chip...Ch. 2 - Prob. 6SICh. 2 - Prob. 7SICh. 2 - Prob. 8SI
Knowledge Booster
Similar questions
- Write programs in MSP430 language for the following questions: a(15 points) Load least significant 6 digits of your student number as ASCII characters (8-bit ASCII) into R4-R5-R6 register set. b(15 points) Add constant 10 to each character of the R4-R5-R6 register set to make a simple encryption and store results into R7-R8-R9. c(15 points) Decrypt R7-R8-R9 by subtracting by 10 and load the results into R10-R11-R12. d-(15 points) Compare the contents of the set of R4-R5-R6 and the set of R10-R11-R12. Load 1 into R13 to show both sets are the same or clear R13. For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac).arrow_forwardIn the Hamming coding system (7.3), its representation is expressed as 3 control (test) bits and 7 total bits (data+control bits).In the literature, control bits are represented as (cl, c2, c3, or (pl, p2, p3, .) The bit string sent by encoding with Hamming coding (15,4) is on the receiving side, It is retrieved as 001100101100 (pl.p2.dll). According to this bit sequence;Which option is given according to the control bits (p1.p2.p3.p4) sequence of the received bit sequence?A 0110B 1100C 1001D 0011E 0010arrow_forwardConsider an 8-bit floating point format. In this representation 4 bits are reserved for the mantissa and 3 bits are reserved for the exponent and 1 bit is reserved for the sign of the number. The exponent of the number is stored with a bias = 3. Express the decimal number 4.75 in this 8 bit floating point format. Write down the next bigger representable number in decimal base. B If you would be conducting the following operation using this 8 bit floating point format what would the result of the following calculation be ? 4.75 + 0.05 - 4.75 Express the decimal number 4.75 in this 8 bit floating point format. [10] b) Write down the next bigger representable number in decimal base. [7.5] c) If you would be conducting the following operation using this 8 bit floating point format what would the result of the following calculation be ? 4.75 + 0.05 - 4.75arrow_forward
- [4.1] Consider the number -1.36875 x 10¹ as the dividend and 5.625 x 10¹ as the divisor. a. Find their binary representation. b. Normalize the results that you got it in (A) and put them in the 8-bit quarter- precision format (1 for sign bit, 2 for exponent, and 5 for fraction). c. Implement the division and show all the steps of the division to results that you got it in (B). Show if there is an overflow or underflow by assuming that there is a guard bit, a round bit, and a sticky bit.arrow_forwardConsider a single error correction (SEC) code that protects 8 bit words with 4 parity bits. In this case a parity bit for the entire word (pw) is added in order to provide double error detection (DED). Please assume even parity. a) Let us assume that you need to encode the following byte (the least significant bit is on the left side): Least significant bit 1 0 1 0 1 1 0 1 Use the figure below to show the encoded word. Bit position 1 2 3 4 5 6 7 200 8 9 10 11 12 13 Encoded data bits p1 p2 d1 p4 d2 d3 d4 p8 d5 d6 d7 d8 pw Encoded data → b) Let us assume that the encoded word (shown below) is read. Please determine if there is (are) error(s) in the word. If it is possible to correct, please correct. 1 2 3 4 5 6 9 10 11 12 13 7 8 p1 p2 HP d1 p4 d2 d3 d4 p8 d5d6 d7d8 pw 1 1 0 1 10 0 0 1 1 1 0 0 P1- P2= P4- P8= Pw= Please provide the information requested below. a) Please determine (either 0 or 1): P1=P2= P4= P8= and Pw= b) Please determine parity (odd or even): H parity= Now, determine if:…arrow_forwardVI. Floating point representation Consider a 12-bit variant of the IEEE floating point format as follows: • Sign bit 5-bit exponent with a bias of 15. • 6-bit significand All of the rules for IEEE 754 Standard apply. Fill in the numeric value represented by the following bit patterns. You must write your number in decimal form (e.g. 0.0146485375, -0.0146485375). Bit Pattern 010011101110 111011101011 100101001111 001010111010 Numerical Valuearrow_forward
- 2.) This question builds somewhat on top of the previous question. Instead of adding single bits at a time, let's scale this up to two bits. This is visually represented below: + Cout R1 RO For this problem, you are given a carry-in bit `Cin`, as well as the operands `A` and `B`, just as before. However, `A` and `B` are now two bits apiece, with A0 holding the bit at position 0 and `Al` holding the bit at position 1, and so on. This still produces `R` as a result, though the result is now two bits large, with `R0` holding the result value at position 0, and `R1` holding the result value at position 1. `Cout holds the carry-out bit, as before. As before, fill in the table below. Note the ordering of the inputs. The first few have already been completed for you. 2a) 0 2b) 0 2c) 0 2d) 0 Cin Al B1 A0 B0 | Cout R1 R0 2e) 0 2f) 0 2h) 0 21) 0 2k) 0 2g) 0 0 1 0 0 A1 A0 В1 ВО 2r) 1 2s) 1 2j) 0 1 0 2t) 1 2u) 1 2v) 2w) 1 2x) 1 2y) 1 2z) 1 21) 0 2m) 2n) 0 1 O O O O O O OOHHddd□□□ O O O O O O…arrow_forward8. Express the value 0.3 in the 32-bit floating point format that we discussed in class today. Feel free to only show fraction bits [22:15], rather than all the fraction bits, [22:0]. Notation: The symbol [22:15] signifies all 8 bits from bit 22 to bit 15. 0 01111101 00110011arrow_forwardAssignment for Computer Architecture! this is about hamming codes write the code IN MIPS ASSEMBLY LANGUAGE calculating hamming codes; The key to the Hamming Code is the use of extra parity bits to allow the identification of a single error. Create the code word as follows: Mark all bit positions that are powers of two as parity bits. (positions 1, 2, 4, 8, 16, 32, 64, etc.) All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc.) Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit determines the sequence of bits that it alternately checks and skips.Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...)Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...)Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc. (4,5,6,7,12,13,14,15,20,21,22,23,...)Position 8: check 8 bits,…arrow_forward
- You are given two bit locations, i and j, together with the 32-bit values N and M. To insert M into N, provide a procedure that starts M at bit j and finishes it at bit i. It is safe to presume that all of M can fit in the bits j through i. In other words, you may infer that there are at least 5 bits between j and i if M = 10011. M could not completely fit between bit 3 and bit 2, thus you would not, for instance, have j = 3 and i = 2.arrow_forwardCreate a MIPS programme that calculates the Hamming ECC code for an 8-bit byte. 8-bit positive numbers are easier to work with than larger ones, so your codes function for them. The programme requests a byte of data (a positive number from 0 to 255 in decimal) and creates the 12-bit Hamming code. The programme then outputs hex with a label.arrow_forwardplease write in ARM UAL and add comment for explanation.. Thank you..; Write a program that swaps 5th~11th bits in data_a with 25th~31th bits in data_b; Your program must work for any data given, not just the example below; In this question, we assmue that the positions of bits count from right to left.; That is, the first bit is the least significant bit.data_a DCD 0x77FFD1D1data_b DCD 0x12345678arrow_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