C Interview Questions And Answers For Freshers 2011

Advertisements


C Interview Questions And Answers For Freshers

C is one of the programming languages used for portable application software. Even though many object oriented programming languages came into existence, using C for application software continued.

Has a fresher he/she will be asked about C, so here are few collection of top interview questions.

C is a structural or high-level or middle level language which one is correct answer

C is called as structured programming language. Because this language contains both the features of both high level language. So it is middle level language.

What is the output of printf(“%d”)?

There is nothing after %d so compiler will show in output window garbage value.

Difference between “calloc(…)” and “malloc(…)”?

calloc(…) allocates a block of memory for an array of elements of a certain size

malloc(…) allocated bytes of memory and not blocks of memory like calloc(…).

Can I include other file in place of .h with #include?

Yes! The preprocessor will include whatever the file name you mention, eg: #include<macros.inc>, the file macros.inc will be included.

Difference between “printf(…)” and “sprintf(…)”?

sprintf() this method writes data to the character array.

printf() Used to write data to the standard output device.

How to reduce a final size of executable?

It can be reduced using dynamic linking for libraries.

What are the different storage classes in C?

Automatic, static and allocated are three storage classes in C.

Difference between Strings and character arrays?

String will have static storage duration, character array will not. Unless you explicitly specify with static keyword.

How to determine the size of an allocated portion of memory?

Using free() method.

Difference between static memory allocation and dynamic memory allocation?

In case of Static memory compiler allocates the required memory space for a declared variable, whereas in dynamic memory allocation functions malloc( ) or calloc( ) is used to get memory dynamically.

What is the difference between arrays and pointers?

Pointers(*) are used to manipulate data using the address, Arrays are collection of similar data types.

For More Interview Questions and Answers please add me to your circles at Google Plus by clicking g-plus

Advertisements


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>