Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer only in C++ 1. The following are all valid initializations of an array of characters EXCEPT _ Select one: a.char pet[]=cat; b.char pet[]={'c', 'a',

Answer only in C++

1. The following are all valid initializations of an array of characters EXCEPT _

Select one:

a.char pet[]="cat";

b.char pet[]={'c', 'a', 't'};

c.char pet[]={'c', 'a', 't', '\0'};

d.char pet[3]="cat";

2. Suppose that x = 33.80, y = 791.211, and z = 2006.7475. What is the output of the statements?

cout << fixed << showpoint;

cout << setprecision(3);

cout << x << << y << << z << endl;

Select one:

a.33.80 791.211 2006.747

b.33.80 791.211 2006.746

c.33.800 791.211 2006.747

d.33.800 791.211 2006.748

3. Given the following program segment:

int i;

int value = 3;

for (i = 0; i < 5; i++)

value = value * (i + 1) + i;

cout << "value = " << value << endl;

Which of the following a while loops that have the same output?

Select one:

a.int i = 0;

int value = 3;

while (i < 5)

{

value = value * (i + 1) + i;

i = i + 1;

}

cout << "value = " << value << endl;

b.int i = 0;

int value = 3;

while (i <= 5)

{

value = value * (i + 1) + i;

i = i + 1;

}

cout << "value = " << value << endl;

c.int i = 0;

int value = 3;

while (i < 5)

{

value = value * (i + 1) + i;

cout << "value = " << value << endl;

i = i + 1;

}

d.int i;

int value = 3;

while (i < 5)

{

value = value * (i + 1) + i;

i = i + 1;

}

cout << "value = " << value << endl;

4. Consider the following declarations:

struct Date {int month; int day; int year;};

struct {string name; Date birth;} person;

Which one of the following is a correct assignment statement?

Select one:

a.person.Date.month = 12;

b.person.month.birth = 12;

c.person.birth.month = 12;

d.Date.person.birth = 12;

5. Which of the following while looping structure uses a bool variable to control loop?

Select one:

a.Sentinel controlled

b.Flag controlled

c.Counter controlled

d.EOF controlled

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

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

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions