C Strings Questions and Answers
Practice ModeShowing 10 of 26 questions
Q1
Which of the following function sets first n characters of a string to a given character?
Answer: Option B
Q2
If the two strings are identical, then strcmp() function returns
Answer: Option C
Q3
How will you print \n on the screen?
Answer: Option D
Q4
The library function used to find the last occurrence of a character in a string is
Answer: Option C
Q5
Which of the following function is used to find the first occurrence of a given string in another string?
Answer: Option C
Q6
Which of the following function is more appropriate for reading in a multi-word string?
Answer: Option C
Q7
Which of the following function is correct that finds the length of a string?
Answer: Option A
Q8
The number of bits used in extended ASCII is
Answer: Option B
Q9
Given a declaration and initialization statement as shown below,
char a [200] = {'0';}
What is the output of the following printf statment ?
Answer: Option A
Q10
Given a declaration and initilization as shown below,
char a [6] = {'1', '2', '3', };
What is the output of the following printf statement ?
printf ("%c %c %c %c %c", a[0], a[3], a[4], a[2], a[4], a[1]);
Answer: Option C