Computer Architecture: Question No 01

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Computer Architecture

Question No 01
Solve the equation and draw the circuit by using Karnagh;s Map.
F (x,y,z) = (1, 2, 3, 6, 7)
DATA STRUCTURES
Question No 02:
Write an Algorithm to sort an array named MARKS, of 10 students using selection sort?
Answer:
//Total number of students
Const int totalStudents = 10;
Int MARKS[totalStudents] = {10,05,50,40,30,70,12,88,45,51};

// Now we loop through the array
For ( int I = 0; I < totalStudents; i++)
{
// Let the least marks is the first index
Int leastMarks = i;
// Now we compare least marks with the each next element in the array
For ( int a = i + 1; a <totalStudents; a++)
{
//Check if the selected index is smaller than the previous one
If( MARKS[a] < MARKS[leastMarks])
leastMarks = a;
}
// its time to swap the elements
Swap( MARKS[i], MARKS[leastMarks]);
}





Question No 03:
Write an algorithm to pop an item from the STACK named STACK.
Question No 04:
Convert the following expressions written in the infix notation to postfix notation.
Show all the steps performed.
a) 5* (6+2) -12 / 4
b) ( A + B ) ^ D) / (E F) + G
Question No 05:
Evaluate the following postfix expressions. Show all steps performed.
a) 5, 8, 2 + , *, 12, 4, /, -
b) 12, 7, 2, -, /, 2. 1, 5, +, *, +

You might also like