Binary_AND_ExerciseZZ
.docx
keyboard_arrow_up
School
Howard Community College *
*We aren’t endorsed by this school
Course
MSFT 299
Subject
Computer Science
Date
Apr 29, 2024
Type
docx
Pages
5
Uploaded by JudgeGiraffeMaster1074 on coursehero.com
Name:____________ SANAULLAH AMIN Bitwise & (AND operation) exercise. Reminder
: The bitwise & operator (AND) compares each bit of the first operand to the corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to
1. Otherwise, the corresponding result bit is set to 0. (source: Microsoft.com)
EXAMPLE: Find:
10101100
&
11000101
---------------
10000100
1)
Find:
11101100 & 01101101
--------------
11101100 & 01101101
--------------
01101100
2)
Find:
01011101
& 11001000
--------------
01011101
& 11001000
--------------
01001000
1
©2022 by Howard Community College.
3)
Find:
00110110 & 11001101
--------------
00110110 & 11001101
--------------
00000100
4)
Find:
10101101 & 11111111
--------------
10101101 & 11111111
--------------
10101101
5)
Find:
10001101 & 00000000
--------------
10001101 & 00000000
--------------
00000000
2
©2022 by Howard Community College.
6)
Find:
10001101 & 10001101
--------------
10001101 & 10001101
--------------
10001101
7)
Find 145 & 123
a.
Convert 145 from decimal to binary:_________
14510=100100012145
10
=10010001
2
b.
Convert 123 from decimal to binary:__________ 123
10
=01111011
2
c.
Calculate the & result for a and b: ______
10010001
& 01111011
--------------
00010001
d.
Convert result from c back to decimal: _________
000100012=171000010001
2
=17
10
8)
Find 145 & 17
a.
Convert 145 from decimal to binary:_________
145
10
=10010001
2
b.
Convert 17 from decimal to binary:_________
17
10
=00010001
2
3
©2022 by Howard Community College.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
✓ sizeof operator does not
work with bitfields.
(True/False)
arrow_forward
Menus The local diner offers a meal combination consisting of an appetizer, a soup, a main course, and a dessert. There are four appetizers, five soups, three main courses, and four desserts. Your diet restricts you to choosing between a dessert and an appetizer. (You cannot have both.) Given this restriction, how many three-course meals are possible?
A computer byte consists of eight bits, each bit being either a 0 or a 1. Assume that characters are represented using a code that uses a byte for each character.
Some written languages, such as Chinese and Japanese, use tens of thousands of different characters. If a language uses roughly 97,000 characters, a computer code for this language would have to use how many bytes per character?
arrow_forward
This is computer architecture!
PLEASE HELP ME FIX THE CODE AS THERE IS ERROR!
# This program corrects bad data using Hamming codes
# It requests the user to enter a 12-bit Hamming code and determines if it is correct or not
# If correct, it displays a message to that effect. If incorrect, it displays a message
# saying it was incorrect and what the correct data is (the 12-bit Hamming code) again in hex.
# This program is designed to handle single bit errors only.
.data
prompt: .asciiz "Enter a 12-bit Hamming code: "
correct_msg: .asciiz "The Hamming code is correct."
incorrect_msg: .asciiz "The Hamming code is incorrect. The correct code is: "
newline: .asciiz "\n"
.text
.globl main
main:
# Display prompt to enter Hamming code
li $v0, 4
la $a0, prompt
syscall
# Read Hamming code from user
li $v0, 5
syscall
move $t0, $v0
# Calculate parity bits
andi $t1, $t0, 0b1111 # Parity bit p1
andi $t2, $t0, 0b011001100110 # Parity bit p2…
arrow_forward
36
59-
is a sequence of characters
surrounded by double quotes. *
• Constant
• Numeric
• Character
• String
57- What are bitwise operators? *
• &
!
• All above
52- Which one of the following is a
keyword in c++? *
• Size
Кey
>
arrow_forward
What is causing this error
arrow_forward
CCTT211 Assignment:
1. Change the following decimal numbers to 16-bit two’s complement integersa. -1024b. 16384
2. Change the following 8-bit unsigned numbers to decimala. 11010101b. 00101110
3. If we apply the two’s complement operation to a number twice, we should get the original number. Apply the two’s complement operation to each of the following numbers and see if we can get the original number.a. 110011b. 111111114. Normalize the following binary floating-point numbers. Explicitly show the value of the exponent after normalization.a. 0.1011.1 * 26b. 1101.11 * 2-2
5. Convert the following numbers in 32-bit IEEE format.a. 16.25b. -12.75
6. Convert the following decimal integers to sign-and-magnitude with 8-bit allocationa. 45b. -78
7. One method of representing signed numbers in a computer is one’s complement representation. In this representation, to represent a positive number, we store the binary number. To represent a negative number, we apply the one’s comple- ment operation…
arrow_forward
In CRC, bits in divisor are
the CRC
Redundant bits
Select one:
O a. More than
O b. Equal to
c. Less than
O d. None
arrow_forward
Coordinates : A(2,0) B(2,2) C(2,5) D(0,5) E(0,2) F(0,0)
Assume a custom Q6 isoparametric. Compute N, J11, J21, B in
isoparametric format.
(1)
arrow_forward
6 - What decimal number does the bit pattern 0xC3300000 represent if it is:
A two's complement integer?
An unsigned integer?
A floating point number assuming the IEE 754 single precision format
7 - Perform the following calculations assuming that the values are 4-bit decimal integers stored in
two's complement format. Be sure to consider the possibility of overflow.
0110 + 1001
0110 - 1001
8 - For the following operations: write the operands as 2's complement binary numbers then perform
the addition or subtraction operation shown. Show all work in binary operating on 4-bit numbers.
1+2
2-1
1-2
arrow_forward
२चप
The following divider is used to divide 8ten by 2ten:
Divisor
Shift right
64 bits
Quotient
64-bit ALU
Shift left
32 bits
Remainder
Control
Write
test
64 bits
For simplicity, use 4 bits for the
otient and 8 bits for both divisor and remainder.
What will be the initial values of quotient, divisor and remainder?
1000, 0010 0010, 0000 0000
a)
0000, 0010 0000, 0000 1000
b)
c)
0010, 0000 0000, 0000 1000
d)
0000, 0000 0010, 0000 1000
e)
0000, 0010 0000, 1000 0000
f)
0000, 1000 0000, 0010 0000
g)
0000, 0000 1000, 0000 0010
h)
None of the above
What will be the values of quotient, divisor and remainder after the fourth iteration of the division algorithm?(after iteration 4)
a)
0000, 0000 0010, 0000 0010
b)
0001, 0010 0000, 0000 0000
0100, 0000 0100, 0000 0100
c)
0010, 0000 0010, 0000 0000
d)
e)
0000, 00000001, 0000 0000
f)
0001, 0000 0010, 0010 0000
g)
0010, 0000 0100, 0000 0000
h)
None of the above
arrow_forward
1. bitwise operators
Compute the answer of each calculation and report the answer in decimal:
0303 | Ox124 =
Ob11011010 ^ 57 =
-29 & OXFE =
(127 & -OX7F) | 233291 =
arrow_forward
CONVERTING FROM BIG ENDIAN TO LITTLE ENDIAN
Write a program that uses the variables below and MOv instructions to copy the value from bigEndian to littleEndian,
reversing the order of the bytes. The number's 32-bit value is understood to be 12345678 hexadecimal.
.data
bigEndian BYTE 12h,34h, 56h, 78h
littleEndian DWORD?
Hint: Using DumpMem is the best way to show the effect - byte orders "before" and "after"
Sample output:
DumpMem output showing Big Endian Byte Order
Dump of offset 001E6000
12 34 56 78
DumpMem output showing Little Endian Byte Order
Dump of offset 001E6004
78 56 34 12
arrow_forward
EV:
V7:
VS:
MY:
E5:
30:
A4D:
AD9:
A34:
R08:
Provide the description of the following error codes, and
explain how you would reconcile them:
arrow_forward
Q1 PART 1
There are several bitwise operators to help manipulate bits:
· & - Operates on the corresponding bits of two strings of bits. The result is a 1 if both bits were
1, O if not.
•|- Operates on the corresponding bits of two strings of bits. The result is a 1 if either bit was 1,
O if not.
.^ - Operates on the corresponding bits of two strings of bits. The result is a 1 if only one bit was
1, 0 if not.
.» (number) - Operates on one string of bits. Shifts all bits to the right equivalent to the number
provided.
.< (number) - Operates on one string of bits. Shifts all bits to the left equivalent to the number
provided.
.N- Operates on one string of bits. Inverses all of the bits.
Consider variable string1 = Ox12345678 and variable mask = OxC
Fill in the missing value (???) by inputting what it should be in the Solutions boxes adjacent to
the respective Task below. Each Task is distinct so earlier tasks have no bearing on the
following ones (updating string1 will only be for that…
arrow_forward
TMin - 1 (write in decimal representation):
-TMin:
-TMax:
TMAX>
A
arrow_forward
When the result of an operation is negative, the
following flag should be set to one
Select one:
a. Sign flag
b.
Carry flag
c. Zero flag
d.
Parity flag
<
arrow_forward
Which of the following bitwise operations will you use to set a particular bit to 1?a) ORb) ANDc) XORd) NOR
arrow_forward
Q5::
Determine I, V,, V2 , and Vo for this
configuration in figure beside, when E=12V, and E;-8V.
(10) Marks
+ V, -
R
E, o M
4.7 k2
Si
R2 2.2 k2
arrow_forward
10-1010
Express the following bit patterns in hexadecimal notation:
Question 5
10100000101%3D
110001111011=
000010111110
001101010011
To submit your assignment:
Please answer the question on the Lab Document and submit your file throug
arrow_forward
Q1- c) Several ID Automation products support the inclusion of the Application Identifier(Al)
with ASCII 202 in Code 128 auto mode.(ASCII-128 characters).Each Al is represented by 125
characters, calculate:
i. The number of bits required per character.
ii. The number of bits required to represent each Al.
iii. If an additional parity bit is added for error detection purpose to the code of each character.
Modify your answers to parts i) and ii) in view of this.
arrow_forward
ADD CD, [BC+RI] This expression belongs to which addressing mode and how it works b) ADD AD, [SE+OI] This expression belongs to which addressing mode and how it works
arrow_forward
12. Assume that the value is a 8 bit unsigned integer, and that another is XORed with the original value.
What will the new decimal value be after the operation? The first row has been filled in. Be
careful, the devil is in the details.
Value
13
83
250
Operation
e
Operand value
2
5
7
New value
15
arrow_forward
A PLI program has variables U, V, w, X, Y, Z which are
declared as follows:
DCL U BIT(4)
W CHAR(5)
Y CHAR(3)
V FIXED (4,1).
X FLOAT(4),
Z FIXED(3):
The Data Card for the same program contains the following
information: U ='1101'B, V = 981-2;
U='1101'B, V= 123•4, W = '123•4', X= 1052E + 02,
Y= 'PQR', Z=- 249;
a) Show what will be entered into memory storage in the
computer as a result of the statements: GET DATA; followed
a little later in the program by the statement:
GET DATA(Z,V,W,YU,X);
b) In the same program at a later stage, the contents of the
memory locations corresponding to U, V, W, X, Y and Z
were changed to
0100
769.2
144.7
•0129E – 03
BOG
- 47
respectively. Show what will be printed out by the following
statements:
PUT DATA(U,Y);
PUT SKIP DATA(X):
PUT SKIP DATA(W,V,Z);
arrow_forward
Which of the following bitwise operations will you use to set a particular bit to 0?a) ORb) ANDc) XORd) NAND
arrow_forward
Conversion between Binary and Decimal
Write an assembly program converting an 8-bit unsigned binary to its decimal and
converting a positive decimal to its 8-bit binaries. The purpose is to make you
understand the number system concept. Your program should be run like the
following:
arrow_forward
Binary numerals are used to assign each item in a store's inventory a distinct
binary sequence. What is the minimum number of bits required for each binary
sequence if the store has between 75 and 100 items in stock?
arrow_forward
{m, c, q} C {q, c, m}
true or false
arrow_forward
Assignment 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
MIPS help: Iteratively calculate the factorial of n*n*n*n ( ). Assume n is between 0 and -5, How do you write a factorial code for negative numbers in MIPS
arrow_forward
Please write the code in MIPS assembly Language
Create a MIPS program that corrects bad data using Hamming codes. ECC Hamming codes are explained on pages 420-424 in your text.
The program is to request the user to enter a 12-bit Hamming code and determine if it is correct or not. If correct, it is to display a message to that effect. If incorrect, it is to display a message saying it was incorrect and what the correct data is (the 12-bit Hamming code) again in hex. I will be testing only with single bit errors, so the program should be able to correct my tests just fine. You do not need to worry about multiple bit errors.
Make certain that you have lots of comments in your code as this is in MIPS. Also make the code neat: line up the command field, the register fields, and the comment fields
For this assignment, turn in your code, a screenshot showing a working test case
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
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
Related Questions
- ✓ sizeof operator does not work with bitfields. (True/False)arrow_forwardMenus The local diner offers a meal combination consisting of an appetizer, a soup, a main course, and a dessert. There are four appetizers, five soups, three main courses, and four desserts. Your diet restricts you to choosing between a dessert and an appetizer. (You cannot have both.) Given this restriction, how many three-course meals are possible? A computer byte consists of eight bits, each bit being either a 0 or a 1. Assume that characters are represented using a code that uses a byte for each character. Some written languages, such as Chinese and Japanese, use tens of thousands of different characters. If a language uses roughly 97,000 characters, a computer code for this language would have to use how many bytes per character?arrow_forwardThis is computer architecture! PLEASE HELP ME FIX THE CODE AS THERE IS ERROR! # This program corrects bad data using Hamming codes # It requests the user to enter a 12-bit Hamming code and determines if it is correct or not # If correct, it displays a message to that effect. If incorrect, it displays a message # saying it was incorrect and what the correct data is (the 12-bit Hamming code) again in hex. # This program is designed to handle single bit errors only. .data prompt: .asciiz "Enter a 12-bit Hamming code: " correct_msg: .asciiz "The Hamming code is correct." incorrect_msg: .asciiz "The Hamming code is incorrect. The correct code is: " newline: .asciiz "\n" .text .globl main main: # Display prompt to enter Hamming code li $v0, 4 la $a0, prompt syscall # Read Hamming code from user li $v0, 5 syscall move $t0, $v0 # Calculate parity bits andi $t1, $t0, 0b1111 # Parity bit p1 andi $t2, $t0, 0b011001100110 # Parity bit p2…arrow_forward
- 36 59- is a sequence of characters surrounded by double quotes. * • Constant • Numeric • Character • String 57- What are bitwise operators? * • & ! • All above 52- Which one of the following is a keyword in c++? * • Size Кey >arrow_forwardWhat is causing this errorarrow_forwardCCTT211 Assignment: 1. Change the following decimal numbers to 16-bit two’s complement integersa. -1024b. 16384 2. Change the following 8-bit unsigned numbers to decimala. 11010101b. 00101110 3. If we apply the two’s complement operation to a number twice, we should get the original number. Apply the two’s complement operation to each of the following numbers and see if we can get the original number.a. 110011b. 111111114. Normalize the following binary floating-point numbers. Explicitly show the value of the exponent after normalization.a. 0.1011.1 * 26b. 1101.11 * 2-2 5. Convert the following numbers in 32-bit IEEE format.a. 16.25b. -12.75 6. Convert the following decimal integers to sign-and-magnitude with 8-bit allocationa. 45b. -78 7. One method of representing signed numbers in a computer is one’s complement representation. In this representation, to represent a positive number, we store the binary number. To represent a negative number, we apply the one’s comple- ment operation…arrow_forward
- In CRC, bits in divisor are the CRC Redundant bits Select one: O a. More than O b. Equal to c. Less than O d. Nonearrow_forwardCoordinates : A(2,0) B(2,2) C(2,5) D(0,5) E(0,2) F(0,0) Assume a custom Q6 isoparametric. Compute N, J11, J21, B in isoparametric format. (1)arrow_forward6 - What decimal number does the bit pattern 0xC3300000 represent if it is: A two's complement integer? An unsigned integer? A floating point number assuming the IEE 754 single precision format 7 - Perform the following calculations assuming that the values are 4-bit decimal integers stored in two's complement format. Be sure to consider the possibility of overflow. 0110 + 1001 0110 - 1001 8 - For the following operations: write the operands as 2's complement binary numbers then perform the addition or subtraction operation shown. Show all work in binary operating on 4-bit numbers. 1+2 2-1 1-2arrow_forward
- २चप The following divider is used to divide 8ten by 2ten: Divisor Shift right 64 bits Quotient 64-bit ALU Shift left 32 bits Remainder Control Write test 64 bits For simplicity, use 4 bits for the otient and 8 bits for both divisor and remainder. What will be the initial values of quotient, divisor and remainder? 1000, 0010 0010, 0000 0000 a) 0000, 0010 0000, 0000 1000 b) c) 0010, 0000 0000, 0000 1000 d) 0000, 0000 0010, 0000 1000 e) 0000, 0010 0000, 1000 0000 f) 0000, 1000 0000, 0010 0000 g) 0000, 0000 1000, 0000 0010 h) None of the above What will be the values of quotient, divisor and remainder after the fourth iteration of the division algorithm?(after iteration 4) a) 0000, 0000 0010, 0000 0010 b) 0001, 0010 0000, 0000 0000 0100, 0000 0100, 0000 0100 c) 0010, 0000 0010, 0000 0000 d) e) 0000, 00000001, 0000 0000 f) 0001, 0000 0010, 0010 0000 g) 0010, 0000 0100, 0000 0000 h) None of the abovearrow_forward1. bitwise operators Compute the answer of each calculation and report the answer in decimal: 0303 | Ox124 = Ob11011010 ^ 57 = -29 & OXFE = (127 & -OX7F) | 233291 =arrow_forwardCONVERTING FROM BIG ENDIAN TO LITTLE ENDIAN Write a program that uses the variables below and MOv instructions to copy the value from bigEndian to littleEndian, reversing the order of the bytes. The number's 32-bit value is understood to be 12345678 hexadecimal. .data bigEndian BYTE 12h,34h, 56h, 78h littleEndian DWORD? Hint: Using DumpMem is the best way to show the effect - byte orders "before" and "after" Sample output: DumpMem output showing Big Endian Byte Order Dump of offset 001E6000 12 34 56 78 DumpMem output showing Little Endian Byte Order Dump of offset 001E6004 78 56 34 12arrow_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