C ++
C# Interview Questions and Answers
1. Is it possible to inline assembly or IL in C# code?
- No.
2. Is it possible to have different access modifiers on the get/set methods of a property?
- No. The access modifier on a property applies to both its get and set accessors. What you need to do if you want them to be different is make the property read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.
3. Is it possible to have a static indexer in C#? allowed in C#.
- No. Static indexers are not
4. If I return out of a try/finally in C#, does the code in the finally-clause run?
-Yes. The code in the finally always runs. If you return out of the try block, or even if you do a goto out of the try, the finally block always runs:
using System;
C++ Interview Questions and Answers
1. Write a short code using C++ to print out all odd number from 1 to 100 using a for loop?
for( unsigned int i = 1; i < = 100; i++ )
if( i & 0x00000001 )
cout << i << \",\";
2. ISO layers and what layer is the IP operated from?
cation, Presentation, Session, Transport, Network, Data link and Physical. The IP is operated in the Network layer.
3. Write a program that ask for user input from 5 to 9 then calculate the average?
A.int main()
{
int MAX=4;
int total =0;
int average=0;
int numb;
cout << "Please enter your input from 5 to 9";
cin << numb;
if((numb < 5)&&(numb < 9))
cout << "please re type your input";
else
for(i=0;i < =MAX; i++)
{
total = total + numb;
average= total /MAX;
}
cout << "The average number is" << average << endl;

Recent comments