WorksheetsStrings
Total questions: 6
Worksheet time: 3mins
What is returned from strlen("test\n");
4
5
6
7
Given char buffer[81], which statement correctly reads a single line into buffer?
gets(buffer);
fgets(buffer, 81, stdin);
scanf("%s", buffer);
scanf("%80s", buffer);
Given char buffer[81], which statement correctly reads a single word into buffer?
gets(buffer);
fgets(buffer, 81, stdin);
scanf("%s", buffer);
scanf("%80s", buffer);
Which expression is true, if pointer test points to string with content "test"?
test == "test"
strcmp(test, "test") == 0
strcmp(test, "test")
strstr(test, "test") == 0
We have char str[81] = "test". How do we concatenate it with "string"?
strcat(str, "string");
strcpy(str, "string");
str += "string";
str = "teststring";
Let
char *test = "teststring";
char *ptr = strstr(test, "str");
What is the value of ptr - test?
Undefined.
0
4
5
