← Quiz: C Arrays and Strings: all 10 questions
Quiz: C Arrays and Strings · Question 4 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int a[] = {5, 10, 15, 20};
printf("%d", a[1] + a[3]);
return 0;
}
- A.15
- B.30
- C.25
- D.35
Answer & explanation
Correct answer: 30
a[1] = 10 and a[3] = 20, so 30.
Can you get the rest right without peeking?
Take the timed Quiz: C Arrays and Strings quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →