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
Storage location used by computer memory to store data for usage by an application is ?
Pointers
Constant
Variables
None of the mentioned
‘Variables’ are essential locations in memory of computer that are reserved for storing data used by an application. Each variable is given a name by programmer and hence assigned a value .The name assigned to variable then used in C# code to access value assigned to variable.
Are the given codes :
1. Myclass class;
Myclass class2 = null;
2. int i;
int j = 0;
True for (1);False for (2)
True for (2);False for (1)
Both (1) and (2) are equivalents
Both (1) and (2) are not equivalents
When we create a type in ‘C#’, It automatically gets filled with padded zeroes. For the case of class (reference types) this equates to a null pointer. Hence, for code 1) Both variable values are equivalent to each other.Similarly, for code 2) i.e for value type (including int/float/double etc.), the type is passed with zeroes.Hence, they are equivalent.
What will be output of the following code?
staticvoid Main(string[] args)
{
char a ='A';
string b ="a";
Console.WriteLine(Convert.ToInt32(a));
Console.WriteLine(Convert.ToInt32(Convert.Tochar(b)));
Console.ReadLine()
}
1, 97
55, 97
65, 97
97, 1
ASCII value of character ‘a’ is 65 and ASCII value of string “a” is 97. Output: 65,97
Select output for the following set of code:
constint a =5;
const int b = 6;
for(int i =1; i <=5; i++)
a = a * i;
b = b * i;
Console.WriteLine(a);
Console.WriteLine(b);
Console.ReadLine();
600, 720
Compile time error
25, 30
5, 6
The left hand side of an assignment must be a variable,property or indexer i.e for both ‘a’ and ‘b’
string Name ="He is playing in a ground.";
char[] characters = Name.ToCharArray();
StringBuilder sb =new StringBuilder();
for(int i = Name.Length-1; i >=0;--i)
sb.Append(characters[i]);
Console.Write(sb.ToString());
He is playing in a grou
.ground a in playing is He
.dnuorg a ni gniyalp si eH
He playing a
Reversal of array of strings character by character. Output: .dnuorg a ni gniyalp si eH
Difference between keywords 'var' and 'dynamic' is:
‘Var’ is introduced in C# (3.0) and ‘Dynamic’ is introduced in C# (4.0)
‘Var’ is a type of variable where declaration is done at compile time by compiler while ‘Dynamic’ declaration is achieved at runtime by compiler
For ‘Var’ Error is caught at compile time and for ‘Dynamic’ Error is caught at runtime
For ‘Var’ datatype the code as : var obj1 = 1; and var obj1=”I am a string” will also compile safely.For ‘Dynamic’ datatype the code as: dynamic obj1 =1; and dynamic obj1 = “I am a string” will create an error
Answer: Option (A), (B) and (C)
Select output of the given set of Code :
String name ="Dr.Gupta";
Console.WriteLine("Good Morning"+ name);
Dr.Gupta
Good Morning
Good Morning Dr.Gupta
Good Morning name
How to intialize a string variable and concatenate string using ‘+’ operator. Output:Good Morning Dr.Gupta
Select output for the following set of code.
int a =5;
int b =10;
int c;
Console.WriteLine(c = a---++b);
-7, 10
-5, 11
-6, 11
15, 11
Answer: Option (C)
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