1. Question: What is the result of the expression 7 / 2 in C#?

    A
    3.5

    B
    3

    C
    4

    D
    2

    Note: In C#, integer division truncates the decimal portion, so 7 / 2 results in 3.
    1. Report
  2. Question: Which operator is used to check if a variable is of a certain type?

    A
    is

    B
    as

    C
    type

    D
    typeof

    Note: The is operator checks whether an object is compatible with a given type.
    1. Report
  3. Question: What will the expression 5.0 / 2 evaluate to?

    A
    2

    B
    2.5

    C
    3

    D
    0

    Note: When performing division with at least one floating-point number, the result is a floating-point number.
    1. Report
  4. Question: Which operator is used to perform a logical AND operation?

    A
    &

    B
    &&

    C
    and

    D
    ||

    Note: The && operator is a short-circuit logical AND that evaluates the second operand only if the first is true.
    1. Report
  5. Question: What does the operator | do?

    A
    Performs logical OR

    B
    Performs bitwise OR

    C
    Performs both Logical and bitwise OR

    D
    None

    Note: The | operator performs a bitwise OR operation on two integral types.
    1. Report
  6. Question: What is the output of 3 ^ 2?

    A
    1

    B
    5

    C
    0

    D
    6

    Note: The ^ operator performs a bitwise XOR operation; hence, 3 ^ 2 results in 1 (binary 11 ^ 10 = 01).
    1. Report
  7. Question: What does the ?? operator do?

    A
    Checks for equality

    B
    Returns the left operand if not null, otherwise the right operand

    C
    Performs logical negation

    D
    None

    Note: The ?? operator is known as the null-coalescing operator.
    1. Report
  8. Question: Which operator has the highest precedence in C#?

    A
    +

    B
    *

    C
    /

    D
    -

    Note: Multiplication and division have higher precedence than addition and subtraction.
    1. Report
  9. Question: What is the result of 1 << 3

    A
    1

    B
    2

    C
    8

    D
    4

    Note: The left shift operator << shifts bits to the left, effectively multiplying the number by 2 for each shift.
    1. Report
  10. Question: What is the output of the expression 5 % 2?

    A
    1

    B
    2

    C
    0

    D
    5

    Note: The modulo operator % returns the remainder of the division.
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd