C# Programming Questions and Answers
Which of the following is used to define the member of a class externally?
Answer: Option (B)
What is the most specified using class declaration ?
General form of class declaration in C# is :
class class_name
{
member variables
variable1;
variable2;
variableN;
method1(parameter_list)
{
method body
}
method2(parameter_list)
{
method body
}
methodN(parameter_list)
{
method body
}
}
Which of following statements about objects in “C#” is correct?
Answer Options (A), (B) and (C)
By definition.
“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 the access to that particular code and data.”
Answer: Option (D)
The data members of a class by default are ?
Answer: Option (C)
Correct way of declaration of object of the following class is ?
class name
Answer: Option (A)
What does the following code imply ?
csharp abc;
abc = new charp();
Answer: Option (C)
Which of the following string() method are used to compare two strings with each other?
Creates a new string by copying one string to another.
Which of the following statement is correct about a string in C#.NET?
Answer: Option (B)
Choose Output for the following set of code :
staticvoid Main(string[] args)
{
string s1 ="Hello"+" I "+"Love"+" ComputerScience ";
Console.WriteLine(s1);
Console.ReadLine();
}
Here ‘+’ defined operator works as concatenation for strings.
Output : Hello I Love ComputerScience.