Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
CPP All : Arrays Concepts and 1-D Arrays
Concept Learning Code Sheets
Preparing basic arrays #1593 

Here we shall prepare some basic arrays of integers, fractions, characters and strings.

Largest number in integer array #1610 

Traversing an integer array linearly to find the largest number in the array.

Char array variations #1623 

Learning character array variations and need for null terminator

Linear search in array for search term presence and location #1630 

Search for presence of element in an integer array for search term presence and location of element where it is found first.

Finding count of members in a linear array #2502 

Finding the number of members in an array using the sizeof operator

Reversing an array #2506 

Reversing an integer array using the swapping of members around midpoint.

Collecting array entries and displaying it like its formal representation #2510 

Taking array entries from the user and displaying it like its formal representation as {1,2,..5}

Copying an Integer Array #3091 

Demonstrating how an array can be copied to another array of same size by copying each member of the array.

printing filtered array content #3095 

Demonstrating how to print the filtered array content.

copying filtered array content to another array #3102 

Demonstrating how to filter the array content and then copy it to another array.

copying filtered array content to another array by maintaining count #3106 

Demonstrating how to filter the array content and then copy it to another array by maintaining the filter size count.

Linear search using array reference passing to function #1628 

Search for presence of element in an integer array by using a function with a call by reference of array, size and search term.

Solved Problems
Linear search function for search term presence and location #1632 

Write a function linsearch(int [],int, int) which searches for the term 23 in the given integer array [12,19,23,3,2] and returns its position in the array. This array should be initialised in the calling function and then passed as reference to the given function. Show implementation also.

Write a function linsearch(int [],int, int) which searches for the term 23 in the given in ...
Average of temperature values stored in array #2487 

Write a program to store 10 temperature readings in an array and then find the average temperature of the given readings.

Write a program to store 10 temperature readings in an array and then find the average tem ...
Proving palindrome array #2848 

Write a program to prove that the give array [23,43,51,43,23] is a palindrome array, means that its reversed pattern will be same as its original pattern.

Write a program to prove that the give array [23,43,51,43,23] is a palindrome array, means ...
Sum of integer array #3088 

Write a program to collect 5 integer values from user in an integer array and then pass this array to a function along with its size. Return the sum of the array members from the function and print its value in the main routine.

Write a program to collect 5 integer values from user in an integer array and then pass t ...
Average value of array and members more than average #3098 

Prepare an array of temperature readings of an entire week with data as
25.3, 27.0, 24.8, 26.9, 25.9, 26.4, 24.0. Now find out the average temperature of the week and then print out the readings which are more than the average temperature.

Prepare an array of temperature readings of an entire week with data as 25.3, 27.0, 24.8 ...
Searching elements from one array into another array #5617 

Write a program to search members of integer array 1 in array 2 and print the members of array 1 that are also found in array 1. Also print the total number of members found.
For e.g. if array 1 is [12,19,23,3,2] and array 2 is [13,12,2,3,14,21],
the output would be
12 3 2
count = 3

Write a program to search members of integer array 1 in array 2 and print the members of a ...
03A #5652 

Write the definition of a function FixSalary(float Salary[], int N) in C++, which should modify each element of the array Salary having N elements, as per the following rules:

Existing Salary Values Required Modification in Value
If less than 100000 Add 35% in the existing value
If >=100000 and <20000 Add 30% in the existing value
If >=200000 Add 20% in the existing value
Write the definition of a function FixSalary(float Salary[], int N) in C++, which should ...
03A #5764 

Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even positions (i.e. 0,2,4,…) of the array should be added with the content of the element in the next position and odd positions (i.e. 1,3,5,…) elements should be incremented by 10.
Example: if the array Arr contains

23 30 45 10 15 25

Then the array should become

53 40 55 20 40 35

NOTE:

  • The function should only alter the content in the same array.
  • The function should not copy the altered content in another array.
  • The function should not display the altered content of the array.
  • Assuming, the Number of elements in the array are Even.
Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even posi ...
03A #5871 

Write the definition of a function Alter(int A[], int N) in C++, which should change all the multiples of 5 in the array to 5 and rest of the elements as 0. For example, if an array of 10 integers is as follows:

A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9]
55 43 20 16 39 90 83 40 48 25

After executing the function, the array content should be changed as follow:

A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9]
5 0 5 0 0 5 0 5 0 5
Write the definition of a function Alter(int A[], int N) in C++, which should change all t ...
03A-2015 #5957 

Write the definition of a function Change(int P[], int N) in C++, which should change all the multiples of 10 in the array to 10 and rest of the elements as 1. For example, if an array of 10 integers is as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
100 43 20 56 32 91 80 40 45 21

After executing the function, the array content should be changed as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
10 1 10 1 1 1 10 10 1 1
Write the definition of a function Change(int P[], int N) in C++, which should change all ...
01E #6016 

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program .

