NEW
Font size
WorksheetsArray and string unit 7
Total questions: 10
Worksheet time: 5mins
What is the correct way to declare a string in C
a. string name;
b. char name[];
c. char name();
d. string[] name;
Which library is used for string manipulation functions in C
string.h
stdio.h
math.h
time.h
What function is used to find the length of a string in C
len()
length()
strlen()
strlength()
Which function is used to concatenate two strings in C
strcat()
all
concat()
. append()
What is the correct way to compare two strings in C
strcompare()
compare()
strcmp()
str_equal()
Which function is used to copy one string to another in C
copy()
strcopy()
strcpy()
duplicate()
Which character is used to represent the end of a string in C
\n
0
\0
1
What is the primary difference between an array and a string in C
Arrays are one-dimensional, and strings are two-dimensional.
Arrays are fixed-size collections, while strings are dynamic.
Arrays can store any data type, while strings specifically store characters.
Arrays are null-terminated, and strings are not.
How are arrays and strings related in C
Arrays and strings are entirely different concepts.
Arrays are a more flexible version of strings.
Strings are a specific use case of character arrays.
Arrays can only store integers, while strings can store characters.
What is the purpose of the null character ('\0') in C strings
It marks the end of the array.
It signifies the end of the string.
It represents a space character in strings.
It indicates the beginning of the string.
