0% found this document useful (0 votes)
50 views1 page

Lab 2

1. The document contains 5 programming tasks involving different data structures: an integer array, integer queue, synchronous LIFO queue, associative array of integers, and associative array of integers indexed by strings. 2. The first task involves declaring an integer array of 10 elements, initializing it with data, and writing an algorithm to sort the array. 3. The second task involves declaring an integer queue, performing various insertion and deletion operations on it, and checking elements. 4. The third task asks to design a synchronous LIFO queue with specified inputs, outputs, and size.

Uploaded by

subash
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)
50 views1 page

Lab 2

1. The document contains 5 programming tasks involving different data structures: an integer array, integer queue, synchronous LIFO queue, associative array of integers, and associative array of integers indexed by strings. 2. The first task involves declaring an integer array of 10 elements, initializing it with data, and writing an algorithm to sort the array. 3. The second task involves declaring an integer queue, performing various insertion and deletion operations on it, and checking elements. 4. The third task asks to design a synchronous LIFO queue with specified inputs, outputs, and size.

Uploaded by

subash
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
You are on page 1/ 1

FutureWiz

Lab 2
1. Declare an array of int which has 10 locations. Initialize the array with data of your
choice, write an algorithm to sort this array.

2. Declare an integer queue. Initialize it with five elements (0 to 4). Perform following
operations on queue and print content after every operation:
a. Insert an element (value 19) at beginning without any method.
b. Insert an element (value 29) at beginning using predefined method.
c. Insert an element (value 39) at the end using predefined method.
d. Insert an element (value 49) at index 4.
e. Get 1st element in queue and compare with value 29.
f. Get last element in queue and compare with value 39.
g. Try to get value at index 3 without removing it from queue.
h. Delete an element at index 4 in queue.

3. Design a synchronous LIFO (Last In First Out) using bound queue. Queue has
following specification:
a. Inputs: clk, Data_in, write_en and read_enable.
b. Outputs: empty, full, Data_out.
c. Size: 16 locations each capable of storing 5 bits.

4. Declare an associative array, assign 50 random integer values at random locations


between 1 and 100 and perform following operations:
a. Check whether value exists at location 3, 23, 75 and 80.
b. Print the value at first index along with index number.
c. Print the value at last index along with index number.
d. Print the size of array.
e. Delete elements at 5th, 10th, 15th and 100th index if they exist.
f. Print the size of array again.

5. Declare an associative array of int with index of type string. Use following string
index’s to store their equivalent ASCII value (Decimal).

“0”- “9”, “a”- “h”, “P”- “Z”

a. Print all value of array along with its index.


b. Check whether value exists at following index “x”, “A”, “p” and “T”.
c. Print Num of elements in the array.
d. Delete first 3 and last five elements of array.
e. Print content of array and size of array.

www.futurewiz.co.in

You might also like