We wish to write the following code segment using the ternary operator:

if ( a == b )
c = 5;
else
c = 0;

The resulting line of code would look like this:

A. c = ( a == b ) : 5 ? 0;
B. c = ( a == b )? 5 : 0;
C. c = ( a == b )? 0 : 5;
D. ( a == b )? c = 5 : 0;

B

Computer Science & Information Technology

You might also like to view...

Compare to the Ribbon, the Font dialog box offers:

A) the same number of options. B) instant previews of how changes will appear in the document. C) a simpler way to change very basic settings. D) the ability to make several changes at the same time.

Computer Science & Information Technology

Which of the following is NOT a task typically performed by an OS's file system?

A. provide a convenient user interface B. store file metadata C. convert files between image formats D. organize space on a storage device

Computer Science & Information Technology