C Sharp Technical Questions

download C Sharp Technical Questions

of 5

Transcript of C Sharp Technical Questions

  • 7/29/2019 C Sharp Technical Questions

    1/5

    C Sharp Technical Questions

    1. A variable which is declared inside a method is called a________variable

    SerialLocal

    PrivateStatic

    2. Feature of a local variable

    It can be used anywhere in the program

    It must accept a class

    It must be declared within a method

    It represent a class object

    3. Two methods with the same name but with different parameters.

    Overloading

    Loading

    Multiplexing

    Duplexing

    4.Which of the following statements are TRUE about the .NET CLR?

    1. It provides a language-neutral development & execution environment.

    2. It ensures that an application would not be able to access memory that it is not

    authorized to access.3. It provides services to run "managed" applications.

    4. The resources are garbage collected.

    5. It provides services to run "unmanaged" applications.

    5.Which of the following statements is correct about the C#.NET code snippet given

    below? namespace IndiabixConsoleApplication{

    class Sample{

    public int func()

    {

    return 1;}

  • 7/29/2019 C Sharp Technical Questions

    2/5

    public Single func()

    {

    return 2.4f ;}

    }

    class Program{

    static void Main(string[ ] args)

    {Sample s1 = new Sample();

    int i;

    i = s1.func();

    Single j;j = s1.func();

    }

    }

    }6.Which of the following ways to create an object of the Sample class given below will

    work correctly? class Sample{

    int i;

    Single j;double k;

    public Sample (int ii, Single jj, double kk)

    {

    i = ii;j = jj;

    k = kk;

    }}

    7.Which of the following statements are correct about the C#.NET code snippet given

    below?class Sample

    {

    static int i;

    int j;public void proc1()

    {

    i = 11;j = 22;

    }

    public static void proc2(){

    i = 1;

    j = 2;

    }

  • 7/29/2019 C Sharp Technical Questions

    3/5

    static Sample()

    {

    i = 0;j = 0;

    }

    }

    8.If a class called Pointis present in namespace n1 as well as in namespace n2, thenwhich of the following is the correct way to use the Pointclass?

    1. namespace IndiabixConsoleApplication

    {class MyProgram

    {

    static void Main(string[] args)

    {

    import n1;Point x = new Point();

    x.fun();import n2;

    Point y = new Point();

    y.fun();}

    }

    }

    2. import n1;import n2;

    namespace IndiabixConsoleApplication{class MyProgram

    {

    static void Main(string[] args){

    n1.Point x = new n1.Point();

    x.fun();n2.Point y = new n2.Point();

    y.fun();

    }

    }}

    3. namespace IndiabixConsoleApplication

    {class MyProgram

    {

    static void Main(string[] args){

  • 7/29/2019 C Sharp Technical Questions

    4/5

    using n1;

    Point x = new Point();

    x.fun();using n2;

    Point y = new Point();

    y.fun();}

    }

    }4. using n1;

    using n2;

    namespace IndiabixConsoleApplication

    {class MyProgram

    {

    static void Main(string[] args)

    { n1.Point x = new n1.Point();

    x.fun();n2.Point y = new n2.Point();

    y.fun();

    }}

    }

    9.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;

    }10.Which of the following is the correct output for the C#.NET program given below?

    int i = 20 ;

    for( ; ; ){

    Console.Write(i + " ");

    if (i >= -10)i -= 4;

    else

    break;}

  • 7/29/2019 C Sharp Technical Questions

    5/5

    11.Which of the following is the correct way to rewrite the following C#.NET code

    snippet given below?

    int i = 0;do

    { Console.WriteLine(i);

    i+ = 1;} while (i