C Programming Chapter 11

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The value assigned to the NULL constant is ____.

'\0'

A string literal is also referred to as a character set.

False

If the contents of a string variable named destString are "Hello", then the function call strcat(destString, " there World!") results in the string value ____ being assigned to destString.

"Hello there World!"

Line ____ in the following section of code checks for the end-of-string character.1 void strcopy (char string1[], char string2[])2 {3 int i = 0;45 while (string2[i] != '\0')6 {7 string1[i] = string2[i];8 i++;9 }10 string1[i] = '\0';11 }

5

The array char message[81]; can be used to store a string of up to ____ characters.

80

When using #include, the characters ____, tell the compiler to begin searching for the included file in the C compiler system library directory.

<>

C provides built-in operations for complete arrays, such as array assignment or array comparison.

False

In C, '\n' is the sentinel marking the end of the string

False

The NULL statement is '\0';.

False

The first 256 characters of the Unicode code are identical to the complete 256-character ASCII code.

False

The function strtok(string, char) locates the position of the first occurrence of the char within string; it returns the address of the character.

False

Trying to enter the characters This is a string using the statement gets(message); results in the word This being assigned to the message array.

False

puts() substitutes \0 when an \n is encountered.

False

The string "Good Morning!" is stored in memory using a character array of size ____.

It is not: 13

When using # include, the chacters___, tell the compiler to start looking in the default directoty where the program file is located

It is not: <>

Programs that use the atoi() routine must include the ____ header file.

It is not: ctype.h string.h stdio.h

Typically, the ____ function is used to "assemble" a string from smaller pieces until a complete line of characters is ready to be written, either to the standard output device or to a file.

It is not: strcat() strcpy()

Complete the following function:/* copy string2 to string1 */void strcopy(char string1[], char string2[]){int i = 0;while (string2[i] != '\0'){string1[i] = string2[i];i++;}____}

It is not: string1[i+1] = '\';

The ____ function stops accepting characters only when a newline is detected.

It is not; scanf()

When using ____, a full path name requires that two backslashes be used to separate individual directory and filenames.

It it not: atoi tolower

Both '\n' and "\n" are recognized by the compiler as containing the newline character.

True

In C, a character is stored as an integer value.

True

One of the most common methods of validating input data is to accept all numbers as strings.

True

Pressing the Enter key at the terminal generates a newline character, ____.

\n

Programs that use the isalpha() routine must include the ____ header file.

ctype.h

In general, a scanf() function call can always be used in place of a gets() function call.

false

The double quotes in "Good Morning!" are part of the string.

false

The function strtok(string, char) locates the position of the first occurrence of the char within string; it returns the address of the character.

false

The getchar() and putchar() functions deal with strings as complete units.

false

The ____ function continuously accepts and stores the characters typed at the terminal into the character array passed as an argument.

gets()

In C, a string is stored as a ____ array of characters.

one-dimensional

strng[++i] shows an example of the use of the postfix increment operator.

printf("s\n, message);

Programs that use the gets() routine must include the ____ header file.

stdio.h

the function ___ appends str2 to the end of str1.

strcat(str1, str2)

A(n) ____ is any sequence of characters enclosed in double quotes.

string literal

Good programming practice requires that you end the last output display with a newline escape sequence, usually as the single character '\n'.

true

In C, a string is terminated by a special end-of-string symbolic constant named NULL.

true

In C, assignment and relational operations are not provided for strings.

true

In C, the individual characters in a string can be input, manipulated, or output using standard array-handling techniques utilizing either subscript or pointer notations.

true

Using string library functions requires that the file string.h be included in your program before the function is called.

true


Kaugnay na mga set ng pag-aaral

Management Theory & Practice ch. 10 smartbook

View Set

Intro to Nursing Concepts, PrepUs Ch 6

View Set

Chapter 14: Running Water - Geology of Streams and Floods Reading Notes

View Set