logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Functions and Subroutines See What Others Are Saying!
  • Question
  • A function returns a value, whereas a subroutine cannot return a value.


  • Options
  • A. True
  • B. False

  • Correct Answer
  • True 


  • More questions

    • 1. Which of the following is the root of the .NET type hierarchy?

    • Options
    • A. System.Object
    • B. System.Type
    • C. System.Base
    • D. System.Parent
    • E. System.Root
    • Discuss
    • 2. Which of the following is NOT a Bitwise operator in C#.NET?

    • Options
    • A. &
    • B. |
    • C. <<
    • D. ^
    • E. ~
    • Discuss
    • 3. Which of the following is the correct default value of a Boolean type?

    • Options
    • A. 0 
    • B. 1
    • C. True
    • D. False
    • E. -1
    • Discuss
    • 4. 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
    • Discuss
    • 5. A class D can be derived from a class C, which is derived from a class B, which is derived from a class A.

    • Options
    • A. True
    • B. False
    • Discuss
    • 6. 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
    • 7. Which of the following forms of applying an attribute is correct?

    • Options
    • A.
      < Serializable() > class sample
      { /* ... */ }
    • B.
      (Serializable()) class sample
      { /* ... */ }
    • C.
      [ Serializable() ] class sample
      { /* ... */ }
    • D.
      Serializablef) class sample
      { /* ... */ }
    • E. None of the above
    • Discuss
    • 8. Which of the following statements are correct about the exception reported below?
      Unhandled Exception: System.lndexOutOfRangeException: Index was outside the bounds of the array: at CuriousTabConsoleApplication.MyProgram.SetVal(Int32 index, Int32 val) in D:\Sample\CuriousTabConsoleApplication\MyProgram.cs:line 26 at CuriousTabConsoleApplication.MyProgram.Main(String[] args) in D:\Sample\CuriousTabConsoleApplication\MyProgram.cs:line 20

      1. The CLR failed to handle the exception.
      2. The class MyProgram belongs to the namespace MyProgram.
      3. The function SetVal() was called from Main() in line number 20.
      4. The exception occurred in line number 26 in the function SetVal()
      5. The runtime exception occurred in the project CuriousTabConsoleApplication.

    • Options
    • A. 1 only
    • B. 1 and 2 only
    • C. 3, 4 and 5 only
    • D. All of the above
    • E. None of the above
    • Discuss
    • 9. Which of the following is the correct way to call the function MyFun() of the Sample class given below?

      class Sample
      {
          public int MyFun(int i)
          {
              Console.WriteLine("Welcome to CuriousTab.com !" );
              return 0;
          }
      }

    • Options
    • A.
      delegate void del(int i);
      Sample s = new Sample();
      deld = new del(ref s.MyFun);
      d(10);
    • B.
      delegate int del(int i);
      Sample s = new Sample(.);
      del = new delegate(ref MyFun);
      del(10);
    • C.
      Sample s = new Sample();
      delegate void del = new delegate(ref MyFun);
      del(10);
    • D.
      delegate int del(int i);
      del d;
      Sample s = new Sample();
      d = new del(ref s.MyFun);
      d(10);
    • Discuss
    • 10. Which of the following statements is correct about the C#.NET code snippet given below?

      interface IPerson
      { 
          String FirstName
          { 
              get; 
              set;
          }
          String LastName
          {
              get; 
              set;
          }
          void Print(); 
          void Stock(); 
          int Fun(); 
      }

    • Options
    • A. Properties cannot be declared inside an interface.
    • B. This is a perfectly workable interface.
    • C. The properties in the interface must have a body.
    • D. Subroutine in the interface must have a body.
    • E. Functions cannot be declared inside an interface.
    • Discuss


    Comments

    There are no comments.

Enter a new Comment