Solved

Given the Following Switch Statement Where X Is an Int

Question 3

Multiple Choice

Given the following switch statement where x is an int, answer the questions below
switch (x)
{
case 3 : x += 1;
case 4 : x += 2;
case 5 : x += 3;
case 6 : x++;
case 7 : x += 2;
case 8 : x--;
case 9 : x++
}
-The statement if (x < 0) y = x; else y = 0; can be rewritten using a conditional operator as


A) y = (x < 0) ? x : 0;
B) x = (x < 0) ? y : 0;
C) (x < 0) ? y = x : y = 0;
D) y = (x < 0) ;
E) y = if (x < 0) x : 0;

Correct Answer:

verifed

Verified

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents