Deck 22: Bits, Characters, C Strings and Structs
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/30
العب
ملء الشاشة (f)
Deck 22: Bits, Characters, C Strings and Structs
1
__________ is not allowed.
A) Accessing individual bits in a multi-bit bit field.
B) Padding a bit field with bits that cannot be accessed.
C) Having an unnamed bit field.
D) Having a bit field with a zero width.
A) Accessing individual bits in a multi-bit bit field.
B) Padding a bit field with bits that cannot be accessed.
C) Having an unnamed bit field.
D) Having a bit field with a zero width.
A
2
Evaluate (00001000 & 11000101) ^ (11110000).
A) 00001101
B) 11000000
C) 00111101
D) 11110000
A) 00001101
B) 11000000
C) 00111101
D) 11110000
D
3
The functions of the character-handling library typically manipulate characters as:
A) ints
B) floats
C) longs
D) chars
A) ints
B) floats
C) longs
D) chars
A
4
Structure variable declarations can be incorporated into a structure definition by placing a comma-separated list of variable names:
A) After struct StructureName and before the left brace.
B) After the left brace and before the member declarations.
C) After the member declarations and before the right brace.
D) After the right brace and before the semicolon.
A) After struct StructureName and before the left brace.
B) After the left brace and before the member declarations.
C) After the member declarations and before the right brace.
D) After the right brace and before the semicolon.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
5
Arrays are:
A) Always passed by reference.
B) Passed by reference unless inside a structure.
C) Passed by reference unless their elements are structures.
D) Always passed by value.
A) Always passed by reference.
B) Passed by reference unless inside a structure.
C) Passed by reference unless their elements are structures.
D) Always passed by value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following statements is false?
A) Names for structure types are often defined with typedef to create more readable type names.
B) The statement
Typedef Card* CardPtr;
Defines the new type name CardPtr as a synonym for type Card*.
C) Creating a new name with typedef does not create a new type; typedef simply creates a new type name that can then be used in the program as an alias for an existing type name.
D) C++11 added the keyword using as another mechanism for creating type aliases. The following declaration is equivalent to the typedef in part b):
Using Card* = CardPtr;
A) Names for structure types are often defined with typedef to create more readable type names.
B) The statement
Typedef Card* CardPtr;
Defines the new type name CardPtr as a synonym for type Card*.
C) Creating a new name with typedef does not create a new type; typedef simply creates a new type name that can then be used in the program as an alias for an existing type name.
D) C++11 added the keyword using as another mechanism for creating type aliases. The following declaration is equivalent to the typedef in part b):
Using Card* = CardPtr;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
7
The isxdigit function would return false on:
A) a
B) A
C) 2
D) g
A) a
B) A
C) 2
D) g
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
8
Typedef is used to:
A) Create a type name that is an alias for another type name.
B) Make a struct private.
C) Cast one struct to another type.
D) Initialize struct members.
A) Create a type name that is an alias for another type name.
B) Make a struct private.
C) Cast one struct to another type.
D) Initialize struct members.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
9
A bit field must be declared as a:
A) int or unsigned.
B) char.
C) float.
D) long.
A) int or unsigned.
B) char.
C) float.
D) long.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which of the statements a), b) and c) is false?
A) To create a binary literal, precede a sequence of 1s and 0s with 0b or 0B.
B) You can define a 32-bit mask as
0b10000000'00000000'00000000'00000000
C) The literal in part b) uses C++14's single-quote character to separate groups of digits for readability.
D) All of the above statements are true.
A) To create a binary literal, precede a sequence of 1s and 0s with 0b or 0B.
B) You can define a 32-bit mask as
0b10000000'00000000'00000000'00000000
C) The literal in part b) uses C++14's single-quote character to separate groups of digits for readability.
D) All of the above statements are true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
11
Let x be an unsigned int on a machine with 4-byte unsigned ints. What effect does x>>=1;
X<<=1;
Have?
A) There is no effect.
B) The leftmost bit of x is set to 0.
C) The rightmost bit of x is set to 0.
D) Both (b) and (c).
X<<=1;
Have?
A) There is no effect.
B) The leftmost bit of x is set to 0.
C) The rightmost bit of x is set to 0.
D) Both (b) and (c).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which is the proper way to create a built-in array of structure variables of type Data?
A) MyArray Data[10]
B) Data MyArray[10];
C) Data struct myArray[10];
D) struct MyArray[Data];
A) MyArray Data[10]
B) Data MyArray[10];
C) Data struct myArray[10];
D) struct MyArray[Data];
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
13
The main difference between structures and classes is:
A) Whether they default to public or private access.
B) How they access member variables.
C) That classes always require new be used with them while structures do not.
D) There is no difference between structures and classes.
A) Whether they default to public or private access.
B) How they access member variables.
C) That classes always require new be used with them while structures do not.
D) There is no difference between structures and classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
14
For any nonzero 8-bit x, which of the following does not result in zero?
A) x &= (~x)
B) x ^= x
C) x <<= 8
D) x |= x
A) x &= (~x)
B) x ^= x
C) x <<= 8
D) x |= x
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
15
The advantages of using typedef do not include:
A) Making programs more portable by allowing data types to be easily changed to meet system specifications.
B) Making type names shorter.
C) Making programs more readable.
D) Increasing the efficiency of accessing struct member variables.
A) Making programs more portable by allowing data types to be easily changed to meet system specifications.
B) Making type names shorter.
C) Making programs more readable.
D) Increasing the efficiency of accessing struct member variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
16
Let Bit1 = Bit2 = 1. Which of the following does not have the same result as the others?
A) Bit1 & Bit2
B) Bit1 | Bit2
C) Bit1 ^ Bit2
D) ~(~Bit2)
A) Bit1 & Bit2
B) Bit1 | Bit2
C) Bit1 ^ Bit2
D) ~(~Bit2)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which of the following is not a bitwise operator?
A) ^
B) >>
C) ~
D) *
A) ^
B) >>
C) ~
D) *
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
18
Two structure variables of the same type with the same member values, when compared will:
A) Always compare equally.
B) Never compare equally.
C) Sometimes compare equally.
D) Result in a compile error.
A) Always compare equally.
B) Never compare equally.
C) Sometimes compare equally.
D) Result in a compile error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
19
The most basic unit of data on a computer is the:
A) Bit.
B) Byte.
C) File.
D) int.
A) Bit.
B) Byte.
C) File.
D) int.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
20
The number of bits in a bit field is specified with:
A) Parentheses as in bitfield(4)
B) A colon as in bitfield : 4
C) Brackets as in bitfield[4]
D) A dot as in bitfield.4
A) Parentheses as in bitfield(4)
B) A colon as in bitfield : 4
C) Brackets as in bitfield[4]
D) A dot as in bitfield.4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
21
The main difference between the functions atof, atoi and atol is:
A) Their return types.
B) Their arguments.
C) Their header files.
D) Their efficiency.
A) Their return types.
B) Their arguments.
C) Their header files.
D) Their efficiency.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
22
Assuming that string1 = "hello" and string2 = "hello world", which of the following returns 0?
A) strcmp(string1, string2);.
B) strcmp(string1, string2, 6);.
C) Strncmp(string1, string2, 5);.
D) strncmp(string1, string2, 6);.
A) strcmp(string1, string2);.
B) strcmp(string1, string2, 6);.
C) Strncmp(string1, string2, 5);.
D) strncmp(string1, string2, 6);.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
23
The ___________ function allows characters of one part of a string to be copied into another, overlapping part of the same string.
A) memchr
B) memcmp
C) memcpy
D) memmove
A) memchr
B) memcmp
C) memcpy
D) memmove
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which function would be the most useful for determining if a certain word is contained in a string representing a sentence?
A) strcspn.
B) strchr.
C) strstr.
D) strrchr.
A) strcspn.
B) strchr.
C) strstr.
D) strrchr.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
25
Strtok does not:
A) Replace each delimiting character with '\0'.
B) Return a pointer to the token it creates.
C) Completely tokenize the string the first time it is called.
D) Modify the input string.
A) Replace each delimiting character with '\0'.
B) Return a pointer to the token it creates.
C) Completely tokenize the string the first time it is called.
D) Modify the input string.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
26
Memcmp would return ___________ for the call memcmp("Hi, how are you?", "Hi, how are things?", 6).
A) 1
B) A positive number.
C) 0
D) A negative number.
A) 1
B) A positive number.
C) 0
D) A negative number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which of the following correctly copies the contents of string2 into string1? Assume that string2 is equal to "goodbye" and string1 is equal to "good morning"?
A) strcpy(string1, string2);.
B) strcpy(string1, string2, 6);.
C) Strncpy(string1, string2, 5);.
D) strncpy(string1, string2, 6);.
A) strcpy(string1, string2);.
B) strcpy(string1, string2, 6);.
C) Strncpy(string1, string2, 5);.
D) strncpy(string1, string2, 6);.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
28
To change the string "ABCDEFGHI" to "aaaaaFGHI" you would use the _________ function.
A) memset
B) memcmp
C) memchr
D) memcopy
A) memset
B) memcmp
C) memchr
D) memcopy
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
29
The strtol and stroul functions do not:
A) Need a header file to be used.
B) Take three arguments.
C) Have the same return types.
D) Have the ability to return data in base 8.
A) Need a header file to be used.
B) Take three arguments.
C) Have the same return types.
D) Have the ability to return data in base 8.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
30
What is the output of the following statement? cout << strspn("Cows like to moo.", "Ceik losw");
A) Nothing.
B) 10.
C) 8.
D)
E)
A) Nothing.
B) 10.
C) 8.
D)
E)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck