Deck 22: Bits, Characters, C Strings and Structs

ملء الشاشة (f)
exit full mode
سؤال
Evaluate 00001000 & 11000101 ) ^ 11110000 ).

A) 00001101
B) 11000000
C) 00111101
D) 11110000
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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.
سؤال
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 bit field must be declared as a:

A) int or unsigned.
B) char.
C) float.
D) long.
سؤال
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.
سؤال
Which is the proper way to create an array of structure variables of type Data?

A) MyArray Data[ 10 ]
B) Data MyArray[ 10 ];
C) Data struct myArray[ 10 ];
D) struct MyArray[ Data ];
سؤال
The most basic unit of data on a computer is the:

A) Bit.
B) Byte.
C) File.
D) int.
سؤال
The isxdigit function would return false on:

A) a
B) A
C) 2
D) g
سؤال
__________ 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.
سؤال
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
سؤال
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.
سؤال
Structure variables may not be initialized by:

A) Assigning user-defined values in the struct definition.
B) Assigning values to individual data members.
C) Array-like member initializer lists.
D) Assigning the value of another structure variable of the same type.
سؤال
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.
سؤال
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).
سؤال
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 )
سؤال
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.
سؤال
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
سؤال
The functions of the character-handling library typically manipulate characters as:

A) ints
B) floats
C) longs
D) chars
سؤال
Which of the following is not a bitwise operator?

A) ^
B) >>
C) ~
D) *
سؤال
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.
سؤال
What is the output of the following statement?
Cout << strspn"Cows like to moo.", "Ceik losw");

A) Nothing.
B) 10.
C) 8.
D)
E)
سؤال
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.
سؤال
To change the string "ABCDEFGHI" to "aaaaaFGHI" you would use the _________ function.

A) memset
B) memcmp
C) memchr
D) memcopy
سؤال
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
سؤال
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.
سؤال
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.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/26
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 22: Bits, Characters, C Strings and Structs
1
Evaluate 00001000 & 11000101 ) ^ 11110000 ).

A) 00001101
B) 11000000
C) 00111101
D) 11110000
D
2
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.
B
3
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.
C
4
A bit field must be declared as a:

A) int or unsigned.
B) char.
C) float.
D) long.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
5
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which is the proper way to create an array of structure variables of type Data?

A) MyArray Data[ 10 ]
B) Data MyArray[ 10 ];
C) Data struct myArray[ 10 ];
D) struct MyArray[ Data ];
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
7
The most basic unit of data on a computer is the:

A) Bit.
B) Byte.
C) File.
D) int.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
8
The isxdigit function would return false on:

A) a
B) A
C) 2
D) g
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
9
__________ 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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
10
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
11
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
12
Structure variables may not be initialized by:

A) Assigning user-defined values in the struct definition.
B) Assigning values to individual data members.
C) Array-like member initializer lists.
D) Assigning the value of another structure variable of the same type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
13
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
14
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).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
15
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 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
16
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
17
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
18
The functions of the character-handling library typically manipulate characters as:

A) ints
B) floats
C) longs
D) chars
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following is not a bitwise operator?

A) ^
B) >>
C) ~
D) *
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
20
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
21
What is the output of the following statement?
Cout << strspn"Cows like to moo.", "Ceik losw");

A) Nothing.
B) 10.
C) 8.
D)
E)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
22
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
23
To change the string "ABCDEFGHI" to "aaaaaFGHI" you would use the _________ function.

A) memset
B) memcmp
C) memchr
D) memcopy
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
24
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
25
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
26
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 26 في هذه المجموعة.