logo

CuriousTab

CuriousTab

Discussion


Home C# Programming Classes and Objects See What Others Are Saying!
  • Question
  • Which of the following will be the correct output for the C#.NET program given below?

    namespace CuriousTabConsoleApplication
    { 
        class Sample
        { 
            int i; 
            Single j; 
            public void SetData(int i, Single j)
            { 
                this.i = i; 
                this.j = j;
            }
            public void Display()
            { 
                Console.WriteLine(i + " " + j);
            } 
        } 
        class MyProgram
        { 
            static void Main(string[ ] args)
            {
                Sample s1 = new Sample(); 
                s1.SetData(36, 5.4f); 
                s1.Display(); 
            } 
        } 
    }


  • Options
  • A. 0 0.0
  • B. 36 5.4
  • C. 36 5.400000
  • D. 36 5
  • E. None of the above

  • Correct Answer
  • 36 5.4 


  • More questions

    • 1. Which of the following code snippets are the correct way to determine whether a is Odd or Even?

      1. int a;
        String res; 
        if (a % 2 == 0)
            res = "Even"; 
        else 
            res = "Odd";
      2. int a; 
        String res; 
        if (a Mod 2 == 0) 
            res = "Even"; 
        else
            res = "Odd";
      3. int a;
        Console.WriteLine(a Mod 2 == 0? "Even": "Odd");
      4. int a; 
        String res;
        a % 2 == 0? res = "Even" : res = "Odd";
        Console.WriteLine(res);

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

      int a = 10, b = 20, c = 30; 
      int res = a < b? a < c? c : a : b; 
      Console.WriteLine(res);

    • Options
    • A. 10
    • B. 20
    • C. 30
    • D. Compile Error / Syntax Error
    • Discuss
    • 3. How can you prevent inheritance from a class in C#.NET?

    • Options
    • A. Declare the class as shadows.
    • B. Declare the class as overloads.
    • C. Declare the class as sealed.
    • D. Declare the class as suppress.
    • E. Declare the class as override.
    • Discuss
    • 4. There is no private or protected inheritance in C#.NET.

    • Options
    • A. True
    • B. False
    • Discuss
    • 5. Which of the following is NOT an Arithmetic operator in C#.NET?

    • Options
    • A. **
    • B. +
    • C. /
    • D. %
    • E. *
    • Discuss
    • 6. The space required for structure variables is allocated on stack.

    • Options
    • A. True
    • B. False
    • Discuss
    • 7. Is it possible to invoke Garbage Collector explicitly?

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. It possible to create a custom attribute that can be applied only to specific programming element(s) like ____ .

    • Options
    • A. Classes
    • B. Methods
    • C. Classes and Methods
    • D. Classes, Methods and Member-Variables
    • Discuss
    • 9. C#.NET structures are always value types.

    • Options
    • A. True
    • B. False
    • Discuss
    • 10. What does the following C#.NET code snippet will print?

      int i = 0, j = 0; 
      
      label:
          i++;
          j+=i;
      if (i < 10)
      {
          Console.Write(i +" ");
          goto label; 
      }

    • Options
    • A. Prints 1 to 9
    • B. Prints 0 to 8
    • C. Prints 2 to 8
    • D. Prints 2 to 9
    • E. Compile error at label:.
    • Discuss


    Comments

    Avatar
    wheekly
    Our data implied a positive association between age and endoxifen which corresponds with other published model based analyses 25, 41 yet only explained an additional 1

    Avatar
    Atterroma
    Most sources cite genetic causes as accounting for at least 50 of hearing loss


Enter a new Comment