Office Document APIs for .NET
ITIL Career Advice
PMP Career Advice
Android Intel XDK
Welcome Guest !
What will be the output of the below C# code?
protected void btn_click(object sender,eventargs e)
int cnt = 50;
if (cnt == 50)
int cnt = 10;
on 12/2/2014 | Category:
C# Interview questions
| Views: 2556 |
Select from following answers:
50 10 50
50 10 10
10 10 10
It will not compile actually,and say that Same variable cannot be declared more than once in C#.It will say that "A local variable named 'cnt' cannot be declared in this scope because it would give a different meaning to 'cnt', which is already used in a 'parent or current' scope to denote something else".
So to overcome this,we must declare different variables and store values.
Show Correct Answer
Many Interviews |
< Previous :
Which statement is True about Triggers in Sql Serv ...
Next > :
Which Process'method is used to Stop any proce ...
Comments or Responses
Login to post response
More Interview Questions by vishalneeraj-24503
Which Process'method is used to Stop any processs which are being ...
What are the ways to Exit a method without Exiting a program.
Which way is used to check whether Textbox or any string value is empt ...
Which property is used to set any color of a control?
How to add a first date in given Month?
How to check if the Date is the first of every month?
What are the rules needs to be considered while Merging one datatable ...
Which method is used to Merge one Datatable to another Datatable?
Latest Interview Questions
How to implement multiple inhertiance in C#
How to attach mouse up event to an element?
How to attach mouse move event to an element ?
How to attach mouse leave event to an element?
How to attach mouse enter event to an element in jquery ?
How to attach mouse down event to an element in jquery ?
How to attach load event to an element in jquery ?
In jquery how to attach key up event to an element?