logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Operators See What Others Are Saying!
  • Question
  • What will be the output of the C#.NET code snippet given below?

    byte b1 = 0xAB;
    byte b2 = 0x99;
    byte temp;
    temp = (byte)~b2;
    Console.Write(temp + " ");
    temp = (byte)(b1 << b2);
    Console.Write (temp + " ");
    temp = (byte) (b2 >> 2);
    Console.WriteLine(temp);


  • Options
  • A. 102 1 38
  • B. 108 0 32
  • C. 102 0 38
  • D. 1 0 1

  • Correct Answer
  • 102 0 38 


  • More questions

    • 1. Which of the following statements is correct about the C#.NET code snippet given below?

          int[] intMyArr = {11, 3, 5, 9, 4}; 

    • Options
    • A. intMyArr is a reference to an object of System.Array Class.
    • B. intMyArr is a reference to an object of a class that the compiler derives from System.Array Class.
    • C. intMyArr is a reference to an array of integers.
    • D. intMyArr is a reference to an object created on the stack.
    • E. intMyArr is a reference to the array created on the stack.
    • Discuss
    • 2. Which of the following statements are correct about the this reference?

      1. this reference can be modified in the instance member function of a class.
      2. Static functions of a class never receive the this reference.
      3. Instance member functions of a class always receive a this reference.
      4. this reference continues to exist even after control returns from an instance member function.
      5. While calling an instance member function we are not required to pass the this reference explicitly.

    • Options
    • A. 1, 4
    • B. 2, 3, 5
    • C. 3, 4
    • D. 2, 5
    • E. None of these
    • Discuss
    • 3. A property can be declared inside a class, struct, Interface.

    • Options
    • A. True
    • B. False
    • Discuss
    • 4. Which of the following statements is correct about an interface used in C#.NET?

    • Options
    • A. One class can implement only one interface.
    • B. In a program if one class implements an interface then no other class in the same program can implement this interface.
    • C. From two base interfaces a new interface cannot be inherited.
    • D. Properties can be declared inside an interface.
    • E. Interfaces cannot be inherited.
    • Discuss
    • 5. 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
    • 6. Which of the following statements are correct about enum used in C#.NET?

      1. Every enum is derived from an Object class.
      2. Every enum is a value type.
      3. There does not exist a way to print an element of an enum as a string.
      4. Every enum is a reference type.
      5. The default underlying datatype of an enum is int.

    • Options
    • A. 1, 2, 5
    • B. 1, 4
    • C. 3, 5
    • D. 2, 3, 4
    • Discuss
    • 7. Which of the following statements are correct about the delegate declaration given below?

          delegate void del(int i);
      1. On declaring the delegate a class called del will get created.
      2. The signature of del need not be same as the signature of the method that we intend to call using it.
      3. The del class will be derived from the MulticastDelegate class.
      4. The method that can be called using del should not be a static method.
      5. The del class will contain a one-argument constructor and an lnvoke() method.

    • Options
    • A. 1, 2 and 3 only
    • B. 1, 3 and 5 only
    • C. 2 and 4 only
    • D. 4 only
    • E. All of the above
    • Discuss
    • 8. Can static procedures access instance data?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 9. Which of the following are parts of the .NET Framework?

      1. The Common Language Runtime (CLR)
      2. The Framework Class Libraries (FCL)
      3. Microsoft Published Web Services
      4. Applications deployed on IIS
      5. Mobile Applications

    • Options
    • A. Only 1, 2, 3
    • B. Only 1, 2
    • C. Only 1, 2, 4
    • D. Only 4, 5
    • E. All of the above
    • Discuss
    • 10. For the code snippet given below, which of the following statements is valid?

      public class Generic<T>
      {
          public T Field;
      }
      class Program
      {
          static void Main(string[ ] args)
          {
              Generic<String> g = new Generic<String>();
              g.Field = "Hello";
              Console.WriteLine(g.Field);
          }
      }

    • Options
    • A. It will print string "Hello" on the console.
    • B. Name Generic cannot be used as a class name because it's a keyword.
    • C. Compiler will give an error.
    • D. Member Field of class Generic is not accessible directly.
    • E. None of the above.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment