logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Datatypes See What Others Are Saying!
  • Question
  • Which of the following statements are correct about datatypes in C#.NET?

    1. Every datatype is either a value type or a reference type.
    2. Value types are always created on the heap.
    3. Reference types are always created on the stack.
    4. Mapping of every value type to a type in Common Type System facilitates Interoperability in C#.NET.
    5. Every reference type gets mapped to a type in Common Type System.


  • Options
  • A. 1, 3
  • B. 2, 5
  • C. 1, 4
  • D. 3, 4

  • Correct Answer
  • 1, 4 


  • More questions

    • 1. Which of the following is an 8-byte Integer?

    • Options
    • A. Char
    • B. Long
    • C. Short
    • D. Byte
    • E. Integer
    • Discuss
    • 2. Which of the following statements is valid about generic procedures in C#.NET?

    • Options
    • A. All procedures in a Generic class are generic.
    • B. Only those procedures labeled as Generic are generic.
    • C. Generic procedures can take at the most one generic parameter.
    • D. Generic procedures must take at least one type parameter.
    • E. None of the above.
    • Discuss
    • 3. The size of a derived class object is equal to the sum of sizes of data members in base class and the derived class.

    • Options
    • A. True
    • B. False
    • Discuss
    • 4. Suppose n is a variable of the type Byte and we wish to put OFF its fourth bit (from right) without disturbing any other bits. Which of the following statements will do this correctly?

    • Options
    • A. n = n && HF7
    • B. n = n & 16
    • C. n = n & 0xF7
    • D. n = n & HexF7
    • E. n = n & 8
    • Discuss
    • 5. Which of the following statements is correct about namespaces in C#.NET?

    • Options
    • A. Namespaces can be nested only up to level 5.
    • B. A namespace cannot be nested.
    • C. There is no limit on the number of levels while nesting namespaces.
    • D. If namespaces are nested, then it is necessary to use using statement while using the elements of the inner namespace.
    • E. Nesting of namespaces is permitted, provided all the inner namespaces are declared in the same file.
    • Discuss
    • 6. If Sample class has a Length property with get and set accessors then which of the following statements will work correctly?

      1. Sample.Length = 20;
      2. Sample m = new Sample(); 
        m.Length = 10;
      3. Console.WriteLine(Sample.Length);
      4. Sample m = new Sample(); 
        int len;
        len = m.Length;
      5. Sample m = new Sample(); 
        m.Length = m.Length + 20;

    • Options
    • A. 1, 3
    • B. 2, 4, 5
    • C. 4 only
    • D. 3, 5
    • Discuss
    • 7. Which of the following statements are correct about exception handling in C#.NET?

      1. try blocks cannot be nested.
      2. In one function, there can be only one try block.
      3. An exception must be caught in the same function in which it is thrown.
      4. All values set up in the exception object are available in the catch block.
      5. While throwing a user-defined exception multiple values can be set in the exception, object.

    • Options
    • A. 1 only
    • B. 1 and 2 only
    • C. 3 only
    • D. 4 and 5 only
    • E. All of the above
    • Discuss
    • 8. Which of the following statements is correct about the C#.NET code snippet given below?

      interface IMyInterface 
      {
          void fun1(); 
          void fun2();
      }
      class MyClass: IMyInterface
      { 
          private int i; 
          void IMyInterface.fun1()
          { 
              // Some code
          } 
      }

    • Options
    • A. Class MyClass is an abstract class.
    • B. Class MyClass cannot contain instance data.
    • C. Class MyClass fully implements the interface IMyInterface.
    • D. Interface IMyInterface should be inherited from the Object class.
    • E. The compiler will report an error since the interface IMyInterface is only partially implemented.
    • Discuss
    • 9. What will be the output of the C#.NET code snippet given below?

      int i, j = 1, k;
      for (i = 0; i < 5; i++)
      {
          k = j++ + ++j;
          Console.Write(k + " ");
      }

    • Options
    • A. 8 4 16 12 20
    • B. 4 8 12 16 20
    • C. 4 8 16 32 64
    • D. 2 4 6 8 10
    • Discuss
    • 10. Which of the following statements are correct about exception handling in C#.NET?

      1. If an exception occurs then the program terminates abruptly without getting any chance to recover from the exception.
      2. No matter whether an exception occurs or not, the statements in the finally clause (if present) will get executed.
      3. A program can contain multiple finally clauses.
      4. A finally clause is written outside the try block.
      5. finally clause is used to perform clean up operations like closing the network/database connections.

    • Options
    • A. 1 only
    • B. 2 only
    • C. 2 and 5 only
    • D. 3 and 4 only
    • E. None of the above
    • Discuss


    Comments

    There are no comments.

Enter a new Comment