.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Interview Question >> Aptitude >> Post New Question Subscribe to Interview Questions

What will be the output of this c program.

Posted By :Nikhil Kumar     Posted Date :August 26, 2010    Points :10   Category :Aptitude 
int a = 10, b = 20/3;
if(a == b );
printf("\n %d%d",a,b);


10,6 [just try]

You can also find related Interview Question to What will be the output of this c program.  below: 

What will be the output of this c program. ?
int x;
x = 200 * 200/200;

Answer = -127 { shocked }

Because 200 * 200 = 40000
and this can't be opted in int so goes on different side and later divided by 200

-25536/200 = -127.

What will be the output of this c program. ?

main ()

int i = 65;
char j ='A';
printf("\n %d %d",i,j);
printf("\n %c %c",i,j);
printf("God is Great");
printf("It's difficult fo judge");


65 65

God is Great

The output tells two things i.e. printf is capable of converting int into char and vice versa, and secondly if we compare int variable with char variable then ASCII value of that char variable is compared.

Cheers ! (More...)

Can I use COM objects from a .NET Framework program?


Any COM component you have deployed today can be used from managed code, and in common cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM component into .NET Framework-compatible interfaces. For OLE automation interfaces, the RCW can be generated automatically from a type library. For non-OLE automation interfaces, a developer may write a custom RCW and manually map the types exposed by the COM interface to .NET Framework-compatible types.

Shashi Ray (More...)

Can .NET Framework components be used from a COM program?


Managed types you build today can be made accessible from COM, and in the common case the configuration is totally automatic. There are certain new features of the managed development environment that are not accessible from COM. For example, static methods and parameterized constructors cannot be used from COM. In general, it is a good idea to decide in advance who the intended user of a given type will be. If the type is to be used from COM, you may be restricted to using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by default.
Specifically, .NET Framework components are accessed from COM by using a COM callable wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite direction. Again, if the .NET Framework development tools cannot automatically generate the wrapper, or if the automatic behavior is not what you want, a custom CCW can be developed.

Shashi Ray (More...)

What is the output of this?

What is the output of this

Class A {
static byte a;
static short b;
static char c;
static int d;
static long e;
static string s;
Public Static Void Main(String args[])
{ Console.WriteLine(a+b+c+d+e+s);


The Numeric Sum of a,b,c,d,e is Zero.The Zero is converted to a string and concatenated with s.here s is Null (More...)

Can I call a Win32 API function from a C# program?

Yes, you can.The .NET Framework provides a set of services called Platform Invoke, also known as PInvoke. Refer to the .NET Framework documentation for examples of using PInvoke services. (More...)

How to use Win32 API from a .NET Framework program?

Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.

Here is an example of C# calling the Win32 MessageBox function:

using System;
using System.Runtime.InteropServices;

class MainApp
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);

public static void Main()
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
} (More...)

Write and justify output of - select nullif('test','test')

The output will be - NULL
Justification : nullif returns NULl if given two arguments are same else returns the first specified argument. So, for the given SQL, output will be NULL. (More...)

What's the difference between Response.Write() andResponse.Output.Write()?

Response.Output.Write() allows you to write formatted output but Response.Write doesnt allow.

Example:Response.Output.Write("{0:d}", "Current Date Time: ", DateTime.Now) (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend