What will be the output of the following C# code? class z { ...
View Question
Correct way of declaration of object of the following class is?
class name
Correct way of declaration of object of the following class is? class name a) name n ...
View QuestionThe data members of a class by default are?
a) protected, public b) private, public c) private d) public Answer: c Explanation: private
View Question“A mechanism that binds together code and data in manipulates, and keeps both safe from outside interference and misuse. In short it isolates a particular code and data from all other codes and data. A well-defined interface controls access to that particular code and data.”
a) Abstraction b) Polymorphism c) Inheritance d) Encapsulation Answer: d Explanation: Encapsulation
View QuestionWhich of the following statements about objects in “C#” is correct?
a) Everything you use in C# is an object, including Windows Forms and controls b) Objects have ...
View Question
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();
}
}
What will be the output of the following C# code? class sample { ...
View QuestionWhat is the most specified using class declaration?
a) type b) scope c) type & scope d) none of the mentioned Answer: c Explanation: General ...
View QuestionThe operator used to access member function of a class?
a) : b) :: c) . d) # Answer: c Explanation: objectname.function name(actual arguments);
View QuestionWhich of the following is used to define the member of a class externally?
a) : b) :: c) # d) none of the mentioned Answer: b Explanation: By definition.
View Question
What will be the output of the following C# code?
class sample
{
public int i;
public int[] arr = new int[10];
public void fun(int i, int val)
{
arr[i] = val;
}
}
class Program
{
static void Main(string[] args)
{
sample s = new sample();
s.i = 10;
sample.fun(1, 5);
s.fun(1, 5);
Console.ReadLine();
}
}
What will be the output of the following C# code? class sample { ...
View Question