Deck 9: Character Strings
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/51
العب
ملء الشاشة (f)
Deck 9: Character Strings
1
A string literal is also referred to as a character set.
False
2
In C, a string is terminated by a special end-of-string symbolic constant named NULL.
True
3
In C, '\n' is the sentinel marking the end of the string.
False
4
The double quotes in "Good Morning!" are part of the string.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
5
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
6
The getchar() and putchar() functions deal with strings as complete units.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
7
In general, a scanf() function call can always be used in place of a gets() function call.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
8
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
9
gets() substitutes \0 when an \n is encountered.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
10
puts() substitutes \0 when an \n is encountered.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
11
Both '\n' and "\n" are recognized by the compiler as containing the newline character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
12
Good programming practice requires that you end the last output display with a newline escape sequence, usually as the single character '\n'.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
13
In C, a character is stored as an integer value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
14
strng[++i] shows an example of the use of the postfix increment operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
15
The NULL statement is '\0';.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
16
C provides built-in operations for complete arrays, such as array assignment or array comparison.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
17
In C, assignment and relational operations are not provided for strings.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
18
The function strtok(string, char) locates the position of the first occurrence of the char within string; it returns the address of the character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
19
Using string library functions requires that the file string.h be included in your program before the function is called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
20
Attempting to copy a larger string value into the destination array using strcpy causes the copy to overflow the destination array beginning with the memory area immediately following the last array element.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
21
The first 256 characters of the Unicode code are identical to the complete 256-character ASCII code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
22
toupper() returns the uppercase equivalent of its argument if the character is lowercase; otherwise, it returns NULL.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
23
The char[] itoa(string) function converts an integer to an ASCII string.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
24
One of the most common methods of validating input data is to accept all numbers as strings.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
25
When you use any of the four functions, printf(), scanf(), sprintf(), or sscanf(), the control string containing the conversion control sequences need not be explicitly contained within the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
26
A(n) ____ is any sequence of characters enclosed in double quotes.
A)string literal
B)array
C)character array
D)data structure
A)string literal
B)array
C)character array
D)data structure
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
27
____ is an example of a string.
A)'a'
B){'s', 't', 'r', 'i', 'n', 'g'}
C)"\n"
D)'This is a string.'
A)'a'
B){'s', 't', 'r', 'i', 'n', 'g'}
C)"\n"
D)'This is a string.'
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
28
In C, a string is stored as a ____ array of characters.
A)one-dimensional
B)two-dimensional
C)static
D)global
A)one-dimensional
B)two-dimensional
C)static
D)global
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
29
The value assigned to the NULL constant is ____.
A)'\n'
B)'\0'
C)'\NULL'
D)"NULL"
A)'\n'
B)'\0'
C)'\NULL'
D)"NULL"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
30
The string "Good Morning!" is stored in memory using a character array of size ____.
A)13
B)14
C)15
D)16
A)13
B)14
C)15
D)16
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
31
The ____ routine provides for the input of individual characters.
A)gets()
B)puts()
C)getchar()
D)putchar()
A)gets()
B)puts()
C)getchar()
D)putchar()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
32
Programs that use the gets() routine must include the ____ header file.
A)stdio.h
B)stdlib.h
C)string.h
D)ctype.h
A)stdio.h
B)stdlib.h
C)string.h
D)ctype.h
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
33
The ____ function continuously accepts and stores the characters typed at the terminal into the character array passed as an argument.
A)gets()
B)puts()
C)getchar()
D)putchar()
A)gets()
B)puts()
C)getchar()
D)putchar()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
34
Pressing the Enter key at the terminal generates a newline character, ____.
A)\0
B)\e
C)\r
D)\n
A)\0
B)\e
C)\r
D)\n
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
35
The statement ____ is a direct replacement for the statement puts(message);.
A)printf("%s",message);
B)printf("%s\n",message);
C)scanf("%s",message);
D)scanf("%s\n",message);
A)printf("%s",message);
B)printf("%s\n",message);
C)scanf("%s",message);
D)scanf("%s\n",message);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
36
The ____ function reads a set of characters up to either a blank space or a newline character.
A)readline()
B)gets()
C)scanf()
D)putchar()
A)readline()
B)gets()
C)scanf()
D)putchar()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
37
The ____ function stops accepting characters only when a newline is detected.
A)readline()
B)gets()
C)scanf()
D)putchar()
A)readline()
B)gets()
C)scanf()
D)putchar()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
38
The array char message[81]; can be used to store a string of up to ____ characters.
A)79
B)80
C)81
D)82
A)79
B)80
C)81
D)82
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
39
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++;
}
____
}
A)return;
B)string1[i - 1] = '\0';
C)string1[i] = '\0';
D)string1[i + 1] = '\0';
/* copy string2 to string1 */
Void strcopy(char string1[], char string2[])
{
Int i = 0;
While (string2[i] != '\0')
{
String1[i] = string2[i];
I++;
}
____
}
A)return;
B)string1[i - 1] = '\0';
C)string1[i] = '\0';
D)string1[i + 1] = '\0';
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
40
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;
4
5 while (string2[i] != '\0')
6 {
7 string1[i] = string2[i];
8 i++;
9 }
10 string1[i] = '\0';
11 }
A)3
B)5
C)7
D)10
1 void strcopy (char string1[], char string2[])
2 {
3 int i = 0;
4
5 while (string2[i] != '\0')
6 {
7 string1[i] = string2[i];
8 i++;
9 }
10 string1[i] = '\0';
11 }
A)3
B)5
C)7
D)10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
41
Line 5 in the function below can be replaced with ____.
1 void strcopy (char string1[], char string2[])
2 {
3 int i = 0;
4
5 while (string2[i] != '\0')
6 {
7 string1[i] = string2[i];
8 i++;
9 }
10 string1[i] = '\0';
11 }
A)while (string2[i])
B)while (!string2[i])
C)while (string2[i] < '\0')
D)while (string2[i] != '\n')
1 void strcopy (char string1[], char string2[])
2 {
3 int i = 0;
4
5 while (string2[i] != '\0')
6 {
7 string1[i] = string2[i];
8 i++;
9 }
10 string1[i] = '\0';
11 }
A)while (string2[i])
B)while (!string2[i])
C)while (string2[i] < '\0')
D)while (string2[i] != '\n')
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
42
The function ____ appends str2 to the end of str1.
A)strcpy(str1, str2)
B)strcmp(str1, str2)
C)strncpy(str1, str2,n)
D)strcat(str1, str2)
A)strcpy(str1, str2)
B)strcmp(str1, str2)
C)strncpy(str1, str2,n)
D)strcat(str1, str2)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
43
____ does not produce the same result as char test[5] = "abcd";.
A)char test[] = "abcd";
B)char test[5] = {'a', 'b', 'c', 'd', '\0'};
C)char test[5] = {'a', 'b', 'c', 'd'};
D)char test[] = {'a', 'b', 'c', 'd', '\0'};
A)char test[] = "abcd";
B)char test[5] = {'a', 'b', 'c', 'd', '\0'};
C)char test[5] = {'a', 'b', 'c', 'd'};
D)char test[] = {'a', 'b', 'c', 'd', '\0'};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
44
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.
A)"there World!"
B)"Helloe World!"
C)"Hellothere World!"
D)"Hello there World!"
A)"there World!"
B)"Helloe World!"
C)"Hellothere World!"
D)"Hello there World!"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
45
Programs that use the isalpha() routine must include the ____ header file.
A)stdio.h
B)stdlib.h
C)string.h
D)ctype.h
A)stdio.h
B)stdlib.h
C)string.h
D)ctype.h
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
46
Programs that use the atoi() routine must include the ____ header file.
A)stdio.h
B)stdlib.h
C)string.h
D)ctype.h
A)stdio.h
B)stdlib.h
C)string.h
D)ctype.h
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
47
When using ____, a full path name requires that two backslashes be used to separate individual directory and filenames.
A)#include
B)#define
C)atoi
D)tolower
A)#include
B)#define
C)atoi
D)tolower
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
48
When using #include, the characters ____, tell the compiler to begin searching for the included file in the C compiler system library directory.
A)""
B)<>
C)//
D)\\
A)""
B)<>
C)//
D)\\
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
49
When using #include, the characters ____, tell the compiler to start looking in the default directory where the program file is located.
A)""
B)<>
C)//
D)\\
A)""
B)<>
C)//
D)\\
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
50
The statement ____ displays the message Have a Happy Day, right-justified, in a field of 25 characters.
A) printf("%s25","Have a Happy Day");
B) printf("%s-25","Have a Happy Day");
C) printf("%25s","Have a Happy Day");
D) printf("%-25s","Have a Happy Day");
A) printf("%s25","Have a Happy Day");
B) printf("%s-25","Have a Happy Day");
C) printf("%25s","Have a Happy Day");
D) printf("%-25s","Have a Happy Day");
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
51
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.
A) strcpy()
C) sscanf()
B) strcat()
D) sprintf()
A) strcpy()
C) sscanf()
B) strcat()
D) sprintf()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck