logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Namespaces See What Others Are Saying!
  • Question
  • Which of the following is absolutely neccessary to use a class Point present in namespace Graph stored in library?


  • Options
  • A. Use fully qualified name of the Point class.
  • B. Use using statement before using the Point class.
  • C. Add Reference of the library before using the Point class.
  • D. Use using statement before using the Point class.
  • E. Copy the library into the current project directory before using the Point class.

  • Correct Answer
  • Add Reference of the library before using the Point class. 


  • More questions

    • 1. Which of the following statements are correct?

      1. C# allows a function to have arguments with default values.
      2. C# allows a function to have variable number of arguments.
      3. Omitting the return value type in method definition results into an exception.
      4. Redefining a method parameter in the method's body causes an exception.
      5. params is used to specify the syntax for a function with variable number of arguments.

    • Options
    • A. 1, 3, 5
    • B. 3, 4, 5
    • C. 2, 5
    • D. 4, 5
    • E. None of these
    • Discuss
    • 2. Which of the following statements is correct?

    • Options
    • A. When a class inherits an interface it inherits member definitions as well as its implementations.
    • B. An interface cannot contain the signature of an indexer.
    • C. Interfaces members are automatically public.
    • D. To implement an interface member, the corresponding member in the class must be public as well as static.
    • Discuss
    • 3. Which of the following statements are correct?

      1. An argument passed to a ref parameter need not be initialized first.
      2. Variables passed as out arguments need to be initialized prior to being passed.
      3. Argument that uses params keyword must be the last argument of variable argument list of a method.
      4. Pass by reference eliminates the overhead of copying large data items.
      5. To use a ref parameter only the calling method must explicitly use the ref keyword.

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

      namespace CuriousTabConsoleApplication
      { 
          class Sample
          { 
              static Sample()
              { 
                  Console.Write("Sample class ");
              }
              public static void CuriousTab1()
              { 
                  Console.Write("CuriousTab1 method ");
              } 
          } 
          class MyProgram
          { 
              static void Main(string[ ] args)
              { 
                  Sample.CuriousTab1();
              } 
          } 
      }

    • Options
    • A. Sample class Tab1 method
    • B. Tab1 method
    • C. Sample class
    • D. Tab1 method Sample class
    • E. Sample class Sample class
    • Discuss
    • 5. Which of the following is the correct way to define the constructor(s) of the Sample class if we are to create objects as per the C#.NET code snippet given below?

      Sample s1 = new Sample(); 
      Sample s2 = new Sample(9, 5.6f);

    • Options
    • A.
      public Sample()
      {
          i = 0; 
          j = 0.0f;
      }
      public Sample (int ii, Single jj)
      {
          i = ii;
          j = jj;
      }
    • B.
      public Sample (Optional int ii = 0, Optional Single jj = 0.0f)
      {
          i = ii;
          j = jj;
      }
    • C.
      public Sample (int ii, Single jj)
      {
          i = ii;
          j = jj;
      }
    • D.
      Sample s;
    • E.
      s = new Sample();
    • Discuss
    • 6. Which of the following statements is correct about constructors?

    • Options
    • A. If we provide a one-argument constructor then the compiler still provides a zero-argument constructor.
    • B. Static constructors can use optional arguments.
    • C. Overloaded constructors cannot use optional arguments.
    • D. If we do not provide a constructor, then the compiler provides a zero-argument constructor.
    • Discuss
    • 7. Which of the following statements is correct about the C#.NET code snippet given below?

      short s1 = 20;
      short s2 = 400;
      int a;
      a = s1 * s2;


    • Options
    • A. A value 8000 will be assigned to a.
    • B. A negative value will be assigned to a.
    • C. During arithmetic if the result exceeds the high or low value of the range the value wraps around till the other side of the range.
    • D. An error is reported as widening conversion cannot takes place.
    • E. An overflow error will be reported since the result of the multiplication exceeds the range of a Short Integer.
    • Discuss
    • 8. Which of the following is another way to rewrite the code snippet given below?

      int a = 1, b = 2, c = 0;
      if (a < b) c = a;


    • Options
    • A.
      int a = 1, b = 2, c = 0;
      c = a < b ? a : 0;
    • B.
      int a = 1, b = 2, c = 0;
      a < b ? c = a : c = 0;
    • C.
      int a = 1, b = 2, c = 0;
      a < b ? c = a : c = 0 ? 0 : 0;
    • D.
      int a = 1, b = 2, c = 0;
      a < b ? return (c): return (0);
    • E.
      int a = 1, b = 2,c = 0;
      c = a < b : a ? 0;
    • Discuss
    • 9. For the code snippet given below, which of the following statements are valid?

      public class MyContainer<T> where T: IComparabte
      {
          // Insert code here
      }
      1. Class MyContainer requires that it's type argument must implement IComparabte interface.
      2. Type argument of class MyContainer must be IComparabte.
      3. Compiler will report an error for this block of code.
      4. This requirement on type argument is called as constraint.

    • Options
    • A. 1 and 2 Only
    • B. 1, 2 and 3 Only
    • C. 1 and 4 Only
    • D. All of the above
    • E. None of the above
    • Discuss
    • 10. Which of the following statements correctly define .NET Framework?

    • Options
    • A. It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services.
    • B. It is an environment for developing, building, deploying and executing only Web Applications.
    • C. It is an environment for developing, building, deploying and executing Distributed Applications.
    • D. It is an environment for developing, building, deploying and executing Web Services.
    • E. It is an environment for development and execution of Windows applications.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment