Sei sulla pagina 1di 2

Array

1. What is the importance of an array?


2. What do you mean by subscript of an array?
3. Write the statement to demonstrate one dimensional array initialization.
4. Differentiate between:- int a[5]={2,5,8,1,7}; and int a[5]={2,5,8};
5. Write a program to calculate the sum of array elements.
6. Write a program to calculate the product of array elements.
7. Write a program to calculate the average of array elements.
8. Write a program to perform LINEAR search in an array.
9. Write a program to perform BINARY search in an array.
10. Write a program to find the maximum value from an array.
11. Write a program to find the minimum value from an array.
12. What is the importance of a two dimensional array?
13. Write the statement to demonstrate two dimensional array initialization.
14. Differentiate between:- (a) int a[2][3]={9,8,3,5,3,7}; and int a[2][2]={9,8,3,5};
(b) int a[2][3]={9,8,3,5,3,7}; and int a[2][2]={{9,8,3},{5,3,7}};
15. Write a program to count total even numbers present in an array.
16. Write a program to calculate the sum of all the numbers from a 2d array.
17. Write a program to calculate the sum of row elements from a 2d array.
18. Write a program to calculate the sum of column elements from a 2d array.
19. Write a program to calculate the sum of diagonal elements from a 2d array.
20. Write a program to find the maximum value from a 2D array.
21. Write a program to find the maximum value in each row from a 2D array.
22. Write a program to find the diff. between the max. and the min. value from a 2D array.
23. Write a program to accept name, marks of phy. chem. and bio. of 5 students and then
print the name, total marks and the grade of all the students. If total marks is more than
150, grade is Pass otherwise Fail.
24. Write a program to accept a name and then print its reverse.
25. Write a program to accept your name in one array your friends name in another array
and then merge the contents of both the array in third array.
26. Write a program to accept your name in one array your friends name in another array
and then merge the contents of both the array in first array.
27. Write a program to accept your name in an array and then count total UPPER CASE
characters present in it.
28. Write a program to accept your name in an array and then convert all UPPER CASE
characters in LOWER CASE.
29. Write a program that takes price of books in an array and finds the number of books
that are priced more than 500/-.
30. Write a program to store roll number and marks of students in an array and then display
the informations in the descending order of the marks.
31. Write a program which will accept two string and then compare whether the strings
are similar or not.
32. Write a program that takes a string from the user and replaces every vowel in it by *
and every space by -.
33. Write a program to check whether the given string is a Palindrome or not, e.g
madam is a Palindrome but sir is not a Palindrome.
34. Write a program to count the number of words in a string.
35. Write a program to calculate the length of a string.
36. Write a program to print that word from the string which contains maximum number of vowels.
37. Write a program which will read a name and then print the name in reverse order.
38. Write a program which will read a name and then print the name in UPPER case.
39. Write a program which will accept a string and then print all the words from the string
which is a Palindrome, e,g Hello MOM Hi DAD will print MOM and DAD.
40. Write a program which will print the number which is present maximum number of
times from an array of size 10.
41. Write a program which will accept 10 numbers in an array and then reverse the
contents of the array without using another array
Example:- If the array initially contains (2,15,3,14,7,9,19,6,1,10)
then after reversal the array should contain (10,1,6,19,9,7,14,3,15,2)
42. Write a program which accepts 5 numbers from the user and then print the contents of
the array in following format, e.g if the array contains 1,5,9,3,4 then print it as follows: -
1 * * * *
1 5 * * *
1 5 9 * *
1 5 9 3 *
1 5 9 3 4
43. Write a program to remove the duplicate numbers from a list. e,g

2 3 5 3 1 2 2 3 5 1 0 0
44. Write a program to check the equality of two matrices of the order 3 x 3.

1 2 3 1 2 3 Prints 1 2 3 1 2 3 Prints
4 5 6 4 5 6 Same 4 5 6 4 6 5 Different
7 8 9 7 8 9 7 8 9 7 8 9

45. Write a program to print the TRANSPOSE of a matrix size 3x3.

1 2 3 1 4 7
4 5 6 2 5 8
7 8 9 3 6 9

46. Write a program to multiply two matrix x[3][3] & y[3][3] and store the result in a third
matrix z[3][3], e.g

1 2 3 1 6 5 27 34 32
4 5 6 7 2 9 63 82 83
7 8 9 4 8 3 99 130 134

1x1+2x7+3x4 1x6+2x2+3x8 1x5+2x9+3x3
4x1+5x7+6x4 4x6+5x2+6x8 4x5+5x9+6x3
7x1+8x7+9x4 7x6+8x2+9x8 7x5+8x9+9x3
S.K.Jha (Faculty Of Computer Science [DAV])
IF YOU WIN YOU NEED NOT EXPLAIN ...
BUT IF YOU LOSE YOU SHOULD NOT BE THERE TO
EXPLAIN ...

Potrebbero piacerti anche