CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Arrays Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE ARRAYS Warning: include(../../../ads_330x250_middle.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/array4.php on line 23 Warning: include(): Failed opening '../../../ads_330x250_middle.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/array4.php on line 23 OUTSIDE DELHI 2007: 3.a) Write a function in C++ which accepts an integer array and its size as arguments and replaces elements having even values with its half and elements having odd values with twice its value . Example : If an array of five elements initially contains the elements as 3, 4, 5, 16, 9.
then the function should rearrange content of
the array as 6, 2, 10, 8, 18 Solution:
3.b) An array Arr[15][20] is stored in the memory along the row with each element
occupying 4 bytes. Find out the Base address of the location Arr[3][2], if the location Arr[5][2] is stored at the address 1500. Solution: Given Data: Arr[15][20] W=4 B=? R=15 C=20 Lr = 0 Lc = 0 Address of Arr[3][2] = ?
3.d) Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle row and the elements of middle column. [Assuming the 2D Array to be a square matrix with odd dimension i.e., 3x3, 5x5, 7x7 etc…] Example : If the array content is
Output through the function should be :
Solution:
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] ) |
Warning: include(../../../120_60_others.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/array4.php on line 100 Warning: include(): Failed opening '../../../120_60_others.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/array4.php on line 100 |