Quiz #2

(Last Mod: 27 November 2010 21:38:40 )

ECE-1021 Home


Name:                                                             CODE:                 Section:           Date:                  

NO CALCULATORS MAY BY USED ON THIS QUIZ

  1. Which of the following are all pairs of complementary operators?

    1. (||, &&), (+, -), (/, /%).

    2. (==, !=), (>, <), (=, <=).

    3. (<=, >), (!=, ==), (>, <=).

    4. (!, ~), (|, ||), (&, &&).

     

  2. Which of the following statements is NOT true?

    1. Logical and relational operators always return a value of 1 if the expression is True

    2. Negative values cannot be used or interpreted as logical values.

    3. A value is considered a logical False only if it evaluates exactly to zero.

    4. Functions that return logical results may return values other than a 0 or a 1.

     

  3. What are the three building blocks of a structured program?

    1. for() loops, while() loops, and do/while() loops

    2. Statements, functions, and files.

    3. Loads, stores, and branches

    4. Sequences, selections, and repetitions.

     

  4. What is the category that ASCII codes fall into if they are printing characters but are not alphanumeric?

    1. punctuation characters.

    2. control characters.

    3. white space.

    4. escape sequences.

     

  5. Why is it considered a bad idea to use floating point data as operands to logical or equality/inequality operators?

    1. Because these operators are only defined for integer operands.

    2. Because floating point values are almost guaranteed to evaluate as False and/or not equal.

    3. Because any value less than some pre-defined amount will be considered False.

    4. Because zero cannot be exactly represented by a floating point value.