True or False? Given the declaration int beta[20]; the statement beta = beta + 1
ID: 3672001 • Letter: T
Question
True or False? Given the declaration int beta[20]; the statement beta = beta + 1; adds 1 to all 20 elements of the array.
True
False
10 points
QUESTION 2
True or False? In C++, the component type of a one-dimensional array cannot be float, double, or long double.
True
False
10 points
QUESTION 3
True or False? The array declared as float age[4][5][6][9]; has four dimensions.
True
False
10 points
QUESTION 4
True or False? A one-dimensional array is an example of a structured data type.
True
False
10 points
QUESTION 5
True or False? Given the declaration int beta[20]; the statement cout << beta; cannot be used to output all 20 elements of the array.
True
False
10 points
QUESTION 6
The following code fragment invokes a function named InitToZero:
int alpha[10][20];
InitToZero(alpha);
Which of the following is a valid function heading for InitToZero?
void InitToZero( int beta[][] )
void InitToZero( int beta[10][20] )
void InitToZero( int beta[10][] )
void InitToZero( int beta[][20] )
b and d above
10 points
QUESTION 7
Choose the most appropriate data structure with which to represent the following: the items on a person's driver's license.
array
record
array of records
hierarchical record
either b or d above
10 points
QUESTION 8
Choose the most appropriate data structure with which to represent the following: a list of birth records at a hospital.
record
array
array of records
hierarchical record
10 points
QUESTION 9
Which of the following statements about C++ arrays is true?
Array components cannot be of floating-point types.
The index type of a one-dimensional array can be any data type.
An array component can be treated as a simple variable of its component type.
a and b above
a, b, and c above
10 points
QUESTION 10
Given the declarations
float x[300];
float y[75][4];
float z[79];
which of the following statements is true?
x has more components than y.
y has more components than x.
y and z have the same number of components.
x and y have the same number of components.
a and c above
A.void InitToZero( int beta[][] )
B.void InitToZero( int beta[10][20] )
C.void InitToZero( int beta[10][] )
D.void InitToZero( int beta[][20] )
E.b and d above
Explanation / Answer
Questions with Answers:
Question 1:
True or False? Given the declaration int beta[20]; the statement beta = beta + 1; adds 1 to all 20 elements of the array.
True
False
10 points
ANS: False
Reason: It doesn’t use subscript and loop to access all elements.
-----------------------------------------------------------------
QUESTION 2
True or False? In C++, the component type of a one-dimensional array cannot be float, double, or long double.
True
False
10 points
ANS: False
---------------------------------------------------------------------------
QUESTION 3
True or False? The array declared as float age[4][5][6][9]; has four dimensions.
True
False
Ans: True
-------------------------------------------------------------------------
QUESTION 4
True or False? A one-dimensional array is an example of a structured data type.
True
False
10 points
ANS: True
---------------------------------------------------------------------------
QUESTION 5
True or False? Given the declaration int beta[20]; the statement cout << beta; cannot be used to output all 20 elements of the array.
True
False
ANS:True
Reason: It doesn’t use loop to access all elements.
-----------------------------------------------------------------------
QUESTION 6
The following code fragment invokes a function named InitToZero:
int alpha[10][20];
InitToZero(alpha);
Which of the following is a valid function heading for InitToZero?
A. void InitToZero( int beta[][] )
B. void InitToZero( int beta[10][20] )
C. void InitToZero( int beta[10][] )
D. void InitToZero( int beta[][20] )
E. b and d above
ANS: E. b and d above
Reason: Because A,C didn’t specify column dimension
-----------------------------------------------------------------------------------
QUESTION 7
Choose the most appropriate data structure with which to represent the following: the items on a person's driver's license.
A. array
B. record
C. array of records
D. hierarchical record
E. either b or d above
ANS: A. array
----------------------------------------------------------------------------
QUESTION 8
Choose the most appropriate data structure with which to represent the following: a list of birth records at a hospital.
A. record
B. array
C. array of records
D. hierarchical record
ANS: C. array of records
-----------------------------------------------------------------------------------
QUESTION 9
Which of the following statements about C++ arrays is true?
A. Array components cannot be of floating-point types.
B. The index type of a one-dimensional array can be any data type.
C. An array component can be treated as a simple variable of its component type.
D. a and b above
E. a, b, and c above
ANS: C. An array component can be treated as a simple variable of its component type
-----------------------------------------------------------------------------------------------------------
QUESTION 10
Given the declarations
float x[300];
float y[75][4];
float z[79];
which of the following statements is true?
A. x has more components than y.
B. y has more components than x.
C. y and z have the same number of components.
D. x and y have the same number of components.
E. a and c above
ANS:
D. x and y have the same number of components.
Reason: X has 300 components. y has 75*4 => 300 components. So both have
same components
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.