Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

11... Which of the following lines contains a syntax error? class Person { public: void PrintName() const { cout < < name < < endl;

11...

Which of the following lines contains a syntax error?

class Person {

public:

void PrintName() const { cout << name << endl; }

private:

string name;

};

int main() {

Person p;

p.name = "Sally";

p.PrintName();

return 0;

}

Select one:

a. class Person {

b. void PrintName() { cout << name << endl; }

c. p.name = Sally;

d. p.PrintName();

12...

Which of the following defines a member function PrintSchedule of the class Schedule, returning nothing, and having one int parameter named year?

Select one:

a. void Schedule.PrintSchedule(int year) { /* Function code */ }

b. void Schedule::PrintSchedule(int year) { /* Function code */ }

c. Schedule::PrintSchedule(int year) { /* Function code */ }

d. void Schedule->PrintSchedule(int year) { /* Function code */ }

13...

If a program does not have using namespace std; but does have #include , then which of the following is the beginning of a valid cout statement?

Select one:

a. cout

b. std->cout

c. std::cout

d. namespace::cout

14.....

Which of the following choices appropriately fills in the blank?

Characters written to cout are placed into a(n) _________.

Select one:

a. file

b. directory

c. buffer

d. hard disk

15.....

What is the output of the following code?

int main() {

vector nums;

int i = 0;

nums.push_back(4);

nums.push_back(3);

nums.push_back(2);

nums.push_back(1);

for(i = 0; i < nums.size(); ++i) {

cout << nums.at(i) << " ";

}

return 0;

}

Select one:

a. 4 3 2 1

b. 1 2 3 4

c. 0 1 2 3

d. 3 2 1 0

16...

Which of the following choices appropriately fills in the blank?

A read from cin will read characters from ____________________.

Select one:

a. a buffer

b. the systems keyboard directly

c. the systems input devices directly

d. the hard disk

17....

In the member function SetRadius, which of the following is the assignment statement using the this pointer?

class Circle {

public:

void SetRadius(double radius);

double GetRadius() const;

private:

double r;

};

void Circle::SetRadius(double radius) {

r = radius;

return;

}

Select one:

a. r = this->radius;

b. radius = r->this;

c. this->r = radius;

d. this->r = this->radius;

18....

Which of the following calls the function Sum by passing in two timehm structs (t1 and t2) and storing the result in a timehm struct t3?

Select one:

a. t3 = timehm.Sum(t1, t2);

b. t3 = timehm->Sum(t1, t2);

c. timehm = Sum(timehm, timehm);

d. t3 = Sum(t1, t2);

Which of the following lines contains a syntax error?

struct datedm {

int day;

string month;

};

int main() {

datedm date;

date->month = "July";

date.day = 27;

// main program

return 0;

}

Select one:

a. struct datedm {

b. datedm date;

c. date->month = "July";

d. date.day = 27;

Which of the following will NOT cause the double pi = 3.14159; to output 3.1416?

Select one:

a. cout << fixed << setprecision(5) << pi; << endl;

b. cout << setprecision(5) << pi;

c. cout << showpoint << setprecision(5) << pi;

d. All of the above cause output to be 3.1416.

Have to submit in the next 40 minutes.Please help asap

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

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

Understand the principles of a learning organization.

Answered: 1 week ago

Question

LO3 Discuss the steps of a typical selection process.

Answered: 1 week ago