1D ARRAY
(FOR CLASS XI AND XII)
LIST OF QUESTIONS
Q1. Write a user-defined function EXTRA_ELE(int A[ ], int B[ ], int N) in C++ to find and display the extra element in Array A. Array A contains all the elements of array B but one more element extra. (Restriction: array elements are not in order) Example If the elements of Array A is 14, 21, 5, 19, 8, 4, 23, 11 and the elements of Array B is 23, 8, 19, 4, 14, 11, 5 Then output will be 21 |
download Solution |
Q2. Write a user defined function Reverse(int A[],int n) which accepts an integer array and its size as arguments(parameters) and reverse the array. Example : if the array is 10,20,30,40,50 then reversed array is 50,40,30,20,10 |
download Solution |
Q3. Write the definition of function named Array_Swap() that will accept an integer array & its size as arguments and the function will interchange/swap elements in such a way that the first element is swapped with the last element, second element is swapped with the second last element and son on, only if anyone or both the elements are odd. E.g. if initially array of seven elements is: 5, 16, 4, 7, 19, 8, 2 After execution of the above function, the contents of the array will be: 2,16, 19, 7, 4, 8, 5 |
download Solution |
Q4. Write the definition of a function grace_score (int score [], int size) in C++, which should check all the elements of the array and give an increase of 5 to those scores which are less than 40. Example: if an array of seven integers is as follows: 45, 35, 85, 80, 33, 27, 90 After executing the function, the array content should be changed as follows: 45, 40, 85, 80, 38, 32, 90 |
download Solution |
Q5. Write a function SORTSCORE() in C++ to sort an array of structure IPL in descending order of score using selection sort . Note : Assume the following definition of structure IPL. struct IPL { int Score; char Teamname[20]; }; |
download Solution |
Q6. Write a function in C++ to print the sum of all the non-negative elements present on both the diagonal of a two dimensional array passed as the argument to the function. |
download Solution |
Write C program to print all negative elements in an array |
download Solution |
Write C++ program to count total number of negative elements in array |
download Solution |
Write C++ program to find sum of all elements of an array |
download Solution |
Write C++ program to count even and odd elements in an array |
download Solution |
Page 1 | Page 2 | Page 3 | Page 4 | Page 5 |