Space for google add

LAB COURSE III PHP - Assignment 2

 


Set A

Q1) Write a menu driven program to perform the following operations on an

associative array:

i. Display the elements of an array along with the keys.

ii. Display the size of an array

iii. Delete an element from an array from the given index.

iv. Reverse the order of each element’s key-value pair [Hint: use array_flip()]

v. Traverse the elements in an array in random order [[Hint: use shuffle()].


Q:2) Accept a string from the user and check whether it is a palindrome or not

(Implement stack operations using array built-in functions).


Set B

Q: 1) Declare a Multidimensional Array. Display specific element from a

Multidimensional array. Also delete given element from the Multidimensional

array.


Q: 2) Define an array. Find the element from the array that matches the given

value using appropriate search function.


Set C

Q.1) Write a menu driven program to perform the following stack and queue

related operations:[Hint: use Array_push(), Array_pop(), Array_shift(),

array_unshift() functions]

i. Insert an element in stack

ii. Delete an element from stack

iii. Display the contents of stack

iv. Insert an element in queue

v. Delete an element from queue

vi. Display the contents of queue


Q: 2) Write a menu driven program to perform the following operations on

associative arrays:

1. Sort the array by values (changing the keys) in ascending, descending order.

2. Also sort the array by values without changing the keys.

3. Filter the odd elements from an array.

4. Sort the different arrays at a glance using single function.

5. Merge the given arrays.

6. Find the intersection of two arrays.

7. Find the union of two arrays.

8. Find set difference of two arrays.

Post a Comment

0 Comments