Area of Improvements

Review your assessments and practice — drill into each subject, then each attempt, then each question.

Back to summary
C Programming · Round 1

Question 6 of 10

Topic: Input/output (printf/scanf)Difficulty: EasyBloom: Analyze
Question

What are common pitfalls when working with arrays and pointers in C?

Result
Knowledge
78%
Delivery
75%
Technical relevancy
82%
Technical term match
70%
Your recording
Your transcript

Off-by-one errors, going past the end of the array. Also forgetting that array name decays to a pointer when you pass it to a function, so sizeof gives you the pointer size instead of the array size.

Better answer

Top pitfalls: (1) array-to-pointer decay losing length information across function calls — pass length explicitly; (2) off-by-one on the upper bound (use < length, not <=); (3) reading/writing one past the end (undefined behaviour); (4) assuming sizeof(arr) inside a function gives array size; (5) pointer arithmetic on void* or across unrelated allocations.

Coverage
Hit 3 of 5
  • Mentions array-to-pointer decay
  • Mentions off-by-one on bounds
  • Notes sizeof inside function returns pointer size
  • Calls out undefined behaviour on out-of-bounds access
  • Warns against pointer arithmetic across allocations
Gaps
  • Did not label out-of-bounds access as undefined behaviour
  • Skipped pointer arithmetic across unrelated buffers
Misconceptions

None detected.