0% found this document useful (0 votes)
7 views163 pages

File Organization Techniques in Computing

The document discusses file organization and access methods in computer science, detailing three types: Serial, Sequential, and Random file organization. It explains how data is stored and accessed in each method, including examples and scenarios for their use, as well as addressing collision handling in random file organization. Additionally, it covers floating point representation, including the mantissa and exponent, and provides steps for converting positive and negative decimal numbers into binary format.

Uploaded by

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

File Organization Techniques in Computing

The document discusses file organization and access methods in computer science, detailing three types: Serial, Sequential, and Random file organization. It explains how data is stored and accessed in each method, including examples and scenarios for their use, as well as addressing collision handling in random file organization. Additionally, it covers floating point representation, including the mantissa and exponent, and provides steps for converting positive and negative decimal numbers into binary format.

Uploaded by

faza72350
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

File Organization

And Access

COMPUTER SCIENCE 9618 PAPER 3


File Organization And Access
Refers to the way data is stored and accessed in a file

We have three different types of File Organization

Serial Sequential Random

Serial File Organization

Taha Bano Pappan Baby Baji Shabnum

2:00 3:00 4:00 5:00 6:00

Describe Serial File Organization

Data is stored in chronological order


( Arranged in order of time)
Data is added at the end of the life which also makes
easier to add / append the data in a file
Allows the data to be read in order they are taken
No key fields need to be used.
When will we use Serial File Organization

Chronological order does matter


Easier to append at the end of the file
Reorganization and resorting is not required
Small file so easy to search

Exam Style Question


Sequential File Organization
Sequential file organization stores records in a specific,
ordered sequence, typically based on a key field like a
customer ID or a date or alphabetical order

Sequential file organization is like a


library shelf where books are
arranged in alphabetical order by
the author's last name. If you're
looking for a book by a specific
author, you can go directly to the
section of the shelf where books by
that author would be, making it
quicker to find what you need
compared to a random stack of
books.

Describe Sequential File Organization

Data is stored one after another and need to be accessed


one after another
Sequential files are stored with ordered records and
stored in the order of the key field
In sequential files new records are inserted in the correct
position
Where will we use sequential file organization ?

Unique field ( So can be used as index )


Sorted in a pre decided order

Difference between serial and


sequential file organization

Serial file organization is like a stack of receipts you throw


into a drawer as you receive them. There's no particular
order, so if you want to find a specific receipt, you have to
look through each one until you find it.

Sequential file organization is like a library shelf where books


are arranged in alphabetical order

Note : The above can be used as example while writing your


answer but you have to add description of each aswell.

Note : Above is the right answer but make sure to add the
examples as well while writing.
Random File Organization

Random (or direct) file organization stores records in any


order but provides a direct access method to retrieve them.
Each record is associated with a unique key or identifier, and
the system uses a Hashing Algorithm or some direct access
method to determine the exact location of the record on the
storage device.

Hashing Algorithm : Is basically a mathematical function or


steps to find a unique key knows as hash to access data.

We have various hashing algorithms and some of them are


Folding, Truncation and Modular Division
Modular Division
Hash Key = Data MOD table size

8
Data
5 42
40

2
Hash Key

Exam Style Question


Memory
Index Data

2136

2137

2138

Memory consist of two things location index and data on


that location. Location is what we get by the hashing
algorithm and we place the data on that location.

Collision In Hashing
Index Data

2136

2137

2138

What is meant by collision ?

A collision is when the two values in the key filed for two
records pass through a hashing algorithm and result in
the same hash value
So the location identified by the hashing algorithm may
already be in use and the two records cannot occupy the
same address
Methods To Deal With Collision
1) Linear Probing

Imagine you are placing books on a bookshelf. Each book has


a designated spot. However, if that spot is already occupied
by another book, you simply move to the next available spot
on the shelf and place your book there.

Index Data

2136

2137

2138

A process of collision resolution is used


start at the original hashed storage space
go through the following spaces in a linear fashion
and store the data item in the first available slot

Process Of Finding The Record If Linear Probing Is Used

If collision is identified search linearly from where you


are (closed hash) until the matching record key is found
if not found record is not in the file
2) Overflow Area

Consider the bookshelf again, but this time, if the spot is


taken, you place the book in a separate, overflow section of
the bookshelf. You then continue checking the overflow
section in a linear fashion until you find an empty spot.

Index Data Index Data

2136 3000

2137 3001

2138 3002

Search the overflow area


go through the following spaces in a linear fashion
and store the data item in the first available slot

