Question 1

The __________ evaluates the expresion on the __________ side of the eual sign and places the corresponding value in te memory.

Question 2

Which of the following are valid?

x = a + 2 + y
int stamp = (int) 5.5
a + x = 2 + y
int stamp = 14
None of the above.

Question 3

The code in line 4 is an example of what?

1 int x, y;
2
3 x = 5;
4 y = x;
4 x = 3;

Question 4

With what data should you use getline() instead of cin?

Question 5

When and why is it necessary to use cin.ignore()?

Question 6

Convert the following code snippet to the switch() equivalent.

void useIfElse()
{
string text;
char c;

cin >> c;

if(c == 'e' || c == 'i' || o == 'o')
{
text = "Old MacDonald";
}
else if(c == 'a')
{
text = "Alpha";
}
else if(c == 'u')
{
text = "You";
}
else
{
text = "Invalid Input Received.";
}
}

Question 7

Convert the following code snippet to the if-else equivalent.

void useSwitch()
{
int i, x;
x = 3;
cin >> i;

switch(i)
{
case 1:
x += 2;
case 2:
case 3:
x -= 9;
break;
case 4:
x = 16;
break;
default:
x = 0;
}

cout << x;
}

Question 8

Variable and constant names must be uniue; no variable or constant can have the same name in a program. True or False?

Question 9

Functions must have unique names just like variables and constants. True or False?

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.