Question: QUESTION 4 The following code can compile but a keyword is missing in the the structure; which of the following keywords should replace case 'I'

QUESTION 4

The following code can compile but a keyword is missing in the the structure; which of the following keywords should replace case 'I' ?

char l = 'A';

switch(l)

{

case 'D': cout << "Democrat ";

case 'R': cout << "Republican ";

case 'I': cout << " Independent ";

}

A.

if

B.

break:

C.

case else:

D.

default:

10 points

QUESTION 5

Consider this code, after modification to its correct format (In that order, one statement needs change). When char l = 'A', what will be displayed?

char l;

switch(l)

{

case 'D': cout << "Democrat ";

case 'R': cout << "Republican ";

case 'I': cout << " Independent ";

}

When char l = 'A', what will be displayed?

A.

if

B.

break:

C.

default:

D.

case else:

10 points

QUESTION 6

Consider the following piece of code:

int main ()

{

int n = 5;

char letter;

while (n-1 > 0)

{cout << n << " ";

--n;

}

cout << " Enter a letter to exit ";

cin >> letter;

return 0;

}

Which of the following will be displayed?

A.

5 4 3 2

B.

4 3 2

C.

5 4 3 2 1

D.

4 3 2 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!