C++ Arrays Assignment

)

1. Arrays are ————– data types.

2. Arrays are used to store data, which is in ————— form having ———— type.

3. In C++ array subscripts starts from ————-

4. Each element of array can be directly accessed through —————-

5. Array reserves adjacent memory locations. [T/F]

6. Types of arrays are ————————————————–

7. One dimensional array is a type of array in which each element of array can be ——–

8. List is an example of one-dimensional array. [T/F]

9. Table/Matrix is an example of ————- dimensional array in which each element can be accessed through ————- subscript.

10. Limitation of static array ———————-

11. In array, there is no bound check…explain? ————————————————–

12. Array size must be fixed…Explain? ———————————————————–

13. int m[5] = {12,23,34,45,56,67}; Comment? ————————————————–

14. int m[] = {12,23,34,45,56,67}; Comment? ————————————————–

15. {float m[5]; int size = sizeof(m); int element = size/2; cout << size << element;} Output?

16. To access 4th element of above mentioned array m, we write ——————————

17. m[3] is also called subscripted variable. [T/F]

18. {int m[5]={0}; for (int k=0; k<5; k++) cout <<m[k];} Output?————————–

19. {int m[5]={0}; for (int k=0; k<9; k++) m[k]=m[10 – k]%2; Contents of array?——

20. By default, Arrays are passed to functions by Reference. [T/F]

21. When array is passed to function, there is no need to specify the size of array in the prototype and function definition statement. [T/F]

22. When two-dimensional array is passed to function, the number of rows can be skipped, but we have to specify the number of columns, in prototype and function definition statement. [T/F]

23. Store 70 student’s score in a list (range 0 – 500), determine how many students are greater than or equal to 70% and how many are below this percentage.

24. In a class there may be 100 students. Write a C++ program that reads number of students from user, then store class number and marks obtained (out of 50) of each student, calculate each students percentage, assign appropriate grade. Calculate class average, then display results in the format:

CNO MARKS %age GRADE

—— ——— —— ———-

—— ——— —— ———-

CLASS AVERAGE: ———-

25. Find class number(s) of students got maximum and minimum marks in above-mentioned problem.

26. Sort class numbers of students with respect to marks (Selection Sort & Bubble Sort), then display the sorted list. (Problem No. 24)

27. Search and display the record of a student (CNO, MARKS, %age, GRADE) entered by user. (Problem No. 24) (Seq. Search & Binary Search)

28. Give 3 examples of each, initializing 2-dim and 3-dim character array.

29. Calculate RowSum, ColSum and OverallSum, store them on Row # 4, Col # 4 & Display the following table:

2 4 5
4 -1 7
2 9 3

30. Read 50 numbers in a list from user. Perform the following two operations on the list.

insert (list, data, position), if there is a space in array

delete (list, position), if position has some data to be deleted

31. Read two lists, find there union and intersection and display the results. Elements in the resultant lists must be unique.

32. Read two matrices and perform multiplication operation on them. Validate your input and processing through proper checks.

33. Make changes in program given in Q.24; write a C++ program that inputs 50 student’s data and displays result in the following format.

St # St Name Subject1 Subject2 Subject3 Total % age Grade
1 Ali 78 90 56 224 74.66 B+
2 Ahmad 90 34 91 215 71.66 B

34. Read a text line from user. Decompose it into words, store it, arrange it in alphabetical order and display it.