0% found this document useful (0 votes)
29 views

Coal Assignment Questions

assignment

Uploaded by

shumaila alam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Coal Assignment Questions

assignment

Uploaded by

shumaila alam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

FAZAIA BILQUIS COLLEGE OF EDUCATION FOR WOMEN

PAF Nur Khan, Rawalpindi


Assignment , FALL 2022
Subject: COAL Teacher Name: Shumaila Alam Class: BSCS
Course Code: CS-223 Semester: 3 Assig No: 3
Student Name: Roll No: Section: A,B
Date:

Exercise: 7
LOGIC, SHIFT AND ROTATE INSTRUCTIONS:

Question: 1
Perform the following logic operations
a. 10101111 AND 10001011
b. 10110001 0R 01001001
c. 01111100 XOR 11011010
d. NOT 01011110

Question: 2
Give a Logic instruction to do each of the following.
a. Clear the even-numbered bits of AX, leaving the other bits unchanged.
b. Set the most and least significant bits of BL, leaving the other bits
unchanged.
c. Complement the MSB of DX, leaving the other bits unchanged.
d. Replace the value of the word variable WORD 1 by its one's
complement.

Question: 3
Use the TEST instruction to do each of the following:
a. Set ZF if the content of AX is zero.
b. Clear ZF If BX contains an odd number.
c. Set SF if DX contains a negative number.
d. Set ZF if DX contains a zero or positive number.
e. Set PF if BL contains an even number of 1 bit.
Question: 4
Suppose AL contains 1100101lb and CF= l. Give the new contents. of AL
after each of the following instructions is executed. Assume the preceding
initial conditions for each part of this question.
a. SHL AL,1
b. SHR AL,1
c. ROL AL,CL if CL contains 2
d. ROR AL,CL if CL contains 3
e. SAR AL,CL if CL contains 2
Question: 5
Write one or more Instructions to do each of the following.
Assume overflow does not occur.
a. Double the value of byte variable BS.
b. Multiply the value of AL by 8.
c. Divide 32142 by 4 and put the quotient In AX.
d. Divide -2145 by 16 and put the quotient in BX.

Question: 6
Write instructions to do each of the following:
a. Assuming AL has a value less than 10, convert It to a decimal
character.
b. Assuming DL contains the ASCII code of an uppercase letter, convert It
to lower.

Question: 7
Write instructions to do each of the following.
a. Multiply the value of BL by l0d. Assume overflow does not occur.
b. Suppose AL contains a positive number. Divide AL by 8, and put the
remainder in AH. (Hint: use ROR.)

Question: 8
Write a program that prompts the user to enter a character, and on
subsequent lines prints its ASCII code in binary, and the number of 1 bits In
Its ASCII code.
Sample execution:
TYPE A CHARACTER: A
THE ASCII CODE OF A IN BINARY IS 01000001
THE NUMBER OF l BITS IS 2

You might also like