1) There are following namespaces are given below, which is correct about "using" statement in C#.NET?
- In C#.Net, "using" statement is used to import the namespace in our program
- We can create a new namespace with the help of "using" statement
- We cannot use "using" statement in C#.NET
- We can use "using" statement in VB.NET only
Correct answer: 1
In C#.Net, "using" statement is used to import the namespace in our program
In the given statement, 1st statement is correct.
3) Is it possible that we can use multiple using statements in a program in C#.NET?
- Yes
- No
Correct answer: 1
Yes
Yes, we can use multiple using statements in a program.
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();
}
}
}
- Syntax error
- Hello
- Linker error
- Runtime exception
Correct answer: 2
Hello
The above code will print "Hello" on console screen.
5) How many classes can be created in a namespace?
- 2
- 1
- Any number of classes
- 5
Correct answer: 3
Any number of classes
We can create any number of classes in a namespace.