Diagrams for a Multiplexer in PNG and ASCII Art

4-to-1 multiplexer

Data Lines (Input) are denoted as x1…x4, select line are denoted as s1 and s2, Output is denoted as f

Alternative Diagram in ASCII :

        _______________________
       |        4-to-1         |
D0 ----|      Multiplexer      |
       |                       |
D1 ----|                       |---> Output
       |                       |
D2 ----|                       |
       |                       |
D3 ----|_______________________|
              |         |
              |         |
              |         |
              |         |
              S1        S0
Data Lines (Input) are denoted as D0...D3, select line are denoted as S0 and S1.

© 2023  Vedesh Kungebeharry. All rights reserved. 

2013 U1 Q1

  1. Part a) i)
  2. Part a) ii)
  3. Part a) iii)
  4. Part b) i)
  5. Part b) ii)
  6. Part b) iii)
  7. Part c)
  8. Part d) i)
  9. Part d) ii)
  10. Part d) iii)

Part a) i)

        _______________________
       |        4-to-1         |
D0 ----|      Multiplexer      |
       |                       |
D1 ----|                       |---> Output
       |                       |
D2 ----|                       |
       |                       |
D3 ----|_______________________|
              |         |
              |         |
              |         |
              |         |
              S1        S0


Part a) ii)

Set the select inputlines to 01 to select the 2nd line, and when input from the 4th line is needed after 1 second (i.e i3), set the select input lines to 11

Part a) iii)

– It always exists in 1 of 2 stable states.
-It can retain its state to achieve storage (in the case the set goes from 1 to 0)

Can be used in RAM Arrays (to implement 1 bit storage) or to Implement a Ripple Counter

Part b) i)


1101

(First bit is 1 for to represent a negative value,

working for 510 to binary :

       2 | 

       2 |2  remainder 1

       2 |1  remainder 0 

            0  remainder 1

i.e 510  = 1012

combining the result we get 11012

)

Part b) ii)


1010 (flipped bits of 0101)

Part b) iii)

1010 +1 = 1011

Part c)

(Show binary-decimal conversions)

For an unbiased exponent and unnormalized mantissa:

sign is -ve, Exponent = 2, Mantissa= 0101

i.e -0.0101 x 2­2 = -1.01

-1.012   =  (-1 x 20)+ (0 x 2-1)+ (1 x 2-2)

          = -1 + 0+ ¼

          = -1.25

Part d) i)


Not (Unary operator)

xNot X
01
10

Part d) ii)

AND

xYX AND Y
000
010
100
111

Part d) iii)

OR

xyX OR Y
000
011
101
111

© 2023  Vedesh Kungebeharry. All rights reserved. 

Simple Sorting, Subsorting Tutorial.

Step 1: Create Sample Data

First, we will create a sample dataset. We have a list of students with their names, grades, and scores.

Step 2: Enter Data in Excel

Open Excel and enter the following sample data into a new worksheet:

NameGradeScore
John SmithA99
Jane DoeA92
Mike BrownB88
Lisa RayA95
Tom HanksA98
Rita OraC55
Gary OldB82
Tina FeyC55

Step 3: Sorting Data

To sort the data:

  1. Click on any cell in the column you want to sort by (e.g., Grade).
  2. Go to the Data tab on the Excel ribbon.
  3. Click on Sort A to Z (ascending order) or Sort Z to A (descending order).

Step 4: Subsorting (Multi-level Sorting)

Subsort the data by Grade, then by Score, and finally by Name:

  1. Select any cell in the data range.
  2. Go to the Data tab on the Excel ribbon.
  3. Click on the Sort button to open the Sort dialog box.
  4. For the first level, choose Grade from the Sort by dropdown, select Values in the Sort On dropdown, and choose A to Z for the order.
  5. Click Add Level to add a second sort condition.
  6. For the second level, choose Score from the Then by dropdown, select Values in the Sort On dropdown, and choose  Largest to Smallest for the order.
  7. Click Add Level again to add a third sort condition.
  8. For the third level, choose Name from the Then by dropdown, select Values in the Sort On dropdown, and choose A to Z for the order.
  9. Click OK to apply the multi-level sort to your data.

Step 5: Review Sorted Data

What happens when 1 student has the same grade and score as another?

Sample Data

Download a file containing the sample data here:

https://drive.google.com/drive/folders/1JXTLenz8FvsX9GijfMCKkGCzQfnrlkS5?usp=drive_link

Updates to this post

2023/11/17 – Changed values for score to make the example more reasonable.

© 2023  Vedesh Kungebeharry. All rights reserved. 

Simple Chart Exercise / Tutorial (With Solution)

Simple Chart Exercise Tutorial (With Solution)

Task:

Create a bar chart which compares the income, expenses, and profit for the first four months of the year.

Setup a table as shown below with values of your choosing create the chart:

IncomeExpensesProfit
Jan
Feb
Mar
Apr

Tutorial (TA-Note)

Creating the Table:

  1. Open Excel.
  2. Click on “Cell A1” and type “Month”.
  3. Starting from “Cell A2” downwards, type the months: Jan, Feb, Mar, and Apr.
  4. Click on “Cell B1” and type “Income”. Similarly, fill in “Cell C1” with “Expenses” and “Cell D1” with “Profit”.
  5. You now have your table headings ready. You can enter your data in the cells below each heading.

Creating the Bar Chart:

  1. Select the Data: Click and drag to select the cells from A1 through D5 (assuming you have data entered till the April row).
  2. Insert a Bar Chart:
    • Go to the “Insert” tab in the Excel ribbon.
    • In the “Charts” group, click on the “Column or Bar Chart” icon (it looks like a column/bar chart).
    • A drop-down menu will appear. Choose the first option under “Clustered Bar” or any other bar chart type you prefer.
  3. Adjusting the Chart (Optional):
    • Click on the chart. This will reveal three new tabs in the ribbon: “Chart Design,” “Format,” and a third contextual tab related to the type of chart.
    • Use the “Chart Design” tab to quickly adjust the chart’s layout, style, and other elements.
    • Use the “Format” tab to refine the chart’s appearance further.
  4. Title & Labels:
    • By default, Excel might add a title, axis labels, and a legend. You can click on these elements to edit them.
    • To add labels or other elements, right-click on the chart and select the desired option from the context menu.
  5. Once satisfied with the appearance and data representation of the chart, you can save your Excel sheet.

Solution

See the attached excel file:

https://drive.google.com/drive/folders/1r78T3OnNbjDJoIxOdBOXtmkAGUboqRlT?usp=sharing

© 2023  Vedesh Kungebeharry. All rights reserved. 

Exercise: Stack and Queue implemented by a linked list.

Assuming an algorithmic linked list with the following behaviour:

addFirst(element data)

addLast(element data)

element removeFirst()

element removeLast()

boolean isEmpty()

  1. Write algorithms to implement a stack using the functions alone,
    • push (element data)
    • element pop ()
    • element peek() (Hint: get the data out then put it back in)

  2. Write algorithms to implement a Queue using the functions alone,
    • enqueue (element data) //add
    • element dequeue () //remove

© 2023  Vedesh Kungebeharry. All rights reserved.