Discussion
The C declaration
int b [100];
reserves ____________ successive memory locations,each large enough to contain single integer.
Answer: C
Correct answer: 100
int b[100]; declares an array of 100 elements, so it reserves 100 successive locations each large enough for one int.
The bytes occupied would be \( 100 \times \mathtt{sizeof(int)} \) - 400 on a typical implementation - but the question asks for locations each holding a single integer, which is the element count. Note also that the valid indices run from 0 to 99; using b[100] is the classic off-by-one error, and C performs no bounds checking to catch it.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development