Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++: Answer the follwoing multiple choice questions. No need to explain. 1- Given the following declration, what is the value of b[1][0]? int b[ 2

C++: Answer the follwoing multiple choice questions. No need to explain.

1- Given the following declration, what is the value of b[1][0]? int b[ 2 ][ 2 ] = { { 1 }, {3 , 4} }; a. 0 b. 1 c. 3 d. This is an invalid declration

2- which of the following declration correctly creates a c-string that can hold the value "phonebook"?

a. char s1; b. char s1[9]; c. char s1=10; d. char s1[10];

3- Given the following structure definition, what is the correct way to print the person's birth year? struct DateType{ int Day; int Month; int Year; };

struct PersonType { int age; float weight; DataType birthday; };

PersonType person;

a. std::cout<< person.birthday.year; b. std::cout<< year; c. std::cout<< birthday.year; d. std::cout<< peson.year;

4- what does this function do? int something)const char * s) { int x; for (x = 0; *s != '\0'; s++) x++; return x; }

a. return the c-string parameter's length b. return the last non-null character in the c-string parameter

9. which of the following statements about seperating a class's interface and implementation is NOT true?

a. Private data members are included in the header file b. Changes in the class's implementation will affect the client

5- Given the folliwng class and object declation, how would you print out the age and cost of virable bottle?

class Wine { public: Wine(); int getAge(); float getCost(); private: int age; float cost; };

Wine bottle;

a. std::cout<< bottle.getAge()<

b. std::cout<< bottle.getAge<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions