🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: String Handling in C: questions with answers

15 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. What is wrong with char s = "hello"; s[0] = 'H';?
  3. Q3. strcmp("apple", "apply") returns:
  4. Q4. What does this print? (code)
  5. Q5. Why is snprintf preferred over sprintf?
  6. Q6. After this code, what is in csv? (code)
  7. Q7. Why is strtol safer than atoi for converting text to a number?
  8. Q8. What does this print? (code)
  9. Q9. Which statement about strtok is true?
  10. Q10. In the copy loop while ((d++ = s++) != '\0');, when does the loop stop?
  11. Q11. What does this print? (code)
  12. Q12. What does this print? (code)
  13. Q13. What does this print? (code)
  14. Q14. For char a[] = "hi";, what is sizeof(a)?
  15. Q15. What does this print? (code)