Find Your Free Essay Examples

Important Questions Class 12 Computer Science C Data Structure

Free PDF download of Important Questions for CBSE Class 12 Computer Science (C++) Chapter 8 Data Structure prepared by expert Computer Science (C++) teachers from latest edition of CBSE(NCERT) books, On StudySolver.Org to score more marks in CBSE board examination.

Question 1: 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.  All India 2017 NOTE

Question 2: 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: Аnswer:

Question 3: 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: Аnswer:

Question 4: 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. e.g. if an array of 10 integers is as follows: Аnswer:

Question 5: Write the definition of a function Changeant 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.   All India 2015 Аnswer:

Question 6: Write the definition of a function Modify(int A[ ], int N) in C++, which should reposition the content after swapping each adjacent pair of numbers in it. [NOTE Assuming the size of array is multiple of 4] Аnswer:

Question 7: Write code for a function void oddEven(int S[ ], int N) in C++, to add 5 in all the odd values and 10 in all the even values of the array S. Аnswer:

Question 8: Write code for a function void EvenOdd (int T [ ], int C) in C++, to add 1 in all the odd values and 2 in all the even values of the array T. Аnswer:

Question 9: Write a function in C++ TWOTOONE( ) which accepts two array X[ ], Y[ ] and their size n as argument. Both the arrays X[ ] and Y[ ] have the same number of elements. Transfer the content from two arrays X[ ], Y[ ] to array Z[ ]. The even places (0,2,4….) of array Z[ ] should get the contents from the array X[ ] and odd places (1,3,5…) of array Z[ ] should get the contents from the array Y[ ]. Example:  If the X[ ] array contains 30,60,90 and the Y[ ] array contains 10.20.50. Then Z[ ] should contain 30.10.60.20.90.50.  All India 2014 Аnswer:

Question 10: Write code for a function void Convert (int T[ ], int Num) in C++, which repositions all the elements of the array by shifting each of them one to one position before and by shifting the first element to the last position. Аnswer:

Question 11: Write code for a function void ChangeOver(int P[ ], int N) in C++, which re-positions all the elements of the array by shifting each of them to the next position and by shifting the last element to the first position. Аnswer:

Question 12: Write the definition for a function void Transfer (int A[6], int B[6]) in C++, which takes two integer arrays, each containing 6 elements as parameters. The function should exchange all odd places (i.e. 3rd and 5th) of the two arrays. Аnswer:

Question 13: Write a function SWAP2CHANGE(int p[ ], int N) in C++ to modify the content of the array in such a way that the elements, which are multiples of 10 swap with the value present in the very next position in the array. e.g. If the content of array p is 91, 50, 54, 22, 30, 54 The content of array p should become 91, 54, 50, 22, 54, 30 Аnswer:

Question 14: Write a function SWAP2BEST(int ARR[ ], int Size) in C++ to modify the content of the array in such a way that the elements, which are multiples of 10 swap with the value present in the very next position in the array. e.g. If the contents of array ARR are 90, 56, 45, 20, 34, 54 The contents of array should become 56, 90, 45, 34, 20, 54   All India 2012 Аnswer:

Question 15: Write a Get2From1( ) function in C++ to transfer the content from one array ALL[ ] to two arrays Odd[ ] and Even[ ]. The Even[ ] array should contain the values from places(0, 2, 4, …) of array ALL[ ] and Odd[ ] array should contain the values from odd position like (1, 3, 5, …). e.g. The ALL[ ] array should contain 30,10, 60, 50, 90, 80 If the Even[ ] array contains 30, 60, 90 and the Odd[ ] array contains 10, 50, 80  All India 2011 Аnswer:

Question 16: Write a function CHANGE( ) in C++, which accepts an array of integer and its size as parameters and divide all those array elements by 7, which are divisible by 7 and multiply other array elements by 3. Аnswer:

Question 17: Write a function REASSIGN( ) in C++, which accepts an array of integer and its size as parameters and divide all those array elements by 5, which are divisible by 5 and multiply other array elements by 2. Аnswer:

Question 18: Write a function SORTPOINTS( ) in C++ to sort an array of structure Game in descending order points using bubble sort. NOTE Assume the following definition of structure Game.

