c# questions:
24.The counter variable in a for statement must be declared ___________.
a.first
b.second
c.third
d.fourth
39.A(n) ___________ variable cannot be referenced outside of the block in which it is declared.
a.scope
b.local
c.restricted
d.restricted global
e.global
54.Attempting to access a private member of a class outside that class ______________.
a.is a run-time error
b.is a syntax error
c.is a logic error
d.can be accomplished using IntelliSense
24 . The counter variable in a for statement must be declared _
a.first
for example: for(int i; i<n; i++)
If the variable is used without declaration it's a compile time error.
for( i; i<n; i++) will give error if int i; is not used before it.
39.A(n) ___________ variable cannot be referenced outside of the block in which it is declared.
b.local
A variable local to a block can only be accessed within it. Accessing it outside the block where it is defined will give a compile time error.
//if block
if(...){
int i; //Scope of i starts
...
//Scope of i ends
}
54. Attempting to access a private member of a class outside that class ______________.
b.is a syntax error
A class private member can only be accessed by member functions or the friend functions.
No other object can access it. Else it is a compile time or syntax error.
Get Answers For Free
Most questions answered within 1 hours.