ExamVeda
Login
Home
51
Correct way to define object of sample class in which C# code will work correctly is:
class abc
{
    int i;
    float k;
    public abc(int ii, float kk)
    {  
        i = ii;
        k = kk;
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
52
What will be the output of the following C# code?
class maths
{
    public int fun(int k, int y)
    {
        return k + y;
    }
    public int fun1(int t, float z)
    {
        return (t+(int)z);
    }
}    
class Program
{
    static void Main(string[] args)
    {
        maths obj = new maths();
        int i;
        int b = 90;
        int c = 100;
        int d = 12;
        float l = 14.78f;
        i = obj.fun(b, c);
        Console.WriteLine(i);
        int j = (obj.fun1(d,  l));
        Console.WriteLine(j);
        Console.ReadLine();
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
53
Select the correct statement from the following?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
54
The method called by clients of a class to explicitly release any resources like network, connection, open files etc. When the object is no longer required?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
55
What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = 5;
    int j  = 6;
    add(ref i);
    add(6);
    Console.WriteLine(i);
    Console.ReadLine();
}
static void add(ref int x)
{
    x = x * x;
}
static void add(int x)
{
    Console.WriteLine(x * x * x);
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
56
What will be the output of the following C# code?
class sample
{
    public int i;
    public int j;
    public void fun(int i, int j)
    {
        this.i = i;
        this.j = j;
    }
}
class Program
{
    static void Main(string[] args)
    {
        sample s = new sample();
        s.i = 1;
        s.j = 2;
        s.fun(s.i, s.j);
        Console.WriteLine(s.i + " " + s.j);
        Console.ReadLine();
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
57
What will be size of the object created depicted by C# code snippet?
class baseclass
{
    private int a;
    protected int b;
    public int c;
}
class derived : baseclass
{
    private int x;
    protected int y;
    public int z;
}
class Program
{
    static Void Main(string[] args)
    {
        derived a = new derived();
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
58
Correct way to define operator method or to perform operator overloading is?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
59
When a function fun() is to receive an int, a single & a double and it is to return a decimal, then the correct way of defining this C# function is?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
60
Which of the following statements is correct about constructors in C#.NET?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board