Deck 5: Understanding Arrays, Strings and Pointers
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
Match between columns
سؤال
Match between columns
سؤال
Match between columns
سؤال
Match between columns
سؤال
سؤال
Match between columns
سؤال
Match between columns
سؤال
سؤال
سؤال
سؤال
Match between columns
سؤال
Match between columns
سؤال
Match between columns
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/55
العب
ملء الشاشة (f)
Deck 5: Understanding Arrays, Strings and Pointers
1
Which of the following statements has an error?
A) int rent[4] = {250, 375, 460, 600};
B) int rent[] = {250, 375, 460, 600};
C) int rent[4] = {250, 375};
D) int rent[4] = {250, 375, 460, 600, 650};
A) int rent[4] = {250, 375, 460, 600};
B) int rent[] = {250, 375, 460, 600};
C) int rent[4] = {250, 375};
D) int rent[4] = {250, 375, 460, 600, 650};
D
2
A C++ value expressed within double quotation marks is commonly called a ____.
A) string
B) character
C) quote
D) citation
A) string
B) character
C) quote
D) citation
A
3
Flag variables are usually bool type or ____ type.
A) char
B) int
C) float
D) double
A) char
B) int
C) float
D) double
B
4
C++ programmers do not refer to an array of characters as a string unless the last usable character in the string is the null character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
5
An alternative to parallel arrays is to create ____.
A) one-dimensional arrays
B) two-dimensional arrays
C) arrays of structure objects
D) arrays of flag variables
A) one-dimensional arrays
B) two-dimensional arrays
C) arrays of structure objects
D) arrays of flag variables
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
6
A convenient way to set all array elements to zero is to declare as follows: int rent[20] = ____; .
A) 0
B) {0..0}
C) {0}
D) {}
A) 0
B) {0..0}
C) {0}
D) {}
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
7
You can determine the size of variables in your system with the ____ operator.
A) size()
B) sizeof()
C) length()
D) len()
A) size()
B) sizeof()
C) length()
D) len()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
8
Which of the following statements produces the same output as cout ? Assume someNumbers is an array of integers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
9
When you assign one pointer to another, you are not making a copy of the data; instead, you are setting two pointers to point to the same memory location.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
10
Which of the following statements produces the same output as cout ? Assume someNumbers is an array of integers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
11
Complete the following program, which displays all the values in the array:
Const int SZ_OF_ARRAY = 5;
Int arrayInt[SZ_OF_ARRAY] = {34, 56, 12, 3, 99};
For(int x = 0; ____ ; ++x)
Cout
Const int SZ_OF_ARRAY = 5;
Int arrayInt[SZ_OF_ARRAY] = {34, 56, 12, 3, 99};
For(int x = 0; ____ ; ++x)
Cout
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
12
Suppose you create a structure that has an integer field called partNum ; Next, you create an array of ten elements of objects of this structure. Which of the following is a correct way to access the first element of the array?
A) (part.partNum)[0]
B) part.partNum[0]
C) part.[0]partNum
D) part[0].partNum
A) (part.partNum)[0]
B) part.partNum[0]
C) part.[0]partNum
D) part[0].partNum
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
13
You can use a variable to declare the size of an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
14
____ arrays are corresponding arrays in which values in the same relative locations are logically related.
A) Two-dimensional
B) Parallel
C) One-dimensional
D) Structured
A) Two-dimensional
B) Parallel
C) One-dimensional
D) Structured
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
15
In C++, the first element in any array is the element with the 1 subscript.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
16
____ is a string constant.
A) 'H'
B) '\n'
C) "Hello"
D) Hello
A) 'H'
B) '\n'
C) "Hello"
D) Hello
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
17
If you create a firstName string and initialize it to "Mary" , and then use the C++ statement cout , the output is ____.
A) Mary
B) ary
C) an error
D) empty because the program does not compile
A) Mary
B) ary
C) an error
D) empty because the program does not compile
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
18
You can use the address operator (____) to examine the memory address of a variable.
A) %
B) $
C) *
D) &
A) %
B) $
C) *
D) &
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
19
An array subscript must always be an integer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
20
In C++, you are required to assign array values to elements in sequential order.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
21
Can you provide values for an array when you declare it? If so, how?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
22
What problem can you identify in the following program?
Char name1[] = "Mary";
Char name2[] = "Diane";
Strcpy(name2, "Margaret Veronica");
A) It tries to input a string value including whitespace.
B) It tries to assign one string to another using the assignment operator.
C) It tries to compare strings using the comparison operator.
D) It exceeds the bounds of an array.
Char name1[] = "Mary";
Char name2[] = "Diane";
Strcpy(name2, "Margaret Veronica");
A) It tries to input a string value including whitespace.
B) It tries to assign one string to another using the assignment operator.
C) It tries to compare strings using the comparison operator.
D) It exceeds the bounds of an array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
23
The ____ function reads characters into an array, up to a size limit or until the newline character is encountered, whichever comes first.
A) getche()
B) strcpy()
C) getline()
D) getch()
A) getche()
B) strcpy()
C) getline()
D) getch()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
24
When you declare an array, the size must be a(n) ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
25
To compare the contents of two strings you can use the ____.
A) compare() function
B) strcmp() function
C) strcpy() function
D) == operator
A) compare() function
B) strcmp() function
C) strcpy() function
D) == operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
26
Write a C++ statement that prints how much memory an integer uses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
27
In C++, it is conventional to begin class names with a(n) ____________________ letter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
28
When should you use an array instead of regular variables?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
29
____________________ are variables that can hold memory addresses.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
30
What happens if a subscript exceeds the size of an array?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
31
How does the hexadecimal numbering system work?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
32
Depending on your compiler, you might have to use the statement ____ at the top of your file to use the strcpy() function.
A) #include
B) #include
C) #include
D) #include
A) #include
B) #include
C) #include
D) #include
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
33
A string ____________________ is a value within double quotes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
34
To indicate that a variable is a pointer, you should begin the variable's name with a(n) ____.
A) asterisk
B) ampersand
C) pipe
D) exclamation point
A) asterisk
B) ampersand
C) pipe
D) exclamation point
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
35
int , char , double , and float are primitive or ____________________ data types.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
36
Memory locations beyond an array are ____________________ for the array.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
37
The input ____ is a holding area for waiting input.
A) stack
B) queue
C) memory
D) buffer
A) stack
B) queue
C) memory
D) buffer
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
38
How do you declare an array in C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
39
To compare the contents of two string objects you can use the ____.
A) compare() function
B) strcmp() function
C) strcpy() function
D) == operator
A) compare() function
B) strcmp() function
C) strcpy() function
D) == operator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
40
An array name actually represents a(n) ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
41
Identify and describe two common errors that are easy to make when manipulating arrays.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
42
Describe the various ways to place an asterisk when declaring an integer pointer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
43
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
44
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
45
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
46
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
47
How can you copy the contents of one C-style string to another string in C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
49
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
50
How can you create a string variable in C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
51
Is there ever a circumstance when you can type two characters within single quotation marks? Explain.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
52
How is the null character represented in C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
53
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
54
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
55
Match between columns
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck