Computer Organization and Assemble Language Lab
Assignment 2
Submission Deadline: Oct 21th, 2024 11:55AM
Total Marks: 135
Question 1: Write an assembly program to count the total number of digits in a string. [10 marks]
Question 2: Convert the following C++ code into assembly language. [10 marks]
int t=1,
k=2;
while(t!=11)
cout<<k*t<<endl;
t=t+1;
}
Question 3: [10 marks]
Write an assembly program that take a string input from user and ask user for a specific character to be
searched for. Display the count of that character in a string.
Question 4: [15 marks]
Write an assembly language program to make a CV of your personal information and save that in
memory. Paste the screenshots of all the entries that you save in memory. The better the CV, the more
marks you get
Question 5: [10 marks]
Write an assembly program to reverse an integer number. Your program should also find the sum of
digits in that integer number. Store sum and reverse number in a separate variable. For Example, if the
number is 1234, its reverse will be 4321 and sum=10
Question 6: [15 marks]
Write a program that displays the following output:
Question 7: [20 marks]
Input a list of Strings e.g ['Ali', 'Usman', 'Abdullah'] You have to sort them in ascending order. (Take Input
a size of the array)
To decide which string is greater use the following algorithm. Multiply the ASCII of each character with
its index and add them. The string with a higher value would be greater.
Question 8: [10 marks]
Write an assembly code that store the most frequently occurring element of an array in a variable. For
Example, if an array is [1, 2, 3, 1, 4, 2, 2], your method should return 2.
Question 9: [20 marks]
Implement the following C++ code into assembly language.
Question 10: [15 marks]
Write a program that finds out whether there is a given character in a string. If the character is present
in the string, display a proper message along with the index of that character. If the character occurs at
multiple positions, display the index of first occurrence.
Example:
Enter string: I am a programmer.
Character: a
Output: a occurs in the string at index 2.
Best of Luck