Question:

The length of the number of data elements of the array can be obtained from the index set by which of the following formula?

Show Hint

Always add \(+1\) because both bounds are inclusive.
Updated On: Jun 5, 2026
  • Lower bound $-$ Upper bound $- 1$
  • Upper bound $-$ Lower bound $+ 1$
  • Lower bound $-$ Upper bound $+ 1$
  • Upper bound $-$ Lower bound $- 1$
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Concept: Array indexing defines the range of elements using lower bound (LB) and upper bound (UB).

Step 1:
Understand bounds.
• Lower Bound (LB): Starting index
• Upper Bound (UB): Ending index

Step 2:
Count total elements. Number of elements includes both LB and UB: \[ \text{Number of elements} = UB - LB + 1 \]

Step 3:
Example verification. If LB = 1, UB = 5: \[ 5 - 1 + 1 = 5 \text{ elements} \]

Step 4:
Conclusion. \[ \boxed{UB - LB + 1} \]
Was this answer helpful?
0
0

Top CUET PG Logic Circuits Questions

View More Questions