AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
C# Programming
Which of the following is used to define the member of a class externally?
:
::
#
none of the mentioned
Answer: Option (B)
What is the most specified using class declaration ?
type
scope
type & scope
None of mentioned
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?
Everything you use in C# is an object, including Windows Forms and controls
Objects have methods and events that allow them to perform actions
All objects created from a class will occupy equal number of bytes in memory
None of the mentioned
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.”
Abstraction
Polymorphism
Inheritance
Encapsulation
Answer: Option (D)
The data members of a class by default are ?
protected,public
private,public
private
public
Answer: Option (C)
Correct way of declaration of object of the following class is ? class name
name n = new name();
n = name();
name n = name();
n = new name();
Answer: Option (A)
What does the following code imply ? csharp abc; abc = new charp();
Object creation on class csharp
Create an object of type csharp on heap or on stack depending on the size of object
create a reference c on csharp and an object of type csharp on heap
create an object of type csharp on stack
Select output for the following set of code:
class sample
{
publicint i;
publicint[] arr =newint[10];
publicvoid fun(int i, int val)
arr[i]= val;
}
class Program
staticvoid Main(string[] args)
sample s =new sample();
s.i=10;
sample.fun(1, 5);
s.fun(1, 5);
Console.ReadLine();
sample.fun(1, 5) will not work correctly
s.i = 10 cannot work as i is ‘public’
sample.fun(1, 5) will set value as 5 in arr[1] d) s.fun(1, 5) will work correctly
An Object reference is required for non static field,method or property. i.e sample s = new sample(); s.i = 10; sample.fun(1, 5); sample.fun(1, 5); Console.ReadLine();
The output of code is ?
class test
publicvoid print()
Console.WriteLine("Csharp:");
test t;
t.print();
Code runs successfully prints nothing
Code runs and prints “Csharp”
Syntax error as t is unassigned variable which is never used
None of above mentioned
object of class test should be declared as test t = new test(); test t = new test(); t.print(); Console.ReadLine();
The operator used to access member function of a class?
.
objectname.function name(actual arguments);
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies