logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Control Instructions Comments

  • Question
  • Which of the following can be used to terminate a while loop and transfer control outside the loop?

    1. exit while
    2. continue
    3. exit statement
    4. break
    5. goto


  • Options
  • A. 1, 3
  • B. 2, 4
  • C. 3, 5
  • D. 4, 5
  • E. None of these

  • Correct Answer
  • 4, 5 


  • Control Instructions problems


    Search Results


    • 1. Which of the following statements are correct about a .NET Assembly?

      1. It is the smallest deployable unit.
      2. Each assembly has only one entry point - Main(), WinMain() or DLLMain().
      3. An assembly can be a Shared assembly or a Private assembly.
      4. An assembly can contain only code and data.
      5. An assembly is always in the form of an EXE file.

    • Options
    • A. 1, 2, 3
    • B. 2, 4, 5
    • C. 1, 3, 5
    • D. 1, 2
    • Discuss
    • 2. Code that targets the Common Language Runtime is known as

    • Options
    • A. Unmanaged
    • B. Distributed
    • C. Legacy
    • D. Managed Code
    • E. Native Code
    • Discuss
    • 3. Which of the following utilities can be used to compile managed assemblies into processor-specific native code?

    • Options
    • A. gacutil
    • B. ngen
    • C. sn
    • D. dumpbin
    • E. ildasm
    • Discuss
    • 4. Which of the following components of the .NET framework provide an extensible set of classes that can be used by any .NET compliant programming language?

    • Options
    • A. .NET class libraries
    • B. Common Language Runtime
    • C. Common Language Infrastructure
    • D. Component Object Model
    • E. Common Type System
    • Discuss
    • 5. Which of the following statements are TRUE about the .NET CLR?

      1. It provides a language-neutral development & execution environment.
      2. It ensures that an application would not be able to access memory that it is not authorized to access.
      3. It provides services to run "managed" applications.
      4. The resources are garbage collected.
      5. It provides services to run "unmanaged" applications.

    • Options
    • A. Only 1 and 2
    • B. Only 1, 2 and 4
    • C. 1, 2, 3, 4
    • D. Only 4 and 5
    • E. Only 3 and 4
    • Discuss
    • 6. Which of the following statements are correct?

      1. A switch statement can act on numerical as well as Boolean types.
      2. A switch statement can act on characters, strings and enumerations types.
      3. We cannot declare variables within a case statement if it is not enclosed by { }.
      4. The foreach statement is used to iterate through the collection to get the desired information and should be used to change the contents of the collection to avoid unpredictable side effects.
      5. All of the expressions of the for statement are not optional.

    • Options
    • A. 1, 2
    • B. 2, 3
    • C. 3, 5
    • D. 4, 5
    • E. None of these
    • Discuss
    • 7. What will be the output of the C#.NET code snippet given below?

      int val;
      for (val = -5; val <= 5; val++)
      {
          switch (val)
          {
              case 0:
                  Console.Write ("India"); 
                  break;
          }
          
          if (val > 0)
              Console.Write ("B"); 
          else if (val < 0)
              Console.Write ("X");
      }

    • Options
    • A. XXXXXIndia
    • B. IndiaBBBBB
    • C. XXXXXIndiaBBBBB
    • D. BBBBBIndiaXXXXX
    • E. Zero
    • Discuss
    • 8. Which of the following statements is correct?

    • Options
    • A. It is not possible to extend the if statement to handle multiple conditions using the else-if arrangement.
    • B. The switch statement can include any number of case instances with two case statements having the same value.
    • C. A jump statement such as a break is required after each case block excluding the last block if it is a default statement.
    • D. The if statement selects a statement for execution based on the value of a Boolean expression.
    • E. C# always supports an implicit fall through from one case label to another.
    • Discuss
    • 9. What will be the output of the code snippet given below?

      int i;
      for(i = 0; i<=10; i++)
      {
          if(i == 4)
          {
              Console.Write(i + " "); continue;
          }
          else if (i != 4)
              Console.Write(i + " "); else
          break;
      }

    • Options
    • A. 1 2 3 4 5 6 7 8 9 10
    • B. 1 2 3 4
    • C. 0 1 2 3 4 5 6 7 8 9 10
    • D. 4 5 6 7 8 9 10
    • E. 4
    • Discuss
    • 10. Which of the following statements are correct about the C#.NET code snippet given below?

      if (age > 18 && no < 11)
          a = 25;
      1. The condition no < 11 will be evaluated only if age > 18 evaluates to True.
      2. The statement a = 25 will get executed if any one condition is True.
      3. The condition no < 11 will be evaluated only if age > 18 evaluates to False.
      4. The statement a = 25 will get executed if both the conditions are True.
      5. && is known as a short circuiting logical operator.

    • Options
    • A. 1, 3
    • B. 2, 5
    • C. 1, 4, 5
    • D. 3, 4, 5
    • E. None of these
    • Discuss


    Comments

    There are no comments.

Enter a new Comment