C# Lesson 2 - Quiz

5 Questions | Attempts: 36
Share

SettingsSettingsSettings
Lesson Quizzes & Trivia

This is the Lesson 2 Quiz. Each question is worth 5 points. Your final score will reflect the percentage of total points that you earned. Please consider re-assessing this lessons if you score less than 70%.


Questions and Answers
  • 1. 

    The ______ statement executes a code-block indicated by a value matching that of an argument to the statement.

    • A.

      Switch

    • B.

      If

    • C.

      While

    Correct Answer
    A. Switch
    Explanation
    A switch statement matches the value of its single argument against the labels of the code blocks inside the curly-braces for the switch( ){ }. The labels must be valid values for that argument.

    Rate this question:

  • 2. 

    What loop checks the condition at the end?

    • A.

      While

    • B.

      If

    • C.

      Do

    Correct Answer
    C. Do
    Explanation
    The loop that checks all the conditions before the execution of the program is "DO Loop".

    Rate this question:

  • 3. 

    A condition can be both true and false at the same time.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    A conditional statement evaluates an expression end returns exactly either Not True (false) or True. It must return one or the other, never neither, and never both.

    Rate this question:

  • 4. 

    No type of conditional statement limits the number of statements that can be controlled by that conditional statement.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    All conditional statements can be applied to a block of code, which has no practical size limit.

    Rate this question:

  • 5. 

     Which data-types are not appropriate arguments to a switch statement?

    • A.

      Integers

    • B.

      Characters

    • C.

      Strings

    Correct Answer
    C. Strings
    Explanation
    Unlike C, the language most influential to C#, C# itself will allow a string argument to a switch statement to match a case label if the strings are exactly the same. Integers, characters, and strings are appropriate types for switch() in C#.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 19, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 14, 2012
    Quiz Created by
    Shishira
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.