void main()
{
  int A[]={10,12,15,17,20,30};
  for(int i = 0; i<6; i++)
  {
    if(A[i]%2==0)
    A[i] /= 2;
    else if(A[i]%3==0)
    A[i] /= 3;
    if(A[i]%5==0)
    A[i] /= 5;
  }
  for(i = 0; i<6; i++)
  cout<<A[i]<<"#";
}
Find and write the output of the following C++ program code: Note: Assume all required he ...
03A #6032 

Write the definition of a function Reverse(int Arr[], int N) in C++, which should reverse the entire content of the array Arr having N elements, without using any other array.
Example: if the array Arr contains

13 10 15 20 5

Then the array should become

5 20 15 10 13

NOTE:
-The function should only rearrange the content of the array.
-The function should not copy the reversed content in another array.
-The function should not display the content of the array.

Write the definition of a function Reverse(int Arr[], int N) in C++, which should reverse ...
Value modification function of 1 D array using slab based conditions #6165 

Write the definition of a function FixPay(float Pay[], int N) in C++, which should
modify each element of the array Pay having N elements, as per the following
rules:

Existing Value of Pay Pay to be changed to
If less than 100000 Add 25% in the existing value
If >=100000 and <20000 Add 20% in the existing value
If >=200000 Add 15% in the existing value
Write the definition of a function FixPay(float Pay[], int N) in C++, which should modify ...
Exam Questions
CBSE12A-2016-03A  03A #5652 

Write the definition of a function FixSalary(float Salary[], int N) in C++, which should modify each element of the array Salary having N elements, as per the following rules:

Existing Salary Values Required Modification in Value
If less than 100000 Add 35% in the existing value
If >=100000 and <20000 Add 30% in the existing value
If >=200000 Add 20% in the existing value
Write the definition of a function FixSalary(float Salary[], int N) in C++, which should ...
CBSE12A-2017-03A  03A #5764 

Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even positions (i.e. 0,2,4,…) of the array should be added with the content of the element in the next position and odd positions (i.e. 1,3,5,…) elements should be incremented by 10.
Example: if the array Arr contains

23 30 45 10 15 25

Then the array should become

53 40 55 20 40 35

NOTE:

  • The function should only alter the content in the same array.
  • The function should not copy the altered content in another array.
  • The function should not display the altered content of the array.
  • Assuming, the Number of elements in the array are Even.
Write the definition of a function AddUp(int Arr[], int N) in C++, in which all even posi ...
CBSE12D-2015-03A  03A #5871 

Write the definition of a function Alter(int A[], int N) in C++, which should change all the multiples of 5 in the array to 5 and rest of the elements as 0. For example, if an array of 10 integers is as follows:

A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9]
55 43 20 16 39 90 83 40 48 25

After executing the function, the array content should be changed as follow:

A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9]
5 0 5 0 0 5 0 5 0 5
Write the definition of a function Alter(int A[], int N) in C++, which should change all t ...
CBSE12A-2015-03A  03A-2015 #5957 

Write the definition of a function Change(int P[], int N) in C++, which should change all the multiples of 10 in the array to 10 and rest of the elements as 1. For example, if an array of 10 integers is as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
100 43 20 56 32 91 80 40 45 21

After executing the function, the array content should be changed as follows:

P[0] P[1] P[2] P[3] P[4] P[5] P[6] P[7] P[8] P[9]
10 1 10 1 1 1 10 10 1 1
Write the definition of a function Change(int P[], int N) in C++, which should change all ...
CBSE12D-2017-01E  01E #6016 

Find and write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program .

void main()
{
  int A[]={10,12,15,17,20,30};
  for(int i = 0; i<6; i++)
  {
    if(A[i]%2==0)
    A[i] /= 2;
    else if(A[i]%3==0)
    A[i] /= 3;
    if(A[i]%5==0)
    A[i] /= 5;
  }
  for(i = 0; i<6; i++)
  cout<<A[i]<<"#";
}
Find and write the output of the following C++ program code: Note: Assume all required he ...
CBSE12D-2017-03A  03A #6032 

Write the definition of a function Reverse(int Arr[], int N) in C++, which should reverse the entire content of the array Arr having N elements, without using any other array.
Example: if the array Arr contains

13 10 15 20 5

Then the array should become

5 20 15 10 13

NOTE:
-The function should only rearrange the content of the array.
-The function should not copy the reversed content in another array.
-The function should not display the content of the array.

Write the definition of a function Reverse(int Arr[], int N) in C++, which should reverse ...
CBSE12D-2016-03A  Value modification function of 1 D array using slab based conditions #6165 

Write the definition of a function FixPay(float Pay[], int N) in C++, which should
modify each element of the array Pay having N elements, as per the following
rules:

Existing Value of Pay Pay to be changed to
If less than 100000 Add 25% in the existing value
If >=100000 and <20000 Add 20% in the existing value
If >=200000 Add 15% in the existing value
Write the definition of a function FixPay(float Pay[], int N) in C++, which should modify ...

Code Sheets:12  Solved Problems:14  Exam Questions:7 
Back