AmbitionBox

Discover Best Places to work in India

C# Programming

C# Programming Questions and Answers

Showing 81 - 90 of 174 questions

81

Which of the following is used to define the member of a class externally?

a

:

b

::

c

#

d

none of the mentioned

correct answer b

Answer: Option (B)

82

What is the most specified using class declaration ?

a

type

b

scope

c

type & scope

d

None of mentioned

correct answer c

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
}
}

83

Which of 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 methods and events that allow them to perform actions

c

All objects created from a class will occupy equal number of bytes in memory

d

None of the mentioned

correct answer a,b,c

Answer Options (A), (B) and (C)

By definition.

84

“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.”

a

Abstraction

b

Polymorphism

c

Inheritance

d

Encapsulation

correct answer d

Answer: Option (D)

85

The data members of a class by default are ?

a

protected,public

b

private,public

c

private

d

public

correct answer c

Answer: Option (C)

86

Correct way of declaration of object of the following class is ?
class name

a

name n = new name();

b

n = name();

c

name n = name();

d

n = new name();

correct answer a

Answer: Option (A)

87

What does the following code imply ?
csharp abc;
abc = new charp();

a

Object creation on class csharp

b

Create an object of type csharp on heap or on stack depending on the size of object

c

create a reference c on csharp and an object of type csharp on heap

d

create an object of type csharp on stack

correct answer c

Answer: Option (C)

88

Which of the following string() method are used to compare two strings with each other?

a

CopyTo()

b

Copy()

c

Compare()

d

CompareTo()

correct answer b

Creates a new string by copying one string to another.

89

Which of the following statement is correct about a string in C#.NET?

a

The System.Array class is used to represent a string

b

A string has a zero-based index

c

A number cannot be represented in the form of a string

d

A string is mutable because it can be modified once it has been created

correct answer b

Answer: Option (B)

90

Choose Output for the following set of code :

staticvoid Main(string[] args)

{

     string s1 ="Hello"+" I "+"Love"+" ComputerScience ";

     Console.WriteLine(s1);

     Console.ReadLine();

}

 

a

HelloILoveComputerScience

b

Hello I Love ComputerScience

c

Compile time error

d

Hello

correct answer b

Here ‘+’ defined operator works as concatenation for strings.
Output : Hello I Love ComputerScience.

Select a company to compare with

vs

Similar Companies