C String Basics Quiz
9 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following is NOT a valid string in C?

  • "Hello, world!"
  • 'C programming'
  • ""
  • 12345 (correct)
  • What is the maximum length of a string in C?

  • 1024 characters
  • 255 characters
  • There is no maximum length (correct)
  • 512 characters
  • Which function can be used to concatenate two strings in C?

  • strncpy()
  • strncat()
  • strcat() (correct)
  • strcpy()
  • Which of the following is a valid way to declare a string in C?

    <p>char s[] = 'hello';</p> Signup and view all the answers

    What is the result of the following code snippet? char s[] = 'hello'; printf('%c', s[5]);

    <p>It will print a blank space</p> Signup and view all the answers

    Which of the following functions can be used to compare two strings in C?

    <p>strcmp()</p> Signup and view all the answers

    Which of the following is the correct way to declare a 2D array in C?

    <p>int arr[2][2];</p> Signup and view all the answers

    What is the correct way to access an element in a 2D array in C?

    <p>arr[row][col];</p> Signup and view all the answers

    What is the size of a 2D array declared as int arr[3][4]; in C?

    <p>12 elements</p> Signup and view all the answers

    More Like This

    Computer Basics and Memory Organization Quiz
    24 questions
    Python Basics Quiz
    40 questions

    Python Basics Quiz

    EverlastingCopernicium avatar
    EverlastingCopernicium
    Python Strings Basics Quiz
    5 questions

    Python Strings Basics Quiz

    SalutaryLivermorium9721 avatar
    SalutaryLivermorium9721
    Spring Boot Basics Quiz
    5 questions

    Spring Boot Basics Quiz

    SpontaneousMossAgate5289 avatar
    SpontaneousMossAgate5289
    Use Quizgecko on...
    Browser
    Browser