Hi! I have a few short questions on C++ Thank you! 1. Given the following functi
ID: 666225 • Letter: H
Question
Hi! I have a few short questions on C++ Thank you!
1. Given the following function prototype: void mystry(const int list[], int size); and the declaration : int alpha[50];
Which of the following is a valid call to the function mystry?
a. mystry(int alpha[50]); b. mystry(alpha[],50); c. mystry(alpha,50); d. mystry(const alpha,50);
2. Given the following declarations and initializations:
a. y[SIZE] = 42.0; b. x[0] = 14.0; c. x = y; d. cin >> y >> z; e. x[8-i] = y[i] + z;
3. Suppose that ch1, ch2, and ch3 are variables of the type char and the input is:
a. A; b. B; c. C; d.
4. Suppose you have the following code:
a. Nothing because the input buffer needs to be flushed when the enter key is hit
b. Donald ucky
c. Donald Ducky
d. Donald
5.
a. Find syntax errors.
b. Translate the source code into machine language.
c. Correct logic errors.
d. Make the output look pretty.
THANK YOU!
Explanation / Answer
1) c. mystry(alpha,50);
2) valid staments are
a. y[SIZE] = 42.0;
b. x[0] = 14.0;
e. x[8-i] = y[i] + z;
(for additional information: staments c & d can be valid by using pointers ie; c. *x = *y; d. cin >> *y >> z;
because x and y are arrays, * x will represent the first element in the array, x[0])
3) c. C;
4) b. Donald ucky
cin>>first>>c>>last;
When you input Donald Ducky, Donald is read into 'first', since c is a char, it can only take value 'D' and last is followed immediately after the c, hence remaining part 'ucky' is stored into 'last'
5)
a. Find syntax errors.
b. Translate the source code into machine language.
(The compiler is only a program and cannot fix your programs for you. If you make a mistake, you have to correct the syntax or it won't compile.)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.