🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

C String Basics Quiz
9 Questions
0 Views

C String Basics Quiz

Created by
@CongenialCreativity

Podcast Beta

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 Quizzes Like This

    Java String (Basic)
    30 questions

    Java String (Basic)

    AwedExuberance avatar
    AwedExuberance
    Java String Handling Basics
    10 questions
    Python Strings and Functions Basics
    5 questions
    Java String Operations Flashcards (Weeks 3-6)
    35 questions
    Use Quizgecko on...
    Browser
    Browser