Search Header Logo

Strings

Authored by Pavol Zajac

Computers

University

Used 6+ times

Strings
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is returned from strlen("test\n");

4

5

6

7

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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);

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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);

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

We have char str[81] = "test". How do we concatenate it with "string"?

strcat(str, "string");

strcpy(str, "string");

str += "string";

str = "teststring";

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Let

char *test = "teststring";

char *ptr = strstr(test, "str");

What is the value of ptr - test?

Undefined.

0

4

5

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?