Discussion
What is the syntax for accessing the element at index 7 of an array a?
Answer: D
Correct answer: a[7]
C uses square brackets for subscripting, so the element at index 7 is a[7]. Braces are for initialiser lists, parentheses would be read as a function call, and quotes make a string literal. Note that a[7] is the eighth element, since indexing starts at 0.
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