Gdura 1 1 2 Fall2023- Chapter 6: Sizeof Operator Quiz
18 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does the expression 6 + 4 / 2 evaluate to?

  • 5.0
  • 8 (correct)
  • 6
  • 4

If a = 1.0, b = 2.0, c = 3.0, and d = 4.0, what is the result of the expression 1.0 - 2.0 / 3.0 * 4.0?

  • -0.666666
  • -2.333333
  • -1.0
  • -1.666666 (correct)

What is the final value of N when N = 10 / 3 is executed?

  • 2.666666
  • 3.333333
  • 3 (correct)
  • 4

In the expression 10 / (3 * 3), what is the final evaluated result?

<p>1 (A)</p> Signup and view all the answers

Given X = 10 / 3 and Y = 10 / 3.0, what is the difference between X and Y?

<p>0.333333 (B)</p> Signup and view all the answers

What is the output of the expression 6 + 4 ) / 2?

<p>5 (B)</p> Signup and view all the answers

Which of the following operators is used to determine the size of a variable?

<p>sizeof (A)</p> Signup and view all the answers

What is the output of the following code: int x = 5; printf("%d", sizeof(x++));

<p>4 (B)</p> Signup and view all the answers

Given that i = 3, j = 6, and k = 9, what is the value of the expression (j == 6) && (k != 9)?

<p>false (A)</p> Signup and view all the answers

Which of the following operators has the highest precedence?

<p>++ (A)</p> Signup and view all the answers

If i = 5 and j = 10, what is the value of the expression (i > 3) ? i++ : j++?

<p>6 (C)</p> Signup and view all the answers

Which of the following expressions is equivalent to (x != y) && (x > 0) && (y < 0)?

<p>!(x == y) &amp;&amp; !(x &lt;= 0) &amp;&amp; !(y &gt;= 0) (D)</p> Signup and view all the answers

What is the value of x after the following code executes? int x = 5; x++;

<p>6 (A)</p> Signup and view all the answers

What is the output of the following code? int x = 3; printf("%d", ++x * x++);

<p>16 (A)</p> Signup and view all the answers

What is the value of the expression sizeof(int) * sizeof(char)?

<p>The value depends on the system architecture (B)</p> Signup and view all the answers

What is the output of the following code? int x = 5, y = 10; printf("%d", x-- - ++y);

<p>-6 (D)</p> Signup and view all the answers

Which of the following is a valid use of the sizeof operator?

<p>sizeof(int) (D)</p> Signup and view all the answers

What is the value of x after the following code executes? int x = 10; x = x++ + ++x;

<p>21 (D)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser