C String Basics Quiz

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'; (A)</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 (C)</p> Signup and view all the answers

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

<p>strcmp() (B)</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]; (A)</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]; (B)</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 (D)</p> Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

Python Basics Quiz
40 questions

Python Basics Quiz

EverlastingCopernicium avatar
EverlastingCopernicium
Spring Boot Basics Quiz
5 questions

Spring Boot Basics Quiz

SpontaneousMossAgate5289 avatar
SpontaneousMossAgate5289
Python Basics Quiz
48 questions

Python Basics Quiz

CrisperAnecdote avatar
CrisperAnecdote
String Indexing and Slicing Quiz
39 questions
Use Quizgecko on...
Browser
Browser