question archive 1) Which statement about the C-style array is true? (a) The elements of an array can be accessed by a pointer

1) Which statement about the C-style array is true? (a) The elements of an array can be accessed by a pointer

Subject:Computer SciencePrice:2.89 Bought3

1) Which statement about the C-style array is true? (a) The elements of an array can be accessed by a pointer. (b) If needed, more elements can be added to an array. (c) An array can have elements of int and char. (d) Compilers will display error messages if the subscript is greater than the size of an array. (e) None of the above. 2. Given a prototype like: char demo (char str[], char c); which statement is correct? (a) Two char arrays are created, str[] and its counterpart in the calling function. (b) Characters of a string in the calling function are copied into str[]. (c) Only the address of a character in the calling function is passed to char c. (d) The function utilizes the pass-by-value approach in parameter handling. (e) Changes made to str[] will not affect its counterpart in the calling function. (f) None of the above. 3. Which statement is valid? (a) int nums[8]; int *p = &nums[2]; (b) int nums[8]; int *p = &nums; (c) int nums[8]; int p = &nums[0]; (d) double *p = &(*p/2.0 + 3.14); (e) double *p = 3.14; (f) None of the above. 4. Given the two declarations: int score = 90; int *ptr = &score; which is true after executing the next statement? (*ptr)++; (a) The value of ptr is increased by one byte. (b) The value of ptr is increased by four bytes. (c) The value of score becomes 91. (d) The value of score becomes 94. (e) None of the above. 5. Given a function header like: void getTotal (int *ptr, int size); which statement is NOT valid? (a) (b) (c) (d) (e) *(ptr + i); ptr[i] + 2; *ptr[i]; *ptr++; None of the above. // i is an int index. // i is an int index. // i is an int index. 6. Given this C-string declaration: char test[20] = "C++ book"; which statement is correct? (a) test can be used as a regular pointer. (b) It is terminated by '\n'. (c) It is terminated by nullptr. (d) Its length as returned by strlen(test) is 9. (e) None of the above. 7. Which statement about class definition is not true? (a) A class includes data members and function members (methods). (b) A class has a default constructor. (c) A class has at least one private member. (d) A class can have another class as its member. (e) A class is a user-defined data type. 8. Which statement about the constructor is correct? (a) It can be used by another constructor. (b) It can only return a user defined data type. (c) It can only return a primitive data type. (d) Both (b) and (c). (e) It cannot be overloaded. (f) A compiler-provided constructor is always called prior to a user-defined constructor. (g) None of the above. 9. Which statement about class inheritance in C++ is true? (a) C++ allows for multiple inheritance, but not more than 8 parent classes. (b) A child class cannot inherit a parent class and a grandparent class simultaneously. (c) A child class inherits all members of a parent class. (d) A child class inherits only the protected members of a parent class. (e) None of the above. 10. To implement operator overloading in a class, which C++ feature is often used? (a) friend (b) static (c) this (d) that (e) None of the above. 11. (10 points) Find programming errors in the code below. • Mark the errors clearly. • Write a short explanation why you think it is an error. • You can mark at most 5 errors. If you mark 6 errors, you will lose 1 point. If you mark 7 errors, you will lose 2 points, and so on. protected: int ID; string name; double mathScore; double chemScore; public: Student(int id=0, string nm="", double ms=0.0, double cs=0.0); int getMathScore() { return mathScore; }; int getChemScore() { return chemScore; }; void setMathScore(double ms) { mathScore = ms; }; void setChemScore(double cs) { chemScore = cs; }; void showStudentInfo(); double compAveScore() { (mathScore + chemScore)/2.0; } }; void Student::Student (int id, string nm, double ms, double cs) { ID = id; name = nm; mathScore = ms; chemScore = cs; } void Student::showStudentInfo () { cout

Option 1

Low Cost Option
Download this past answer in few clicks

2.89 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 3 times

Completion Status 100%