Ramya
Ramya
Question 1:
Input:
Array = [1, 3, 5, 7]
Task: Print each element added to the previous element.
Expected Output:
1
4
8
12
Question 2:
Input:
Array = [10, 20, 30, 40]
Task: Divide each element by 10.
Expected Output: [1, 2, 3, 4]
Question 3:
Input:
Array = [10, 20, 30, 40]
Task: Find the smallest element in the array.
Expected Output: 10
Question 4:
Input:
Array = [5, 10, 15]
Task: Remove the last element once.
Expected Output: [5, 10]
Question 5:
Input:
Array = [1, 2]
Task: Add 3 and 4 to the array.
Expected Output: [1, 2, 3, 4]
Question 6:
Input:
Array = [5, 10, 15]
Task: Remove the first element and return the modified array.
Expected Output: [10, 15]
Question 7:
Input:
Array = [10, 20, 30]
Task: Add 5 and 15 at the start of the array.
Expected Output: [5, 15, 10, 20, 30]
Question 8:
Input:
Arrays = [[7, 14], [21, 28]]
Task: Merge both arrays.
Expected Output: [7, 14, 21, 28]
Question 9:
Input:
Array = [3, 6, 9]
Task: Create a new array by adding 1 to each element.
Expected Output: [4, 7, 10]
Question 10:
Input:
Array = [7, 14, 21, 28]
Task: Filter the array to get numbers greater than or equal to 15.
Expected Output: [21, 28]
Question 11:
Input:
Array = [3, 6, 9, 12]
Task: Modify the array by removing 3 elements starting from index 0 and adding 4.
Expected Output: [4, 12]
Question 12:
Input:
Array = [7, 8, 9, 10]
Task: Extract a portion of the array from the second last element to the end.
Expected Output: [9, 10]
Question 13:
Input:
String = "apple,banana,orange,grape"
Task: Split the string by commas.
Expected Output: ['apple', 'banana', 'orange', 'grape']
Question 14:
Input:
Array = ['1', '2', '3', '4'],
Task: Join the array elements into a single string, separated by " & ".
Expected Output: "1 & 2 & 3 & 4"
Question 15:
Input:
Array = ['dog', 'cat', 'mouse']
Task: Convert the array to a string.
Expected Output: "dog,cat,mouse"