Showing posts with label EXTERN. Show all posts
Showing posts with label EXTERN. Show all posts

Thursday, 1 March 2012

Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 12

Predict the output or error(s) for the following:


1)

int i=10;

main()

{

extern int i;


{


int i=20;


{


const volatile unsigned i=30;


printf("%d",i);


}


printf("%d",i);


}


printf("%d",i);


}

Answer:

30,20,10


Explanation:

Thursday, 19 January 2012

Frequently Asked Questions in Technical Round at MNCs like TCS, WIPRO, INFOSYS,..etc – 4

Predict the output or error(s) for the following:


1)

main( )

{

int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};


printf(“%u %u %u %d \n”,a,*a,**a,***a);


printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);


}

Answer:

100, 100, 100, 2


114, 104, 102, 3


Explanation:

Tuesday, 22 November 2011

How can we make Windows API calls in .NET?

Windows API calls are not COM based and they are invoked through Platform Invoke Services.

Declare StringConversionType (Function | Sub) MethodName Lib "DllName" ([Args]) As Type

  • StringConversionType is for what type of conversion should take place. Either we can specify Unicode to convert all strings to Unicode values, or Auto to convert strings according to the .NET runtime rules.

  • MethodName is the name of the API to call.

  • DllName is the name of the DLL.

  • Args are any arguments to the API call.

  • Type is the return type of the API call.


Below is a sample code for VB.NET which uses Sleep windows API