C# Programming - Classes and Objects - Discussion

Discussion :: Classes and Objects - General Questions (Q.No.2)


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]. j cannot be declared as public.
[B]. DisplayData() cannot be declared as private.
[C]. DisplayData() cannot access j.
[D]. ShowData() cannot access to i.
[E]. There is no error in this class.

Answer: Option E


No answer description available for this question.

Prashant said: (Jul 11, 2011)  
If i is declare inside the class then i is no accessible in another class declaration and for j by default is public.

Jerome Prince said: (Feb 24, 2012)  
Even-though I declared as private, within this class I can accessible so no error.

Shital said: (Mar 20, 2012)  
What is is single?

Vipin said: (Jun 13, 2012)  
Single is data type like float, double in c#.

Kuldeep said: (Jun 25, 2012)  
What type of data can be stored in the Single type Variable ?

Vinod Singh said: (Apr 29, 2013)  
In single data type variable we can store value type data.

Ajesh said: (Dec 4, 2013)  
What is the range of single data type?

Shouvith said: (Jan 9, 2014)  
Can you give any example single type data?

Uday said: (Sep 18, 2014)  
Single is value data type, here we are not declaring static void main, so there is an error.

Okechukwu said: (Oct 21, 2014)  
@Uday, we mustn't declare static void main in the class shown in the program.

Static void main can be declared in another class embedded within the same program.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.