Question 19: Write a function SORTSCORE( ) in C++to sort an array of structure. Examinee in descending order of Score using bubble sort. NOTE Assume the following definition of structure Examinee.

Question 1: Write a definition for a function SUMMIDCOLfint MATRIX[ ][10], int N, int M) in C++, which finds the sum of the middle column’s elements of the MATRIX (Assuming N represents number of rows and M represents number of columns, which is an odd integer).  All India 2017 Example:  If the content of array MATRIX having N as 5 and M as 3 is as follows: The function should calculate the sum and display the following: Sum of Middle Column : 15 Аnswer:

Question 2: ARR[15][20] is a two-dimensional array, which is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[5][15], if the element ARR[10][5] is stored at the memory location 35000. All India 2017 Аnswer:

Question 3: Write definition for a function DISPMID (int A[ ] [5], int R, int C) in C++ to display the elements of middle row and middle column from two dimensional array A having R number of rows and C number of columns. Аnswer:

Question 4: R[10][50] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 8 bytes, find the address of the element R[5][15], if the element R[8] [10] is stored at the memory location 45,000.  All India 2016 Аnswer:

Question 5: Write definition for a function SHOWMID(int P[ ][5], int R, int C) in C++ to display the elements of middle row and middle column from a two dimensional array P having R number of rows and C number of columns, e.g. if the content of array is as follows: The function should display the following as output: 103 101 121 102 101 116 121 109  Delhi 2016 Аnswer:

Question 6: T[20] [50] is a two dimensional array, which is stored in the memory along the row with each of its element occupying 4 bytes, find the address of the element T[15][5], if the element T[10][8] is stored at the memory location 52000.  Delhi 2016 Аnswer:

Question 7: Write definition for a function SHOWMID(int P[ ][5], int R, int C) in C++ to display the elements of first, third and fifth column ffom a two dimensional array P having R number of rows and C number of columns. For example, if the content of array is as follows: Аnswer:

Question 8: Write a function REVROW (int P[ ][5], int N, int M) in C++ to display the content of a two dimensio) al array, with each row content in reverse order.  All India 2015 Аnswer:

Question 9: A two dimensional array ARR[50] [20] is stored in the memory along the row with each of its elements occupying 4 bytes. Find the address of the element ARR[30][10], if the element ARR[10][5] is stored at the memory location 15000. All India 2015 Аnswer:

Question 10: Write a function REVCOL (int P[ ][5], int N, int M) in C++ to display the content of a two dimensional array, with each column content in reverse order.  Delhi 2015 NOTE Array may contain any number of rows. Аnswer:

Question 11: A two dimensional array P[20][50] is stored in the memory along the row with each of its element occupying 4 bytes. Find the address of the element P[10][30], if the element P[5][5] is stored at the memory. Аnswer:

Question 12: Write a function ADDDIAG (int A[ ][5], int N, int M) in C++ to display sum of the content, which at the diagonals of a two dimensional array. [NOTE: Assume the array to be of even dimension such as 2×2,4×4, 6×6 etc.] Аnswer:

Question 13: Write a user-defined function SumLast3 (int A[ ][4],int N,int M) in C++ to find and display the sum of all the values, which are ending with 3 (i.e. unit place is 3). Аnswer:

Question 14: Write a user-defined function AddEnd2(int A[ ] [4], int N, int M) in C++ to find and display the sum of all the values, which are ending with 2 (i.e. unit place is 2). Аnswer:

Question 15: An array T[25] [20] is stored along the row in the memory with each element requiring 2 bytes of storage. If the base address of array T is 42000, find out the location of T[10][15]. Also, find the total number of elements present in this array.  Delhi 2014 Аnswer:

Question 16: An array A[20][30] is stored along the row in the memory with each element requiring 4 bytes of storage. If the base address of array A is 32000, find out the location of A[15][10]. Also, find the total number of elements present in this array.  All India 2014 Аnswer:

Question 17: Write a function in C++ which accepts a 2D array of integers and its size arguments and displays the elements which lie on minor diagonal. [Top right to bottom left diagonal] [Assuming the 2D array to be square matrix with odd dimension i.e. 3×3, 5×5, 7×7, etc….]  All India (C) 2014 For example, Аnswer:

Question 18: Write a user-defined function DispTen(int A[ ][4], int N, int M) in C++ to find and display all the numbers, which are divisible by 10. Аnswer:

Question 19: Write a user-defined function DispNTen(int L[ ][4], int R, int C) in C++ to find and display all the numbers, which are not divisible by 10. Аnswer:

Question 20: Write a user-defined function int SumSingle(int A[4] [4]) in C++, which finds and returns the sum of all numbers present in the first row of the array. Then, the function should return 33. Аnswer:

Question 21: An array P[15][10] is stored along the column in the memory with each element requiring 4 bytes of storage. If the base address of array P is 14000, find out the location of P[8][5].  Delhi 2013 Аnswer:

Question 22: An array T[15][10] is stored along the row in the memory with each element requiring 8 bytes of storage. If the base address of array T is 14000, find out the location of T[10][7].  All India 2013 Аnswer:

Question 23: An array S[10] [15] is stored in the memory with each element requiring 2 bytes of storage. If the base address of array S is 25000, determine the location of S[5][10] if the array is S stored along the column.  Delhi (C) 2013 Аnswer:

Question 24: Write a function SKIPEACH(int H[ ] [3], int C, int R) in C++ to display all alternate elements from two-dimensional array H (starting from H[0][0]). Аnswer:

Question 25: Write a function ALTERNATE(int A[ ] [3], int N, int M) in C++ to display all alternate elements from two-dimensional array A (starting from A[0] [0]). Аnswer:

Question 26: An array S[10][30] is stored in the memory along the column with each of the element occupying 2 bytes. Find out the memory location of S[5][10], if the element S[2][15] is stored at the location 8200.  Delhi 2012 Аnswer:

Question 27: An array T[20] [10] is stored in the memory along the column with each of the element occupying 2 bytes. Find out the memory location of T[10][5], if the element T[2] [9] is stored at the location 7600.  All India 2012 Аnswer:

Question 28: Write a COLSUM function in C++ to find sum of each column of a N*M matrix.  Delhi 2011 Аnswer:

Question 29: Write a DSUM function in C++ to find sum of diagonal element of a N*N matrix.  All India 2011 Аnswer:

Question 30: An array P[20][50] is stored in the memory along the column with each of the element occupying 4 bytes. Find out the memory location for the element P[15][10], if P[0][0] is stored at 5200.  Delhi 2011 Аnswer:

Question 31: An array G[50][20] is stored in the memory along the row with each of the element occupying 8 bytes. Find out the memory location for the element G[10][15], if G[0][0] is stored at 4200. A ll India 2011 Аnswer:

Question 32: Write a function int SKIPSUM(int A[ ][3], int N, int M) in C++ to find and return the sum of elements from all alternate elements of a two-dimensional array starting from A[0][0].  Delhi 2010 Аnswer:

Question 33: Write a function int ALTERSUM(int B[ ][5], int N, int M) in C++ to find and return the sum of elements from all alternate elements of a two-dimensional array starting from B[0][0].  All India 2010 Аnswer:

Question 34: An array P[50] [60] is stored in the memory along the column with each of the element occupying 2 bytes. Find out the memory location for the element P[10][20], if the base address of the array is 6800.  Delhi 2010 Аnswer:

Question 35: An array T[90][100] is stored in the memory along the column with each of the element occupying 4 bytes. Find out the memory location for the element T[10][40], if the base address of the array is 7200.  All India 2010 Аnswer:

Question 36: Define a function SWAPCOL( ) in C++ to swap (interchange) the first column elements with the last column elements, for a two-dimensional integer array passed as the argument of the function. Аnswer:

Question 37: Define a function SWAPARR( ) in C++ to swap (interchange) the first row elements with the last row elements, for a two-dimensional integer array passed as the argument of the function. Аnswer:

Question 38: An array S [40] [30] is stored in the memory along the column with each of the elements occupying 4 bytes. Find out the base address and address of element S[20][15], if an element S[15][10] is stored at the memory location 7200.  Delhi 2009 Аnswer:

Question 39: An array T[50] [20] is stored in the memory along the column with each of the elements occupying 4 bytes. Find out the base address and address of element T[30][15], if an element T[25][10] is stored at the memory location 9800.  All India 2009 Аnswer:

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.