Deck 7: User-Defined Simple Data Types, Namespaces, and the string Type

ملء الشاشة (f)
exit full mode
سؤال
The following is a valid C++ enumeration type:
enum places {1ST,2ND,3RD,4TH};.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
In C++,____ is a reserved word.

A) deftype
B) typedef
C) typecc
D) alias
سؤال
Consider the declaration: enum sports {BASKETBALL,FOOTBALL,HOCKEY,BASEBALL,SOCCER};
Which of the following statements is true?

A) SOCCER-- = BASEBALL
B) BASEBALL++ = SOCCER
C) HOCKEY + FOOTBALL < SOCCER
D) FOOTBALL <= SOCCER
سؤال
In C++,you can create aliases to a previously defined data type by using the ____ statement.

A) typedef
B) using
C) namespace
D) alias
سؤال
Suppose that you have the following declaration. enum cars {FORD,GM,TOYOTA,HONDA};
Cars domesticCars = FORD;
The statement:
DomesticCars = static_cast(domesticCars + 1);
Sets the value of domesticCars to ____.

A) FORD
B) GM
C) TOYOTA
D) HONDA
سؤال
An anonymous type can be passed as a parameter to a function.
سؤال
Which of the following statements creates an anonymous type?

A) enum grades {A, B, C, D, F};
B) enum grades {};
C) enum {};
D) enum {A, B, C, D, F} grades;
سؤال
The following statement creates an anonymous type:
enum {1ST,2ND,3RD,4TH} places;
سؤال
In C++,____ is called the scope resolution operator.

A) .
B) ?
C) :
D) ::
سؤال
The following is a legal C++ enumeration type:
enum colorType {BLUE,GREEN,PINK,YELLOW,RED};
سؤال
No arithmetic operations are allowed on the enumeration type.
سؤال
The general syntax for accessing a namespace member is: namespace_name->identifier.
سؤال
What is the output of the following code? enum courses {ALGEBRA,BASIC,PASCAL,PHILOSOPHY,ANALYSIS};
Courses registered;
Registered = ALGEBRA;
Cout << registered << endl;

A) ALGEBRA
B) 0
C) 1
D) "ALGEBRA"
سؤال
A function cannot return the value of an enumeration type.
سؤال
An enumeration type can be passed as a parameter to a function only by value.
سؤال
In C++,namespace is a reserved word.
سؤال
Which of the following is a valid C++ statement?

A) typedef integer;
B) typedef int;
C) typedef int integer;
D) typedef integer int;
سؤال
In C++,[] is called the array subscript operator.
سؤال
In July ____,ANSI/ISO Standard C++ was officially approved.

A) 1996
B) 1998
C) 1999
D) 2000
سؤال
Which of the following statements declares the studentGrade variable?

A) enum studentGrade {A, B, C, D, F};
B) enum int {A, B, C, D, F} studentGrade;
C) enum studentGrade {A, B, C, D, F} grades;
D) enum grades {A, B, C, D, F} studentGrade;
سؤال
The data type string has a named constant,____,associated with it.

A) string::size
B) string::size_type
C) string::pos
D) string::npos
سؤال
Considering the statement string str = "Gone with the wind";,the output of the statement cout << str.find("the")<< endl; is ____.

A) 9
B) 10
C) 11
D) 12
سؤال
The identifiers in the system-provided header files such as iostream,cmath,and iomanip are defined in the namespace ____.

A) cctype
B) stdl
C) std
D) stdlib
سؤال
The ____ function is used to interchange the contents of two string variables.

A) iterator
B) traverse
C) swap
D) change
سؤال
Suppose str = "xyzw";.After the statement str[2] = 'Y'; The value of str is "____".

A) xyzw
B) xYzw
C) xyYw
D) xzYw
سؤال
The values in the domain of an enumeration type are called ____________________.
سؤال
Suppose that str1 and str2 are string variables.After the following statements execute,the value of str2 is "____________________".
str1 = "abc";
str2 = str1 + '-';
str2 = str2 + "xyz";
سؤال
The scope of a namespace member is local to the ____.

A) function
B) block
C) file
D) namespace
سؤال
Consider the following statements: string str = "ABCDEFD";
String::size_type position;
After the statement position = str.find('D'); executes,the value of position is ____.

A) 3
B) 4
C) 6
D) 7
سؤال
A data type wherein you directly specify values in the variable declaration with no type name is called a(n)____________________type.
سؤال
Suppose that str1,str2,and str3 are string variables.After the following statements execute,the value of str3 is "____". str1 = "abc";
Str2 = "xyz";
Str3 = str1 + '-' + str2;

A) abc
B) xyz
C) abc-xyz
D) xyz-abc
سؤال
Consider the following statements: string str1 = "ABCDEFGHIJKLM";
String str2;
After the statement str2 = str1.substr(1,4); executes,the value of str2 is "____".

A) ABCD
B) BCDE
C) BCD
D) CDE
سؤال
Which of the following statements is used to simplify the accessing of all globalType namespace members?

A) using globalType;
B) using namespace globalType:all;
C) using namespace globalType::all;
D) using namespace globalType;
سؤال
Given the following code namespace globalType
{
Void printResult();
}
Which of the following statements is needed to access printResult?

A) globalType.printResult();
B) globalType.printResult;
C) globalType::printResult();
D) globalType:printResult();
سؤال
Suppose str = "ABCDEFGHI".The output of the statement cout << str.length()<< endl;
Is ____.

A) 7
B) 8
C) 9
D) 10
سؤال
Before using the data type string,the program must include the header file ____.

A) enum
B) iostream
C) string
D) std
سؤال
If a global identifier in a program has the same name as one of the global identifiers in the header file,the compiler generates a(n)____________________ error.
سؤال
In ANSI/ISO Standard C++,the ____________________ mechanism was designed to solve the problem of overlapping global identifiers.
سؤال
Consider the following statements: string str1 = "Gone with the wind";
String str2;
After the statement str2 = str1.substr(5,4); executes,the value of str2 is "____".

A) Gone
B) with
C) the
D) wind
سؤال
The length of the string "Hello There." is ____.

A) 11
B) 12
C) 13
D) 14
سؤال
The string expression strVar.____________________ returns the index of the first occurrence at or after pos where str is found in strVar.
سؤال
The string expression strVar.____________________ deletes n characters from strVar starting at position pos.
سؤال
Suppose str = "abcd"; After the statement str[1] = 'A'; The value of str is "____________________".
سؤال
Suppose str = "ABCDEFG".The output of the statement
cout << str.length()<< endl;
is ____________________.
سؤال
The data type string has a named constant,____________________,associated with it.
سؤال
For the operator + to work with the string data type,one of the operands of + must be a(n)____________________ variable.
سؤال
The string expression strVar.____________________ starts at index pos,replaces the next n characters of strVar with all the characters of str.
سؤال
Suppose str = "abcd".After the statement str = str + "ABCD"; the value of str is "____________________".
سؤال
The string expression strVar.____________________ inserts all the characters of str at index pos into strVar.
سؤال
The length of the string "Hello There." is ____________________.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 7: User-Defined Simple Data Types, Namespaces, and the string Type
1
The following is a valid C++ enumeration type:
enum places {1ST,2ND,3RD,4TH};.
False
2
In C++,____ is a reserved word.

A) deftype
B) typedef
C) typecc
D) alias
B
3
Consider the declaration: enum sports {BASKETBALL,FOOTBALL,HOCKEY,BASEBALL,SOCCER};
Which of the following statements is true?

A) SOCCER-- = BASEBALL
B) BASEBALL++ = SOCCER
C) HOCKEY + FOOTBALL < SOCCER
D) FOOTBALL <= SOCCER
D
4
In C++,you can create aliases to a previously defined data type by using the ____ statement.

A) typedef
B) using
C) namespace
D) alias
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Suppose that you have the following declaration. enum cars {FORD,GM,TOYOTA,HONDA};
Cars domesticCars = FORD;
The statement:
DomesticCars = static_cast(domesticCars + 1);
Sets the value of domesticCars to ____.

A) FORD
B) GM
C) TOYOTA
D) HONDA
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
An anonymous type can be passed as a parameter to a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following statements creates an anonymous type?

A) enum grades {A, B, C, D, F};
B) enum grades {};
C) enum {};
D) enum {A, B, C, D, F} grades;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
The following statement creates an anonymous type:
enum {1ST,2ND,3RD,4TH} places;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
In C++,____ is called the scope resolution operator.

A) .
B) ?
C) :
D) ::
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
The following is a legal C++ enumeration type:
enum colorType {BLUE,GREEN,PINK,YELLOW,RED};
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
No arithmetic operations are allowed on the enumeration type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
The general syntax for accessing a namespace member is: namespace_name->identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
What is the output of the following code? enum courses {ALGEBRA,BASIC,PASCAL,PHILOSOPHY,ANALYSIS};
Courses registered;
Registered = ALGEBRA;
Cout << registered << endl;

A) ALGEBRA
B) 0
C) 1
D) "ALGEBRA"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
A function cannot return the value of an enumeration type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
An enumeration type can be passed as a parameter to a function only by value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
In C++,namespace is a reserved word.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
Which of the following is a valid C++ statement?

A) typedef integer;
B) typedef int;
C) typedef int integer;
D) typedef integer int;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
In C++,[] is called the array subscript operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
In July ____,ANSI/ISO Standard C++ was officially approved.

A) 1996
B) 1998
C) 1999
D) 2000
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following statements declares the studentGrade variable?

A) enum studentGrade {A, B, C, D, F};
B) enum int {A, B, C, D, F} studentGrade;
C) enum studentGrade {A, B, C, D, F} grades;
D) enum grades {A, B, C, D, F} studentGrade;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
The data type string has a named constant,____,associated with it.

A) string::size
B) string::size_type
C) string::pos
D) string::npos
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
Considering the statement string str = "Gone with the wind";,the output of the statement cout << str.find("the")<< endl; is ____.

A) 9
B) 10
C) 11
D) 12
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
The identifiers in the system-provided header files such as iostream,cmath,and iomanip are defined in the namespace ____.

A) cctype
B) stdl
C) std
D) stdlib
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
The ____ function is used to interchange the contents of two string variables.

A) iterator
B) traverse
C) swap
D) change
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
Suppose str = "xyzw";.After the statement str[2] = 'Y'; The value of str is "____".

A) xyzw
B) xYzw
C) xyYw
D) xzYw
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
The values in the domain of an enumeration type are called ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
Suppose that str1 and str2 are string variables.After the following statements execute,the value of str2 is "____________________".
str1 = "abc";
str2 = str1 + '-';
str2 = str2 + "xyz";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
The scope of a namespace member is local to the ____.

A) function
B) block
C) file
D) namespace
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Consider the following statements: string str = "ABCDEFD";
String::size_type position;
After the statement position = str.find('D'); executes,the value of position is ____.

A) 3
B) 4
C) 6
D) 7
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
A data type wherein you directly specify values in the variable declaration with no type name is called a(n)____________________type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Suppose that str1,str2,and str3 are string variables.After the following statements execute,the value of str3 is "____". str1 = "abc";
Str2 = "xyz";
Str3 = str1 + '-' + str2;

A) abc
B) xyz
C) abc-xyz
D) xyz-abc
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
Consider the following statements: string str1 = "ABCDEFGHIJKLM";
String str2;
After the statement str2 = str1.substr(1,4); executes,the value of str2 is "____".

A) ABCD
B) BCDE
C) BCD
D) CDE
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following statements is used to simplify the accessing of all globalType namespace members?

A) using globalType;
B) using namespace globalType:all;
C) using namespace globalType::all;
D) using namespace globalType;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
Given the following code namespace globalType
{
Void printResult();
}
Which of the following statements is needed to access printResult?

A) globalType.printResult();
B) globalType.printResult;
C) globalType::printResult();
D) globalType:printResult();
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Suppose str = "ABCDEFGHI".The output of the statement cout << str.length()<< endl;
Is ____.

A) 7
B) 8
C) 9
D) 10
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
Before using the data type string,the program must include the header file ____.

A) enum
B) iostream
C) string
D) std
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
If a global identifier in a program has the same name as one of the global identifiers in the header file,the compiler generates a(n)____________________ error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
In ANSI/ISO Standard C++,the ____________________ mechanism was designed to solve the problem of overlapping global identifiers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Consider the following statements: string str1 = "Gone with the wind";
String str2;
After the statement str2 = str1.substr(5,4); executes,the value of str2 is "____".

A) Gone
B) with
C) the
D) wind
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
The length of the string "Hello There." is ____.

A) 11
B) 12
C) 13
D) 14
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
The string expression strVar.____________________ returns the index of the first occurrence at or after pos where str is found in strVar.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
The string expression strVar.____________________ deletes n characters from strVar starting at position pos.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
Suppose str = "abcd"; After the statement str[1] = 'A'; The value of str is "____________________".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Suppose str = "ABCDEFG".The output of the statement
cout << str.length()<< endl;
is ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
The data type string has a named constant,____________________,associated with it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
For the operator + to work with the string data type,one of the operands of + must be a(n)____________________ variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
The string expression strVar.____________________ starts at index pos,replaces the next n characters of strVar with all the characters of str.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Suppose str = "abcd".After the statement str = str + "ABCD"; the value of str is "____________________".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
The string expression strVar.____________________ inserts all the characters of str at index pos into strVar.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
The length of the string "Hello There." is ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.