Overview UPDATED ACTUAL Exam
Questions and CORRECT Answers
.TRUE. - CORRECT ANSWER - A valid logical constant in Fortran.
.FALSE. - CORRECT ANSWER - A valid logical constant in Fortran.
.TRUE - CORRECT ANSWER - Missing a period at the end, making it unbalanced.
FALSE - CORRECT ANSWER - Has no periods and will be treated as a variable instead
of a logical constant.
== - CORRECT ANSWER - A relational operator that means 'Equal to'.
/= - CORRECT ANSWER - A relational operator that means 'Not equal to'.
> - CORRECT ANSWER - A relational operator that means 'Greater than'.
< - CORRECT ANSWER - A relational operator that means 'Less than'.
>= - CORRECT ANSWER - A relational operator that means 'Greater than or equal to'.
<= - CORRECT ANSWER - A relational operator that means 'Less than or equal to'.
Relational operator return value - CORRECT ANSWER - Returns a logical value, either
.TRUE. or .FALSE.
, Relational operators functionality - CORRECT ANSWER - They compare two numerical
or character values and return .TRUE. if the condition is met, otherwise .FALSE.
Difference between == and = - CORRECT ANSWER - == is a relational operator used to
compare values, while = is an assignment operator that sets the value of a variable.
.AND. - CORRECT ANSWER - A logical operator that returns .TRUE. if both conditions
are true, otherwise returns .FALSE.
.OR. - CORRECT ANSWER - A logical operator that returns .TRUE. if at least one of the
conditions is true, otherwise returns .FALSE.
.NOT. - CORRECT ANSWER - A logical operator that negates a logical value, returning
.TRUE. if the condition is false and .FALSE. if the condition is true.
Real numbers comparison issue - CORRECT ANSWER - Real numbers should not be
directly compared using == in Fortran due to finite precision and small rounding errors.
Correct way to test equality of real numbers - CORRECT ANSWER - Use a tolerance
value and check if their absolute difference is smaller than this tolerance.
Comparing real numbers with tolerance - CORRECT ANSWER - Instead of using var_a
== var_b, use abs(var_b - var_a) < tol, where tol is a small number like 1.0e-6.
Order of operations in Fortran - CORRECT ANSWER - The sequence in which operations
are performed in expressions.
Parentheses - CORRECT ANSWER - Used to group expressions in programming.
Exponentiation - CORRECT ANSWER - A mathematical operation that raises a number to
the power of another.