Classes and Objects

Q1:
Which of the following statements is correct about the C#.NET code snippet given below?
class Sample
{
    private int i;
    public Single j;
    private void DisplayData()
    {
        Console.WriteLine(i + ' ' + j);
    }
    public void ShowData()
    {
        Console.WriteLine(i + ' ' + j);
    }
}

A ShowData() cannot access to i.

B DisplayData() cannot be declared as private.

C There is no error in this class.

D j cannot be declared as public.

E DisplayData() cannot access j.

ANS:E - There is no error in this class.

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.