0% found this document useful (0 votes)
36 views2 pages

Alp Worksheet

This document outlines 8 problems to be solved as part of an Assembly Language Programming lab. The problems include: 1) Creating a decimal to binary, octal, and hexadecimal converter. 2) Implementing logical operations like AND, OR, XOR, and NAND on binary strings. 3) Implementing shift and rotate operations on binary numbers. 4) Printing negative numbers in signed magnitude, one's complement, and two's complement representations. 5) Performing addition and subtraction on two's complement binary numbers. 6) Writing a function to set bits in one number based on another number. 7) Writing a program to print the last n lines of input. 8) Generating random floating point numbers between given ranges with a set seed

Uploaded by

Deepan .N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Alp Worksheet

This document outlines 8 problems to be solved as part of an Assembly Language Programming lab. The problems include: 1) Creating a decimal to binary, octal, and hexadecimal converter. 2) Implementing logical operations like AND, OR, XOR, and NAND on binary strings. 3) Implementing shift and rotate operations on binary numbers. 4) Printing negative numbers in signed magnitude, one's complement, and two's complement representations. 5) Performing addition and subtraction on two's complement binary numbers. 6) Writing a function to set bits in one number based on another number. 7) Writing a program to print the last n lines of input. 8) Generating random floating point numbers between given ranges with a set seed

Uploaded by

Deepan .N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DEPARTMENT OF APPLIED MATHEMATICS AND COMPUTATIONAL SCIENCES

MSc Theoretical Computer Science- (III Sem 2019-20)


18XT38 – Assembly Language Programming Lab
Problem Sheet 1

1. Create a menu driven program to accept a decimal number as input and convert it into equivalent
binary, octal and Hexadecimal
2. Implement the following logical operations using C/C++ language. The inputs and the observed
output should be a string of binary digits.
 AND, OR, XOR, NAND
3. Implement the following Shift /Rotate operations using C/C++ language.( Use Functions)
 SHIFT LEFT, SHIFT RIGHT by specified no. of positions.
 Circular Shift (ROTATE) by specified no. of positions.
4. Write a function that prints a negative number in the following formats:
 Signed magnitude data representation
 One’s complement integer data representation
 Two’s complement integer data representation
5. Perform the following arithmetic operations using 2’s Complement notation: Take two 8 bit binary
numbers( MSB as sign bit) as input A and B
 (+A) + ( +B),
 (+A) + ( -B)
 (-A) + ( +B)
 (-A) + ( -B )
 (+A) - ( +B)
 (+A) - ( -B)
 (-A) - ( +B)
 (-A) - ( -B )

6. Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the
rightmost n bits of an unsigned char variable y (leaving other bits unchanged).

e.g. if x = 10101010 (170 decimal) and y = 10100111 (167 decimal) and n = 3 and p = 6 say then
you need to remove off 3 bits of y (111) and put them in x at position 10xxx010 to get answer
10111010.
Your answer should print out the result in binary form although input can be in decimal form. Your
output should be as follows:
x = 10101010 (binary)
y = 10100111 (binary)
setbits n = 3, p = 6 gives x = 10111010 (binary)

7. Write a program last that prints the last n lines of its text input. By default n should be 5, but your
program should allow an optional argument so that
last -n

prints out the last n lines, where n is any integer. Your program should make the best use of available
storage. (Input of text could be by reading a file specified from the command or reading a file from
standard input)

8. Write a C program to produce a series of floating point random numbers in the ranges (a) 0.0 - 1.0
(b) 0.0 - n where n is any floating point value. The seed should be set so that a unique sequence is
guaranteed.

You might also like