C Programming Objective Questions (Up to 1D Arrays) - 100 MCQs
Questions:
1. Which of the following is the correct way to declare a 1D array of 1 integers?
(a) int arr(1);
(b) int arr[1];
(c) int arr{1};
(d) int arr<1>;
2. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 4;
printf("%d", arr[2]);
(a) 4
(b) 0
(c) Compilation error
(d) Garbage value
3. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
4. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
5. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
6. Which of the following is the correct way to declare a 1D array of 6 integers?
(a) int arr(6);
(b) int arr[6];
(c) int arr{6};
(d) int arr<6>;
7. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 14;
printf("%d", arr[7]);
(a) 14
(b) 0
(c) Compilation error
(d) Garbage value
8. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
9. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
10. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
11. Which of the following is the correct way to declare a 1D array of 11 integers?
(a) int arr(11);
(b) int arr[11];
(c) int arr{11};
(d) int arr<11>;
12. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 24;
printf("%d", arr[2]);
(a) 24
(b) 0
(c) Compilation error
(d) Garbage value
13. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
14. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
15. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
16. Which of the following is the correct way to declare a 1D array of 16 integers?
(a) int arr(16);
(b) int arr[16];
(c) int arr{16};
(d) int arr<16>;
17. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 34;
printf("%d", arr[7]);
(a) 34
(b) 0
(c) Compilation error
(d) Garbage value
18. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
19. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
20. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
21. Which of the following is the correct way to declare a 1D array of 21 integers?
(a) int arr(21);
(b) int arr[21];
(c) int arr{21};
(d) int arr<21>;
22. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 44;
printf("%d", arr[2]);
(a) 44
(b) 0
(c) Compilation error
(d) Garbage value
23. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
24. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
25. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
26. Which of the following is the correct way to declare a 1D array of 26 integers?
(a) int arr(26);
(b) int arr[26];
(c) int arr{26};
(d) int arr<26>;
27. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 54;
printf("%d", arr[7]);
(a) 54
(b) 0
(c) Compilation error
(d) Garbage value
28. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
29. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
30. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
31. Which of the following is the correct way to declare a 1D array of 31 integers?
(a) int arr(31);
(b) int arr[31];
(c) int arr{31};
(d) int arr<31>;
32. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 64;
printf("%d", arr[2]);
(a) 64
(b) 0
(c) Compilation error
(d) Garbage value
33. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
34. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
35. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
36. Which of the following is the correct way to declare a 1D array of 36 integers?
(a) int arr(36);
(b) int arr[36];
(c) int arr{36};
(d) int arr<36>;
37. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 74;
printf("%d", arr[7]);
(a) 74
(b) 0
(c) Compilation error
(d) Garbage value
38. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
39. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
40. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
41. Which of the following is the correct way to declare a 1D array of 41 integers?
(a) int arr(41);
(b) int arr[41];
(c) int arr{41};
(d) int arr<41>;
42. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 84;
printf("%d", arr[2]);
(a) 84
(b) 0
(c) Compilation error
(d) Garbage value
43. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
44. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
45. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
46. Which of the following is the correct way to declare a 1D array of 46 integers?
(a) int arr(46);
(b) int arr[46];
(c) int arr{46};
(d) int arr<46>;
47. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 94;
printf("%d", arr[7]);
(a) 94
(b) 0
(c) Compilation error
(d) Garbage value
48. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
49. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
50. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
51. Which of the following is the correct way to declare a 1D array of 51 integers?
(a) int arr(51);
(b) int arr[51];
(c) int arr{51};
(d) int arr<51>;
52. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 104;
printf("%d", arr[2]);
(a) 104
(b) 0
(c) Compilation error
(d) Garbage value
53. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
54. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
55. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
56. Which of the following is the correct way to declare a 1D array of 56 integers?
(a) int arr(56);
(b) int arr[56];
(c) int arr{56};
(d) int arr<56>;
57. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 114;
printf("%d", arr[7]);
(a) 114
(b) 0
(c) Compilation error
(d) Garbage value
58. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
59. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
60. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
61. Which of the following is the correct way to declare a 1D array of 61 integers?
(a) int arr(61);
(b) int arr[61];
(c) int arr{61};
(d) int arr<61>;
62. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 124;
printf("%d", arr[2]);
(a) 124
(b) 0
(c) Compilation error
(d) Garbage value
63. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
64. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
65. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
66. Which of the following is the correct way to declare a 1D array of 66 integers?
(a) int arr(66);
(b) int arr[66];
(c) int arr{66};
(d) int arr<66>;
67. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 134;
printf("%d", arr[7]);
(a) 134
(b) 0
(c) Compilation error
(d) Garbage value
68. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
69. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
70. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
71. Which of the following is the correct way to declare a 1D array of 71 integers?
(a) int arr(71);
(b) int arr[71];
(c) int arr{71};
(d) int arr<71>;
72. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 144;
printf("%d", arr[2]);
(a) 144
(b) 0
(c) Compilation error
(d) Garbage value
73. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
74. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
75. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
76. Which of the following is the correct way to declare a 1D array of 76 integers?
(a) int arr(76);
(b) int arr[76];
(c) int arr{76};
(d) int arr<76>;
77. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 154;
printf("%d", arr[7]);
(a) 154
(b) 0
(c) Compilation error
(d) Garbage value
78. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
79. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
80. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
81. Which of the following is the correct way to declare a 1D array of 81 integers?
(a) int arr(81);
(b) int arr[81];
(c) int arr{81};
(d) int arr<81>;
82. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 164;
printf("%d", arr[2]);
(a) 164
(b) 0
(c) Compilation error
(d) Garbage value
83. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
84. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
85. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
86. Which of the following is the correct way to declare a 1D array of 86 integers?
(a) int arr(86);
(b) int arr[86];
(c) int arr{86};
(d) int arr<86>;
87. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 174;
printf("%d", arr[7]);
(a) 174
(b) 0
(c) Compilation error
(d) Garbage value
88. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
89. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
90. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
91. Which of the following is the correct way to declare a 1D array of 91 integers?
(a) int arr(91);
(b) int arr[91];
(c) int arr{91};
(d) int arr<91>;
92. What is the value of arr[2] after the following code?
int arr[10] = {0};
arr[2] = 184;
printf("%d", arr[2]);
(a) 184
(b) 0
(c) Compilation error
(d) Garbage value
93. Which of the following accesses the 4th element in an array?
(a) arr[3]
(b) arr[4]
(c) arr[2]
(d) arr[5]
94. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
95. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
96. Which of the following is the correct way to declare a 1D array of 96 integers?
(a) int arr(96);
(b) int arr[96];
(c) int arr{96};
(d) int arr<96>;
97. What is the value of arr[7] after the following code?
int arr[10] = {0};
arr[7] = 194;
printf("%d", arr[7]);
(a) 194
(b) 0
(c) Compilation error
(d) Garbage value
98. Which of the following accesses the 9th element in an array?
(a) arr[8]
(b) arr[9]
(c) arr[7]
(d) arr[10]
99. What will be the output of the following?
int arr[5] = {1,2,3};
printf("%d", arr[4]);
(a) 1
(b) 2
(c) 3
(d) 0
100. Which statement about 1D arrays is true?
(a) Array size can be changed after declaration
(b) Uninitialized local array elements have default 0
(c) Index starts from 0
(d) arr[10] accesses the 10th element
Answers and Explanations
1. (b) int arr[1];
Explanation: Standard syntax for declaring an integer array in C.
2. (a) 4
Explanation: Value assigned explicitly to arr[2].
3. (a) arr[3]
Explanation: C arrays are 0-indexed.
4. (d) 0
Explanation: Only first three values initialized; rest are 0.
5. (c) Index starts from 0
Explanation: C arrays start from index 0.
6. (b) int arr[6];
Explanation: Standard syntax for declaring an integer array in C.
7. (a) 14
Explanation: Value assigned explicitly to arr[7].
8. (a) arr[8]
Explanation: C arrays are 0-indexed.
9. (d) 0
Explanation: Only first three values initialized; rest are 0.
10. (c) Index starts from 0
Explanation: C arrays start from index 0.
11. (b) int arr[11];
Explanation: Standard syntax for declaring an integer array in C.
12. (a) 24
Explanation: Value assigned explicitly to arr[2].
13. (a) arr[3]
Explanation: C arrays are 0-indexed.
14. (d) 0
Explanation: Only first three values initialized; rest are 0.
15. (c) Index starts from 0
Explanation: C arrays start from index 0.
16. (b) int arr[16];
Explanation: Standard syntax for declaring an integer array in C.
17. (a) 34
Explanation: Value assigned explicitly to arr[7].
18. (a) arr[8]
Explanation: C arrays are 0-indexed.
19. (d) 0
Explanation: Only first three values initialized; rest are 0.
20. (c) Index starts from 0
Explanation: C arrays start from index 0.
21. (b) int arr[21];
Explanation: Standard syntax for declaring an integer array in C.
22. (a) 44
Explanation: Value assigned explicitly to arr[2].
23. (a) arr[3]
Explanation: C arrays are 0-indexed.
24. (d) 0
Explanation: Only first three values initialized; rest are 0.
25. (c) Index starts from 0
Explanation: C arrays start from index 0.
26. (b) int arr[26];
Explanation: Standard syntax for declaring an integer array in C.
27. (a) 54
Explanation: Value assigned explicitly to arr[7].
28. (a) arr[8]
Explanation: C arrays are 0-indexed.
29. (d) 0
Explanation: Only first three values initialized; rest are 0.
30. (c) Index starts from 0
Explanation: C arrays start from index 0.
31. (b) int arr[31];
Explanation: Standard syntax for declaring an integer array in C.
32. (a) 64
Explanation: Value assigned explicitly to arr[2].
33. (a) arr[3]
Explanation: C arrays are 0-indexed.
34. (d) 0
Explanation: Only first three values initialized; rest are 0.
35. (c) Index starts from 0
Explanation: C arrays start from index 0.
36. (b) int arr[36];
Explanation: Standard syntax for declaring an integer array in C.
37. (a) 74
Explanation: Value assigned explicitly to arr[7].
38. (a) arr[8]
Explanation: C arrays are 0-indexed.
39. (d) 0
Explanation: Only first three values initialized; rest are 0.
40. (c) Index starts from 0
Explanation: C arrays start from index 0.
41. (b) int arr[41];
Explanation: Standard syntax for declaring an integer array in C.
42. (a) 84
Explanation: Value assigned explicitly to arr[2].
43. (a) arr[3]
Explanation: C arrays are 0-indexed.
44. (d) 0
Explanation: Only first three values initialized; rest are 0.
45. (c) Index starts from 0
Explanation: C arrays start from index 0.
46. (b) int arr[46];
Explanation: Standard syntax for declaring an integer array in C.
47. (a) 94
Explanation: Value assigned explicitly to arr[7].
48. (a) arr[8]
Explanation: C arrays are 0-indexed.
49. (d) 0
Explanation: Only first three values initialized; rest are 0.
50. (c) Index starts from 0
Explanation: C arrays start from index 0.
51. (b) int arr[51];
Explanation: Standard syntax for declaring an integer array in C.
52. (a) 104
Explanation: Value assigned explicitly to arr[2].
53. (a) arr[3]
Explanation: C arrays are 0-indexed.
54. (d) 0
Explanation: Only first three values initialized; rest are 0.
55. (c) Index starts from 0
Explanation: C arrays start from index 0.
56. (b) int arr[56];
Explanation: Standard syntax for declaring an integer array in C.
57. (a) 114
Explanation: Value assigned explicitly to arr[7].
58. (a) arr[8]
Explanation: C arrays are 0-indexed.
59. (d) 0
Explanation: Only first three values initialized; rest are 0.
60. (c) Index starts from 0
Explanation: C arrays start from index 0.
61. (b) int arr[61];
Explanation: Standard syntax for declaring an integer array in C.
62. (a) 124
Explanation: Value assigned explicitly to arr[2].
63. (a) arr[3]
Explanation: C arrays are 0-indexed.
64. (d) 0
Explanation: Only first three values initialized; rest are 0.
65. (c) Index starts from 0
Explanation: C arrays start from index 0.
66. (b) int arr[66];
Explanation: Standard syntax for declaring an integer array in C.
67. (a) 134
Explanation: Value assigned explicitly to arr[7].
68. (a) arr[8]
Explanation: C arrays are 0-indexed.
69. (d) 0
Explanation: Only first three values initialized; rest are 0.
70. (c) Index starts from 0
Explanation: C arrays start from index 0.
71. (b) int arr[71];
Explanation: Standard syntax for declaring an integer array in C.
72. (a) 144
Explanation: Value assigned explicitly to arr[2].
73. (a) arr[3]
Explanation: C arrays are 0-indexed.
74. (d) 0
Explanation: Only first three values initialized; rest are 0.
75. (c) Index starts from 0
Explanation: C arrays start from index 0.
76. (b) int arr[76];
Explanation: Standard syntax for declaring an integer array in C.
77. (a) 154
Explanation: Value assigned explicitly to arr[7].
78. (a) arr[8]
Explanation: C arrays are 0-indexed.
79. (d) 0
Explanation: Only first three values initialized; rest are 0.
80. (c) Index starts from 0
Explanation: C arrays start from index 0.
81. (b) int arr[81];
Explanation: Standard syntax for declaring an integer array in C.
82. (a) 164
Explanation: Value assigned explicitly to arr[2].
83. (a) arr[3]
Explanation: C arrays are 0-indexed.
84. (d) 0
Explanation: Only first three values initialized; rest are 0.
85. (c) Index starts from 0
Explanation: C arrays start from index 0.
86. (b) int arr[86];
Explanation: Standard syntax for declaring an integer array in C.
87. (a) 174
Explanation: Value assigned explicitly to arr[7].
88. (a) arr[8]
Explanation: C arrays are 0-indexed.
89. (d) 0
Explanation: Only first three values initialized; rest are 0.
90. (c) Index starts from 0
Explanation: C arrays start from index 0.
91. (b) int arr[91];
Explanation: Standard syntax for declaring an integer array in C.
92. (a) 184
Explanation: Value assigned explicitly to arr[2].
93. (a) arr[3]
Explanation: C arrays are 0-indexed.
94. (d) 0
Explanation: Only first three values initialized; rest are 0.
95. (c) Index starts from 0
Explanation: C arrays start from index 0.
96. (b) int arr[96];
Explanation: Standard syntax for declaring an integer array in C.
97. (a) 194
Explanation: Value assigned explicitly to arr[7].
98. (a) arr[8]
Explanation: C arrays are 0-indexed.
99. (d) 0
Explanation: Only first three values initialized; rest are 0.
100. (c) Index starts from 0
Explanation: C arrays start from index 0.