🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C Arrays and Strings: all 10 questions

Quiz: C Arrays and Strings · Question 2 of 10

What are the values of int a[5] = {1, 2};?

What are the values of int a[5] = {1, 2};?

  1. A.1, 2, garbage, garbage, garbage
  2. B.1, 2, 0, 0, 0
  3. C.1, 2, 1, 2, 1
  4. D.Compile error
Answer & explanation

Correct answer: 1, 2, 0, 0, 0

Missing initial values in an array initialiser become 0.

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 →