CSC 130 Chapter 8

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

Which statement is false?

*- Function strcpy copies its first argument into its second argument.* - Function strncpy does not necessarily copy the terminating null character of its second argument. - A common error is not appending a terminating null character to the first argument of a strncpy when the third argument is less than or equal to the length of the string in the second argument. - The first character of the second argument of strcat replaces the null character that terminates the string in the first argument.

Which statement about the memory functions of the string handling library is false?

*- The functions treat blocks of memory as strings.* - The functions facilitate manipulating, comparing and searching blocks of memory. - The pointer parameters to these functions are defined void *. - A void * pointer cannot be dereferenced.

Function strcspn returns __________.

*- a length* - a range of characters - the starting and ending positions of a range of characters - a char

__________ values can consist of the digits 0 through 9 and the letters A through F.

*- hexadecimal* - binary - octal - decimal

The functions of the character-handling library typically manipulate characters as ___________.

*- ints.* - floats. - longs. - bits.

To change the string "ABCDEFGHI" to "aaaaaFGHI" you would use the _________ function.

*- memset* - memcmp - memchr - memcopy

+, \ and $ are all examples of __________.

*- special characters* - strings - operators - literals

Every function of the string handling library except for __________ appends the null character to its result.

*- strncpy* - strncat - strcpy - strcat

Which statement is true?

*- strtok modifies the input string.* - strtok makes a backup copy of the input string. - The first argument of each call to strtok is the string being tokenized. - strtok works only with a set of four predefined delimiters.

The strlen function returns ________.

*- the number of characters in a string excluding the null character* - the number of characters in a string including the null character - the ASCII representation of the character - none of these

Which of the following is not a whitespace character?

- '\n' - '\f' - '\r' *- '\w'*

memcmp would return ___________ for the call memcmp("Hi, how are you?", "Hi, how are things?", 6);

- -1 - a negative number. *- zero.* - a positive number.

The number 4 typically takes up _________ bit(s) when stored as a character on most of today's computers.

- 1 - 2 - 3 *- 8*

Which of the following is false?

- A string may include letters, digits, and various special characters (i.e., +, -, *). - A string in C is an array of characters ending in the null character ('\0'). *- String literals are written inside of single quotes* - A string may be assigned in a definition to either a character array or a variable of type char *.

Which statement is false?

- Function atof returns a double version of its argument. - If the converted value cannot be represented, the behavior of atoi is undefined. *- When using functions from the general utilities library, its header file must be included.* - Function strtol receives three arguments.

Which statement is false?

- Function strerror takes an error number and creates an error message string. - Function strerror maps its integer argument into a full text string in a system-dependent manner *- Function strlen determines the length of a string including the null character.* - Function strerror does not display its string output.

Which statement about strtok is false?

- It breaks a string into tokens. - Subsequent calls to continue tokenizing the same string contain NULL as the first argument. *- The length of the current token is returned by each call.* - If there are no more tokens when the function is called, NULL is returned.

What is the output of the following statement? printf( "%s", strspn( "Cows like to moo.", "Ceiklosw " );

- Nothing. *- 10* - 8 - e

The isxdigit (is hex digit) function would return false on

- a - A - 2 *- g*

A string in C is __________.

- an array of characters ending in the empty string - a sequence of characters contained within single quotes - a sequence of characters preceded by a length field *- an array of characters ending in the null character*

ASCII and EBCDIC are

- characters - strings *- character sets* - character comparison operators

Function __________ takes an error number and creates an error message string.

- errorstr *- strerror* - badstr - strfail

Function __________ searches for the first occurrence of a character in a string.

- firstchar - getfirst - firstchr *- strchr*

Function __________ inputs the next character from the standard input and returns it as an integer.

- inputchr - getchr - inputchar *- getchar*

Function fgets appends a __________ to its array target in memory.

- leading null character - leading end-of-file character *- terminating null character* - terminating end-of-file character

Which character-handling library function converts lowercase letters to uppercase letters?

- lowertoupper - isupper - touppercase *- toupper*

The ___________ function allows characters of one part of a string to be copied into another part of the string.

- memchr - memcmp - memset *- memmove*

What memory function of the string handling library copies an unsigned char into a specified number of the leading locations pointed to by its first argument?

- memcpy - memmove *- memset* - memlead

The strtol and stroul functions do not

- need a special header file in order to be used. - take three arguments. *- have to convert the entire string they are given.* - have the ability to output data in base 8.

strtok does not

- replace each delimiting character with '\0' - return a pointer to the token it creates *- tokenize the entire a string when it's called* - modify the input string

A character constant is a(n) __________ value represented as a character in single quotes.

- short *- int* - long - double

The integral type of the value returned by operator sizeof is __________.

- size-t - sizet - size.t *- size_t*

Function strcmp returns __________ if its first argument is equal to its second argument.

- specifically 1 - any non-zero value (i.e., true) *- specifically 0* - any negative value

Which statement is true?

- sprintf takes its input from a character array. - sprintf prints its output in string format on the screen. *- sprintf stores its output in a character array.* - sprintf is a secure version of printf.

Assuming that string1 = "hello" and string2 = "hello world", Which of the following returns 0?

- strcmp(string1, string2); - strcmp(string1, string2, 6); - strncmp(string1, string2, 6); *- strncmp(string1, string2, 5);*

Which function would be the most useful for determining if a certain word is contained in a string representing a sentence?

- strcspn - strchr *- strstr* - strrchr

'\n' represents the integer value of

- the character n - the string n *- newline* - nextline

Which is not a capability of the string-handling library?

- tokenizing strings - comparing strings - searching strings *- inputting strings*


Kaugnay na mga set ng pag-aaral

Microbiology (Dr. AL, LSUE) Exam 2

View Set

Block-By-Block Instructions for completion of the CMS-1500 (02-12)

View Set

Mod 5 Intro to Info Sec WGU ~ Cryptography

View Set

Comprehensive AANP Review (LEIK/Barkley/Fitzgerald) pt. 3 (printed from TiffenyWade)

View Set