
Strings in C and Error Detection Worksheet
Authored by Sai Priyanka
Engineering
University

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A string in C is terminated by which character?
\t
\n
\0
EOF
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly declares a string?
char str[10];
char str;
string str[10];
char str[] = {'H','i'};
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? char s[] = "Hello"; printf("%d", sizeof(s));
4
5
6
Depends on compiler
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which header file is required for string functions in c?
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement is TRUE about strings in C?
Strings are primitive data types
Strings are arrays of characters
Strings cannot contain spaces
Strings end with \n
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does strlen() return?
Number of characters including \0
Number of characters excluding \0
Size of string in bytes
Always one less than array size
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which function is used to copy one string into another?
stradd()
strcpy()
strcat()
strcmp()
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?