Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise #6 Given the following Class: class A { int* p; A(int n = 1) { p = new int[n]; } ~A() { delete[] p;

Exercise #6 Given the following Class: class A { int* p; A(int n = 1) { p = new int[n]; } ~A() { delete[] p; } }; What is the default access modifier of p ? a. public . b. protected . c. private . d. int *. Exercise #7 Given the following function: int f() { int i = 5; int& r = i; r += r * 3; int* p = &r; *p += r; return i; } What is it expected to return ? a. 40 b. 20 c. 5 d. 25 Exercise #8 Given the following program: class A { } class B : public A { public: int x; protected: int y; private: int z; } class C : public B { } Which of the following sentences is true ? a. x and y members are accessible from within classes A and B. b. x and y members are accessible from within classes A and C. c. x, y, and z members are accessible from within classes B and C . d. x and y members are accessible from within classes B and C. Exercise #9 Given the following program: void printTime(int hours, int minutes = 0, int seconds = 30) { cout << "Time:" << hours << minutes << seconds << endl; } int main() { printTime(); return 0; } What is the expected result of the execution ? a. Printed result of Time : 0:0:30 . b. Printed result of Time : 00:00:30 c. Printed result of Time : 0:0:00 . d. Compilation error since too few arguments are given at the function call

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago