Skip to main content
Engineering LibreTexts

26.8: Quiz Question Answers - Chapter 8

  • Page ID
    54417
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Quiz question answers for chapter 8 are as follows:

    1. The six relational operators are >, >=, <, <=, ==, and /=.
    2. The three basic logical operators are .and., .or., and .not. where the leading and trailing periods are required.
    3. The answers are .true., .true., .false., .true., .true., .false., and .false. where the leading and trailing periods are required.
    4. The statements are as follows:
      if (lives <= 0) then
          write (*,*) "Game Over"
      end if
      Note, this also could be done as follows:
      if (lives <= 0) write (*,*) "Game Over"
    5. The statements are as follows:
      if (num < 0) then
          num = abs(num)
          write (*,*) "Variable num was made positive"
      end if
    6. The statements are as follows:
      if (y /= 0) then
          z = x / y
      else
          z = 0
          write (*,*) "Z not calculated"
      end if
      Note, another correct solution is as follows:
      if (y == 0) then
          z = 0
          write (*,*) "Z not calculated"
      else
          z = x / y
      end if
    7. The statements are as follows:
      if (x <= 0.0) then
          f = x**2 * y
      else
          f = x * y
      end if

    This page titled 26.8: Quiz Question Answers - Chapter 8 is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Ed Jorgensen via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.