Process Of Finding The Record If Overflow Area Is Used

If collision is identified then search the overflow area


linearly (open hash) until the matching record key is
found
if not found record is not in the file
3) Chaining

If a spot on the shelf is occupied, instead of moving the


book, you attach it to the existing book with a clip. This
creates a chain of books at that spot

Index Data

2136

2137

2138

Each storage space holds a reference to a chain of items


which can be searched individually
The data item is stored in the first available space in this chain

Process Of Finding The Record If Chaining Is Used

If collision is identified then search the data by linearly


searching in the chain.
if not found record is not in the file

Closed Hash And Open Hash


In closed hashing, all elements are stored within the hash
table itself. (Linear Probing)

In open hashing, collisions are handled by storing the


elements outside the hash table (Overflow and Chaining)
Describe Random File Organization

Record location is calculated


Using a hashing algorithm on a key field
Records are stored in no particular order within the file
If a record can not be stored due to collision
Then subsequent location is searched known as closed
hash
or an overflow area is searched known as open hash
updates to the file can be carried out directly

Sequential Access And Direct Access

Sequential Access : Imagine you’re looking for a specific


book in a library, but the books are arranged in a long row
without any clear order, like a line of books stacked one after
the other. To find the book you need, you would have to
start at the beginning and check each book in sequence until
you find the one you're looking for. This is how sequential
access works

Direct Access : Imagine having a personal locker at a gym.


Each locker has a unique number, and you have a key that
corresponds exactly to your locker. When you want to
retrieve something from your locker, you don’t need to
search through all the other lockers one by one. Instead, you
can go directly to your specific locker
Outline the process of sequential access

Starts at the beginning of the file and earliest reading is


accessed first
checks records linearly and each successive reading is
read
until the desired record is found or end of the file is
reached.

Outline the process of Random Access

Generate a hash key using a hashing algorithm


Calculate the exact record location in the random access
file using the hash value.
Directly access the record determined by the hash value.
Retrieve the desired record directly without scanning
through other records.
File Organization And Access

Question 1

Question 2

Sir Taha Ali Papersdock +92 318 2248934


Question 3

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 4

Sir Taha Ali Papersdock +92 318 2248934


Question 5

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 6

Question 7

Sir Taha Ali Papersdock +92 318 2248934


Question 8

Question 9

Sir Taha Ali Papersdock +92 318 2248934


Question 10

Sir Taha Ali Papersdock +92 318 2248934


Question 11

Sir Taha Ali Papersdock +92 318 2248934


Question 12

Sir Taha Ali Papersdock +92 318 2248934


Answer
Answer 1

Answer 2

Sir Taha Ali Papersdock +92 318 2248934


Answer 3

Sir Taha Ali Papersdock +92 318 2248934


Answer 4

Answer 5

Sir Taha Ali Papersdock +92 318 2248934


Answer 6

Answer 7

Sir Taha Ali Papersdock +92 318 2248934


Answer 8

Answer 9

Sir Taha Ali Papersdock +92 318 2248934


Answer 10

Answer 11

Answer 12

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
FLOATING POINT
REPRESENTATION

COMPUTER SCIENCE 9618 PAPER 3


FLOATING POINT REPRESENTATION
Floating point representation is a method used in
computers to represent real numbers

14.25 15.75 192.3125 -14.625

Mantissa And Exponent

In Math we use decimal numbers and if we need to


write a very large or very small number we use the
concept of Exponents.

For Example :
3.45 x 10 ^ 12

In the example above 3.45 is the Mantissa and 12 is


the exponent with base 10 as the base for Decimal
numbers is 10.

Mantissa : The Most Significant Digit Of FPN

Exponent : Power and because we are dealing with


binary numbers so the base will be 2.
Note : We will be using a memorized list which will
help us in solving the Questions.

(You are suppose to memorize it properly)

128 64 32 16 8 4 2 1 1/2 1/4 1/8 1/16 1/32

0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

Each bit in a binary number represent a decimal


value which helps in conversion of decimal number
to binary numbers. Each bit represents an increasing
power of 2 starting from the rightmost bit.

Question Example For Reference

There will be certain things which will be given in


your Question. (No of bit for Mantissa and Exponent)
Case 1 : Positive Decimal Number To Binary
Conversion
Question : You have 12 bits for Mantissa and 4 bits for
Exponent. Represent 14.75 in Floating Point
Representation

Step 1 : Write down the memorized list

0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

Step 2 : Put 1 on numbers which will be added to fulfil


Question Requirement

1 1 1 0 1 1

0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

1 1 1 0 1 1
This representation is known as Fixed Point Representation

Step 3 : Move the decimal place all the way to the left
and write the exponent value.

1 1 1 0 1 1

0 1 1 1 0 1 1
As we moved the decimal 4 places to the left the exponent
value will be 4. If we move the decimal to left exponent
increases and if we move exponent to the right the
exponent decreases
Step 4 : Ignore decimal point and convert the exponent into
binary form

0 1 1 1 0 1 1

0 1 1 1 0 1 1

The value of Exponent is 4 so in binary format it will be


represented as 0100

0 1 0 0

128 64 32 16 8 4 2 1

Now in this stage we have the mantissa value and the


exponent value

0 1 1 1 0 1 1 X 2 ^4

As we know that the decimal will always be in between the


first two binary bits and we also know that the base will
always be 2 for binary numbers so we don’t write the base
value and the decimal number in our final answer.

0 1 1 1 0 1 1 0 1 0 0
Mantissa Exponent
Step 5 : Store them in given spaces

Note : Always store Mantissa from Left Side and Always store
exponent from Right Side and the empty boxes will be 0

0 1 1 1 0 1 1 0 1 0 0
Mantissa Exponent

Mantissa Exponent
0 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

Exam Style Question


Case 2 : Negative Decimal Number To Binary
Conversion
Question : You have 12 bits for Mantissa and 4 bits for
Exponent. Represent -14.75 in Floating Point Representation

Step 1 : Ignore Negative sign and follow the steps of case 1


till step 4.

1 1 1 0 1 1

0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

0 1 1 1 0 1 1 0 1 0 0
Mantissa Exponent

Step 2 : Exponent would remain same and apply two’s


compliment method on mantissa only and store it.

Two’s Compliment

Two's complement is a mathematical operation on


binary numbers, and it is the most common method
of representing signed integers in computers.

Steps to Find Two's Complement


1. Invert All Bits: Change all 0s to 1s and all 1s to 0s.
2. Add One: Add 1 to the inverted binary number.
0 1 1 1 0 1 1 0 1 0 0
Mantissa Exponent

0 1 1 1 0 1 1

One’s Compliment 1 0 0 0 1 0 0

Two’s Compliment 1
1 0 0 0 1 0 1

Binary Addition

Addition Sum Carry


0+0 0 0

0+1 1 0

1+0 1 0

1+1 0 1

1+1+1 1 1
1 0 0 0 1 0 1 0 1 0 0
Mantissa Exponent

Mantissa Exponent
1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0

Exam Style Question


Case 3 : Positive Binary Number to Denary

Note : You are just suppose to reverse the steps from case 1.

Calculate the exponent value and move the decimal to the


original position and use the memorized list to find the
denary value.

Mantissa Exponent
0 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

Exponent
0 1 0 0 = 4
8 4 2 1

Mantissa
0 1 1 1 0 1 1 0 0 0 0 0

1 1 1 0 1 1

0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

So after adding all the values with 1 we will get 14.75


Exam Style Question
Case 4 : Negative Binary Number to Denary

Note : You are just suppose to reverse the steps from case 2.

Calculate the exponent value and first apply two’s


compliment on mantissa and then move the decimal
according to the exponent value and then use the
memorized list to find the denary value.

Mantissa Exponent
1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0

Mantissa
1 0 0 0 1 0 1
One’s Compliment 0 1 0 1 0 1 0
Two’s Compliment 1

0 1 1 1 0 1 1

0 1 1 1 0 1 1

1 1 1 0 1 1

0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

So after adding all the values with 1 we will get 14.75 and
as it was a negative number so the answer will be -14.75
Exam Style Question
Case 5 : Negative Exponent Binary Conversion

Mantissa Exponent
1 0 1 1 0 0 0 0 1 1 1 0

In this question see that both mantissa and exponent are


negative as they both are starting with 1. So we need to
apply two’s compliment on both and then calculate.

Two’s Compliment

Exponent
1 1 1 0

Exponent
1 1 1 0
1 So the exponent would be -2
0 0 0 1
1
0 0 1 0
Mantissa
1 0 1 1 0 0 0 0

Mantissa
1 0 1 1 0 0 0 0
1 1 1 1
0 1 0 0 1 1 1 1
1
0 1 0 1 0 0 0 0

Mantissa Exponent
0 1 0 1 0 0 0 0 -2

0 0 0 1 0 1
0.06 0.03
128 64 32 16 8 4 2 1 0.5 0.25 0.125
25 125

So after moving the decimal two places to the left as the


exponent was negative we 0.00101 and when we add the
values with 1 we get 0.15625
Normalization
Normalization is a technique that is used to make
your data more accurate.

0.1 Represents positive number


1.0 Represents negative number

How will we figure out that a binary representation is normalized

First and second bit should never be same


Mantissa Exponent
0 0 1 1 0 1 1 1 0 1 0 1

0.356 x 10 ^6

If you need to make this in standard form


then you would have to use one power from
the exponent and the final answer would be
3.56 x 10^5. You are suppose to use the same
technique to normalize Floating Point
Representation.
Exam Style Question
What problems could occur if the binary representation
is not normalized ?

Multiple representation of single number


Precision lost
Redundant leading zeros in mantissa

What are the problems in floating point representation ?

0.2 / 0.1 / 0.4 These numbers can not be exactly


represented. The solution for this problem is
Rounding which would cause rounding error.
0.2 has been represented by value greater than 0.2
0.4 has been represented by value greater than 0.4
so after calculating with these rounded numbers the
difference would increase and the difference will be
significant.

Why Rounding Error occurs ?

Because there is no exact representation for some


binary numbers

Explain the reason why binary number are stored in


normalized form ?

Normalization minimizes the number of leading zeros


Maximizing the precision of the number for the given
number of bits
enables very large or small number to be stored with
accuracy.
Avoids possibility of many numbers having multiple
representation
Trade Off Between Mantissa And Exponent
Trade Off means Relationship

Mantissa Exponent
0 1 1 1 0 1 1 0 0 0 0 0 0 1 0 0

Precision Range

12 bits for mantissa --> 8 bits for Mantissa

if we reduce bits for mantissa from 12 to 8


that means less precision

4 bits for Exponent --> 8 bits for Exponent

if we increase the bits for Exponent from 4


bits to 8 bits that means better range
Question : What is the trade-off between Mantissa and
Exponent

The trade off is between precision and range


If more bits are used for mantissa that means better
precision.
If more bits are used for exponent that means better
range.
More no of bits for mantissa means less number of
bits for exponent.

Largest Positive Number And Smallest


Positive Number In A Given Scenario

You have to make sure the answer is normalized so for


that we are going to have a Key which can help us in
solving Question regarding largest or smallest number.

Largest Positive

0.1 and the rest of 0.1 and the rest


the bits should be 1 should also be 1 as
as we need to make we need the largest
a largest number positive exponent
which will give us
the largest number
Mantissa Exponent
0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1
Mantissa Exponent

Smallest Positive

0.1 and the rest of 1.0 and the rest


the bits should be should be 0 as we
0 as we need to need the largest
make a smallest negative exponent
number so the which will move
mantissa should our decimal to left
the smallest side and we will get
the smallest
number
Mantissa Exponent

0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0
Mantissa Exponent
Overflow Underflow
Less Space More More Space Less
Bits To Store Bits To Store

Question : State when overflow error occurs in floating


point representation ?

Following an arithmetic operation a number produced


exceeds the maximum value that can be stored in
mantissa and exponent an overflow error occurs. This
could occur when dividing by a very small number.

Question : State when underflow error occurs in floating


point representation ?

Following an arithmetic operation, the result is smaller


than the smallest number that can be stored in mantissa
and exponent an underflow error occurs. This could
occur when dividing by a very large number.
Question : 10 bits for mantissa and 6 bits for exponent.
The denary number 513 cannot be stored accurately as a
normalized floating-point number is this system (3)
Answer:

513 in binary is 0.1000000001 so it requires 11 bits to


store accurately. Results in overflow.

Question : Describe an alteration to the way floating-


point numbers are stored to enable this number to be
stored accurately using the total number of bits (2)

Answer : The number of bits for mantissa must be


increased. 11 bits for mantissa and 5 bits for exponent

Question : Explain why a binary representation is


sometimes only an approximation to the real number it
represents.

Answer :
Real numbers can have a fractional part (such as 0.4
and 0.25)
The fixed length of the storage means that you can’t
store a very large number or very small number
There are limited decimal/fractional representation
(0.5 0.25 0.125 .. )
it isn‘t possible to store all fractions with the level of
precision provide by the system
the fractional part of the number is as closes as
possible within the number of bits given.
Floating Point Representation

Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 9
Question 10
Question 11
Question 12
Question 13
Question 14
Question 15
Question 16
Question 17
Question 18
Question 19
Question 20
Question 21
Question 22
Question 23
Question 24
Question 25
Answer
Answer 1

Answer 2

Answer 3
Answer 4

Answer 5
Answer 6
Answer 7
Answer 8

Answer 9
Answer 10

Answer 11
Answer 12

Answer 13
Answer 14

Answer 15
Answer 16
Answer 17

Answer 18
Answer 19

Answer 20
Answer 21

Answer 22
Answer 23

Answer 24
Answer 25
User Defined Datatype

COMPUTER SCIENCE 9618 PAPER 3


User Defined Datatype
Data types are like tools in a toolbox, each designed for a
specific task in programming, dictating how data is stored
and manipulated. Just as you wouldn't use a hammer to
tighten a screw, each data type is suited to handle particular
kinds of data (e.g., numbers, text) efficiently and
appropriately.

What is meant by user defined datatype ?


A data type constructed by a programmer and is not a
primitive datatype ( basic data types )
A data type that references at least one other data type
and is derived from one or more existing data type.
The data types which are referenced can be primitive or
user defined.
To meet’s programmer requirement

Explain why user defined datatype are necessary ?


To create a new data type from existing data types.
To allow data types not available in a programming
language to be constructed that meets programmer’s
requirement
Datatypes
Non Composite Composite

Single data type that does not refer to Data type that refers to other data types
another data type and are constructed from another datatype

Examples : Enumerated, Real, String, Char, Examples : Record, List, Set, Array, Class,
Boolean, Integer Queue, Linked List, Dictionary

Composite data types are like toolkits, combining multiple


tools (e.g., lists, arrays, structs) to hold and manage
collections of related data, whereas non-composite
(primitive) data types are like single tools (e.g., int, float,
char) designed to handle one specific type of data.
Composite types bundle these individual tools together to
solve more complex tasks, while non-composite types focus
on simpler, specific tasks.

Explain what is meant by Composite Data Type ?


A user defined data type that is a collection of data that
can consist of multiple elements of different or the same
data types.
grouped under a single identifier

Explain what is meant by Non Composite Data Type ?


It can be defined without referencing another data type.
It can be primitive type available in a programming
language, or a user-defined datatype.
Enumerated Datatypes
A user defined non composite data type with a list of all
possible values that is ordered

Pseudocode To Declare Enumerated Datatype


TYPE name of Datatype = ( ____ , ____ , ____ , ____ )

Declare an enumerated data type with the identifier Months


which can have all 12 months.

TYPE Months = ( January , February , March, April, ...... )

Declare a variable currentmonth of Datatype Months

DECLARE currentmonth : Months

Assign August in currentmonth variable

currentmonth <--- August

Declare a variable previousmonth of Datatype Month

DECLARE previousmonth : Months

Print the previous month

previousmonth <--- currentmonth - 1


OUTPUT previousmonth
Exam Style Question

Enumerated

Non - Composite

DECLARE session : timeOfDay

session <--- afternoon

TYPE Parts = ( Monitor, CPU, SSD, HDD, LaserPrinter, Keyboard, Mouse )

TYPE Prime = ( 2, 3, 5, 7, 11, 13, 17 )


Pointer Datatypes
A user defined non composite datatype that stores memory
locations only and indicates the type of data stored in the
memory location.

Data

B1603
Sector A
Location

A pointer is like the address of a house. Just as the address


tells you where the house is located, a pointer tells you
where a variable's value is stored in memory. Instead of
holding the house (data) itself, the pointer holds the address
(memory location) where you can find the house (data).
Memory Location Content

8216

8217 “Ahmed”

we are going to
8218 Base String
make a variable
to store the
location 8217. 8219
So that variable
would need a
specific
datatype known
as pointer.

Pseudocode To Declare Pointer Datatype


^ : This symbol represents pointer
@ : This symbol represents the address is required not the data

TYPE name of Datatype = ^Base Datatype


Depends on the
data stored so it
could be String,
Integer, Real,
Boolean, Char
Question : We have Integer variables so create a data type
with the name IntegerPointer

TYPE IntegerPointer = ^INTEGER

Declare a variable in which you store the address of integer


values with the name myintegerpointer

DECLARE myintegerpointer : IntegerPointer

Question : You have a variable Number with value 10 in it


stored on 5216 location. Store the address in
myintegerpointer variable

myintegerpointer <---- @Number

( address of number not the value )

DEREFRENCING
You have the address and you want the value on that address

Change the data which is currently pointed by


myintegerpointer to 100

myintegerpointer ^ <--- 100


Record Datatypes
It’s a user defined datatype composite data type and a group
of multiple data types

If you want to store a complete record in a single variable


name we use the concept of record datatype

Pseudocode To Declare Record Datatype

TYPE name of Datatype


DECLARE Value1 : Datatype
DECLARE Value2 : Datatype
ENDTYPE
Question : We need to store information of a book under a
single identifier. Create a record datatype with the name
Book. The book should hold info about ISBN number (Integer),
Title (String), Genre (String).

TYPE Book
DECLARE ISBN : INTEGER
DECLARE Title : STRING
DECLARE Genre : STRING
ENDTYPE

Question : Declare a new record variable named MyBook

DECLARE MyBook : Book

Question : The value of ISBN is 124657, Title is “Papersdock”,


Genre is “Fiction”

[Link] <--- 124657


[Link] <--- “Papersdock”
[Link] <--- “Fiction”

Question : Why Pointer is Non - Composite

Because the value which is stored in a variable as location is


not an integer or string or any other data type.
Declaring A Range
Question : Declare a variable named Number which contains
0 till 99 numbers

DECLARE Number : 0 .. 9

Specific Datatype In Array


If Array is declared with the data type String that means any
string value can be stored in the array but if you want to
make it specific values only then you are suppose to specify
the values that could be assign to elements.

Question : Declare an Array that can only have “Taha” “Bano”


“Pappan”

DECLARE Names : Array [ 1 : 3 ] OF ( “Taha”, “Bano” , “ Pappan” )

Note : If there are more than one thing to store than declare
array and use Specific Datatype (with Quotation Marks)
Average always means real values. If you have single value then
you would need Enumerated (without Quotation Marks).
Enumerated types are ideal for situations where you have a
limited set of related values.
Set Datatypes
The SET is a user-defined composite data type that allows
you to define a collection of elements of a specific data type,
where each element is unique.

TYPE Name Of Set = SET OF data type


DEFINE Name of datatype ( val1, val2 , val3 ) : Name Of Set

TYPE LetterSet = SET OF CHAR


DEFINE Vowels ('A','E','I','O','U'): LetterSet

Exam Style Question


Write pseudocode statements to declare a set data type
HexDigits that holds the set of valid hexadecimal digit
characters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

TYPE HexSet = SET OF CHAR


DEFINE Hexadecimal ( ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘A’,
‘B’, ‘C’, ‘D’, ‘E’, ‘F’ ) : HexSet
User Defined Data types

Question 1

Sir Taha Ali Papersdock +92 318 2248934


Question 2

Sir Taha Ali Papersdock +92 318 2248934


Question 3

Sir Taha Ali Papersdock +92 318 2248934


Question 4

Sir Taha Ali Papersdock +92 318 2248934


Question 5

Sir Taha Ali Papersdock +92 318 2248934


Question 6

Sir Taha Ali Papersdock +92 318 2248934


Question 7

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 8

Question 9

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Sir Taha Ali Papersdock +92 318 2248934
Question 10

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 11

Sir Taha Ali Papersdock +92 318 2248934


Question 12

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 13

Sir Taha Ali Papersdock +92 318 2248934


Question 14

Question 15

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 16

Sir Taha Ali Papersdock +92 318 2248934


Question 17

Sir Taha Ali Papersdock +92 318 2248934


Sir Taha Ali Papersdock +92 318 2248934
Question 18

Sir Taha Ali Papersdock +92 318 2248934


Question 19

Sir Taha Ali Papersdock +92 318 2248934


Question 20

Question 21

Sir Taha Ali Papersdock +92 318 2248934


Question 22

Sir Taha Ali Papersdock +92 318 2248934


Answer
Answer 1

Answer 2

Answer 3

Sir Taha Ali Papersdock +92 318 2248934


Answer 4

Answer 5

Sir Taha Ali Papersdock +92 318 2248934


Answer 6

Answer 7

Sir Taha Ali Papersdock +92 318 2248934


Answer 8

Answer 9

Sir Taha Ali Papersdock +92 318 2248934


Answer 10

Answer 11

Answer 12

Sir Taha Ali Papersdock +92 318 2248934


Answer 13

Answer 14

Sir Taha Ali Papersdock +92 318 2248934


Answer 15

Answer 16

Answer 17

Sir Taha Ali Papersdock +92 318 2248934


Answer 18

Sir Taha Ali Papersdock +92 318 2248934


Answer 19

Answer 20

Answer 21

Answer 22

Sir Taha Ali Papersdock +92 318 2248934

You might also like