C Programming Tutorial 0/65 lessons ~6 min read Lesson 28

    Quiz: Arrays | Strings

    Quiz: Arrays | Strings checks how well you can apply Index of first and last element and Null terminator in strings (and related ideas) in C.

    Course progress0%
    Focus
    8 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    Quiz: Arrays | Strings checks how well you can apply Index of first and last element and Null terminator in strings (and related ideas) in C. Try each prompt in a scratch file before moving on.

    Understanding the topic

    Challenge 1 In your own words — or with a tiny program — show that you understand: Index of first and last element.

    Challenge 2 In your own words — or with a tiny program — show that you understand: Null terminator in strings.

    Challenge 3 In your own words — or with a tiny program — show that you understand: sizeof array vs pointer.

    Challenge 4 In your own words — or with a tiny program — show that you understand: strcpy vs strncpy safety.

    • Challenge 1 — In your own words — or with a tiny program — show that you understand: Index of first and last element.
    • Challenge 2 — In your own words — or with a tiny program — show that you understand: Null terminator in strings.
    • Challenge 3 — In your own words — or with a tiny program — show that you understand: sizeof array vs pointer.
    • Challenge 4 — In your own words — or with a tiny program — show that you understand: strcpy vs strncpy safety.

    Step-by-step explanation

    1. Challenge 1 — In your own words — or with a tiny program — show that you understand: Index of first and last element.
    2. Challenge 2 — In your own words — or with a tiny program — show that you understand: Null terminator in strings.
    3. Challenge 3 — In your own words — or with a tiny program — show that you understand: sizeof array vs pointer.
    4. Challenge 4 — In your own words — or with a tiny program — show that you understand: strcpy vs strncpy safety.

    Execution workflow

    1Quiz: Arrays | Strings — step by step
    1 / 4

    Challenge 1

    In your own words — or with a tiny program — show that you understand: Index of first and last element.

    Best practices

    • Enable warnings: gcc -Wall -Wextra -std=c11 source.c -o app
    • Give every variable a defined value before it is read.
    • Stay inside array bounds — C will not stop you from over-running a buffer.

    Common mistakes

    • Reading uninitialized storage — behavior is undefined.
    • Dismissing compiler warnings instead of fixing root causes.
    • Ignoring NULL returns from malloc, fopen, and similar APIs.

    Hands-on exercise

    Practice problems:

    • Build or explain: Index of first and last element
    • Build or explain: Null terminator in strings
    • Build or explain: sizeof array vs pointer
    • Build or explain: strcpy vs strncpy safety

    Summary

    Quiz: Arrays | Strings in C — Self-check on indexing and C strings.

    Ready to mark this lesson complete?Track your journey across the entire course.