You are on page 1of 36

CMPF 134 FUNDAMENTAL S OF DATA AND INFORMATION

Assignment 2

By, Tony Kennedy Anthonysamy Ryan Daniel Saravanan Abiza Rafiq

LIST OF QUESTION
Question 1 ----- Logic Gate

Question 2 ----- Binary Subtraction (2s Complement)

Question 3 ----- Data Compression

QUESTION 1
Given an expression; Y =(AB + BC). (AB + CD).

Answer all the questions below by referring to this equation

QUESTION 1(I)
Y = (AB + BC) . (AB + CD)
Y = (0.(1)) + (1.(1)) . [((0).1) + (1.0)] Y = [(0.0) + (1.0)] . [(1.1) + (1.0)] Y = (0 + 0) . (1 + 0) Y = (0) . (1)' Y = (0.0) Y=0

What is the value of Y A=0 B=1 C=1 D=0

QUESTION 1(II)

Generate the truth table to list out all possible combinations for the expression given above. Y = (AB + BC) . (AB + CD)

INPUT A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 B 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 A' 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 B' 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

OUTPUT

C' AB' BC' A'B CD Y = (AB' + BC') . (A'B + CD)' 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0

QUESTION 1(III)
Sketch out the logic gate symbol for this equation. Y = (AB + BC) . (AB + CD)

QUESTION 2
Perform binary subtraction in eight bits of 2s complement system for -7610 with -351o by listing out all the working steps clearly.

QUESTION 2

QUESTION 2

QUESTION 2

QUESTION 3(I)

Explain in detail about Data Compression. Identify TWO main techniques applied in data compression and explained them in detail.

QUESTION 3(I)

Data compression method

Lossless method (Text or programs)

Lossy method (Image, video or audio)

Run-length

Huffman

Lempel Ziv

JPEG

MPEG

MP3

QUESTION 3(I)
Run-length encoding is probably the simplest method of compression. It can be used to compress data made of any combination of symbols.

Source: Internet (Google Image)

QUESTION 3(I)
Huffman coding assigns shorter codes to symbols that occur more frequently and longer codes to those that occur less frequently.

Table 1

QUESTION 3(I)

QUESTION 3(I)
Note :
It does not matter how the characters are arranged. I have arranged it above so that the final code tree looks nice and neat. It does not matter how the final code tree are labelled (with 0s and 1s). I chose to label the upper branches with 0s and the lower branches with 1s. Huffman codes are not unique.

QUESTION 3(I)
Lempel Ziv (LZ) encoding is an example of a category of algorithms called dictionary-based encoding. The idea is to create a dictionary (table) of strings used during the communication session.
Steps :
1. Initialize the dictionary to contain all blocks of length one (D={a,b}). 2. Search for the longest block D which has appeared in the dictionary. 3. Encode D by its index in the dictionary. 4. Add D followed by the first symbol of the next block to the dictionary.

QUESTION 3(I)

QUESTION 3(I)
There are three major types of lossy data compression technique. They are as follows: Lossy transform codecs Lossy predictive codecs Chroma subsampling

QUESTION 3(I)
Lossy transfrom codecs Generally used for JPEG images only. The picture is taken, they are then chopped into smaller segments. Then transformed into a new image. The resulted image has fewer colours than its original.

QUESTION 3(I)
Lossy predictive codecs

In predictive codecs, previous and/or subsequent decoded data is used to predict the compressed image frame.

QUESTION 3(I)
Chroma subsampling Its takes into account that the human eye perceives changes in brightness more sharply than changes of colour. Takes advantage of it by dropping or averaging some chroma information. While maintaining luma information.

QUESTION 3(II)

Explain in detail any FIVE data types that you have studied.

QUESTION 3(II)
Type 1: Integer data The integer data kind basically represents complete numbers and the value jumps from one value to another. Integers are embodied in a computer as a group of binary digits.

QUESTION 3(II)

QUESTION 3(II)
Type 2: Boolean data Boolean is a data kind that has two benefits that are true or false kinds of data. A Boolean table column will encompass whichever thread benefits of "True" and "False" or the numeric equivalent representation, alongside 0 being false and 1 being true.

QUESTION 3(II)

QUESTION 3(II)
Type 3: Character data

A character is any space, number, punctuation mark, letter, or symbol that can be typed on a computer.

QUESTION 3(II)

QUESTION 3(II)
Type 4: Floating point number data
As the term implies, floating point numbers are numbers that encompass floating decimal points.

QUESTION 3(II)

QUESTION 3(II)
Type 5: Alphanumeric data

A string is a data type utilized in software design, such as an integer and floating point, but is utilized to embody text rather than numbers

QUESTION 3(II)