ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

C# Namespace Aptitude Questions and Answers | Set 3

C# Namespace Aptitude Questions | Set 3: This section contains aptitude questions and answers on C# Namespace.
Submitted by Nidhi, on April 08, 2020

1) There are following namespaces are given below, which is correct about "using" statement in C#.NET?
  1. In C#.Net, "using" statement is used to import the namespace in our program
  2. We can create a new namespace with the help of "using" statement
  3. We cannot use "using" statement in C#.NET
  4. We can use "using" statement in VB.NET only

2) We created a library, in which a namespace that contains classes, then what is the correct way to use classes present in a namespace?
  1. Add reference of the library then use classes present in the namespace.
  2. Add reference of the library and include namespace into the project and then we can use classes present in the namespace.
  3. Include namespace in our project then use classes present in the namespace.
  4. We need to install namespace into GAC and then we can use classes present in the namespace.

3) Is it possible that we can use multiple using statements in a program in C#.NET?
  1. Yes
  2. No

4) What is the correct output of the given code snippet?
using System;

namespace my_namespace
{
    class sample
    { 
        public static void sayHello()
        {
            Console.WriteLine("Hello");
        }
    }

    class program
    {
        static void Main(string[] args)
        {
            sample.sayHello();
        }
    }
}
  1. Syntax error
  2. Hello
  3. Linker error
  4. Runtime exception

5) How many classes can be created in a namespace?
  1. 2
  2. 1
  3. Any number of classes
  4. 5



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.