What is the output of the following program include include

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%d\", (int16_t) n);
}

Answer:

Question 2

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%d\", (int32_t) n);
}

Answer:

Question 3

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%lld\", (int64_t) n);
}

Answer:

Question 4

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%x\", (int32_t) n);
}

Answer:

Question 5

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   uint8_t n = 3;
   printf(\"%d\", (int32_t) n);
}

Answer:

Question 6

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   uint8_t n = 0xff;
   printf(\"%d\", (int32_t) n);
}

Answer:

Question 7

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following program?

#include <cstdint>
#include <stdio.h>
int main()
{
   uint8_t n = 0xff;
   printf(\"%d\", (int32_t) (int8_t) n);
}

Answer:

Question 8

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that x is an int and x is less than 0

if ((x * 2) < 0) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

a. could be either howdy or goodbye depending upon the value of x

b. will always be goodbye

c. will always be howdy

Question 9

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that ux is an unsigned int.

if (ux >= 0) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

a. will always be goodbye

b. could be either howdy or goodbye depending upon the value of x

c. will always be howdy

Question 10

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that ux is an unsigned int.

if (ux > -1) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

a. could be either howdy or goodbye depending upon the value of ux

b. will always be howdy

c. will always be goodbye

Question 11

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that x and y are ints and x is greater than y

if (-x < -y) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

a. will always be goodbye

b. could be either howdy or goodbye depending upon the value of x

c. will always be howdy

Question 12

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that x is an int.

if (((x >> 1) << 1) == x) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

a. could be either howdy or goodbye depending upon the value of x

b. will always be goodbye

c. will always be howdy

Question 13

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that x is an int.

if (((x >> 1) << 1) <= x) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

a. could be either howdy or goodbye depending upon the value of x

b. will always be goodbye

c. will always be howdy

Question 14

Not yet answered

Points out of 1.00

Flag question

Question text

In the code segment below, assume that x and y are ints and ux and uy are unsigned ints.

ux = x;
uy = y;
if ((x + y) == (ux + uy)) printf(\"howdy\ \"); else printf(\"goodbye\ \");

For these statements, the output will:

Select one:

a. could be either howdy or goodbye depending upon the value of x

b. will always be goodbye

c. will always be howdy

Question 15

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following C code?
#include <cstdint>
#include <stdio.h>
int main()
{
   int32_t in = -1;
   uint32_t un;

   un = in;
   in = un;
   printf(\"%d\", in);
}

Answer:

Question 16

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following C code?
unsigned int ux = -3;
unsigned int x = 3;
if (x > ux) printf(\"howdy\"); else printf(\"goodbye\");

Answer:

Question 17

Not yet answered

Points out of 1.00

Flag question

Question text

What is the output of the following C code?
#include <cstdint>
#include <stdio.h>
int main()
{
   int32_t in = -1;
   uint32_t un = 3;

   if (in < un)
      printf(\"%d\", in);
   else
      printf(\"%d\", un);
}

Answer:

Solution

Question 1

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%d\", (int16_t) n);
}

Answer: -3

Question 2

#include <cstdint>

#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%d\", (int32_t) n);
}

Answer: -3

Question 3

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%lld\", (int64_t) n);
}

Answer: -3

Question 4

#include <cstdint>
#include <stdio.h>
int main()
{
   int8_t n = -3;
   printf(\"%x\", (int32_t) n);
}

Answer: fffffffd

Question 5

#include <cstdint>

#include <stdio.h>
int main()
{
   uint8_t n = 3;
   printf(\"%d\", (int32_t) n);
}

Answer: 3

Question 6

#include <cstdint>
#include <stdio.h>
int main()
{
   uint8_t n = 0xff;
   printf(\"%d\", (int32_t) n);
}

Answer: 255

Question 7

#include <cstdint>

#include <stdio.h>
int main()
{
   uint8_t n = 0xff;
   printf(\"%d\", (int32_t) (int8_t) n);
}

Answer: -1

Question 8

In the code segment below, assume that x is an int and x is less than 0

if ((x * 2) < 0) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Answer

c. will always be howdy

Question 9

In the code segment below, assume that ux is an unsigned int.

if (ux >= 0) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Select one:

Answer:

c. will always be howdy

Question 10

In the code segment below, assume that ux is an unsigned int.

if (ux > -1) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Answer:

c. will always be goodbye

Question 11

In the code segment below, assume that x and y are ints and x is greater than y

if (-x < -y) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Answer:

c. will always be howdy

Question 12

In the code segment below, assume that x is an int.

if (((x >> 1) << 1) == x) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Answer :

b. will always be goodbye

Question 13

In the code segment below, assume that x is an int.

if (((x >> 1) << 1) <= x) printf(\"howdy\"); else printf(\"goodbye\");

What is the output?

Answer:

c. will always be howdy

Question 14

In the code segment below, assume that x and y are ints and ux and uy are unsigned ints.


ux = x;
uy = y;
if ((x + y) == (ux + uy)) printf(\"howdy\ \"); else printf(\"goodbye\ \");

For these statements, the output will:

Answer:

c. will always be howdy

Question 15

What is the output of the following C code?

#include <cstdint>
#include <stdio.h>
int main()
{
   int32_t in = -1;
   uint32_t un;

   un = in;
   in = un;
   printf(\"%d\", in);
}

Answer: -1

Question 16


unsigned int ux = -3;
unsigned int x = 3;
if (x > ux) printf(\"howdy\"); else printf(\"goodbye\");

Answer: goodbye

Question 17

What is the output of the following C code?
#include <cstdint>
#include <stdio.h>
int main()
{
   int32_t in = -1;
   uint32_t un = 3;

   if (in < un)
      printf(\"%d\", in);
   else
      printf(\"%d\", un);
}

Answer: 3

What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\
What is the output of the following program? #include <cstdint> #include <stdio.h> int main() { int8_t n = -3; printf(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site