Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

Technical Interview Questions and Answers :: C

  • 1. What is the difference between ++var and var++?
  • Answer:

    The ++ operator is called the increment operator. When the operator is placed before the variable (++var), the variable is incremented by 1 before it is used in the expression. When the operator is placed after the variable (var++), the expression is evaluated, and then the variable is incremented by 1.

    The same holds true for the decrement operator (--). When the operator is placed before the variable, you are said to have a prefix operation. When the operator is placed after the variable, you are said to have a postfix operation.

    For instance, consider the following example of postfix incrementation:

    int x, y;
    x = 1;
    y = (x++ * 5);

    In this example, postfix incrementation is used, and x is not incremented until after the evaluation of the expression is done. Therefore, y evaluates to 1 times 5, or 5. After the evaluation, x is incremented to 2.

    Now look at an example using prefix incrementation:

    int x, y;
    x = 1;
    y = (++x * 5);

    This example is the same as the first one, except that this example uses prefix incrementation rather than postfix. Therefore, x is incremented before the expression is evaluated, making it 2. Hence, y evaluates to 2 times 5, or 10.

    Please Login First :
    Tags:

    Accenture 

  • 2. How can you rate yourself in C on a scale of 10?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 3. What is a local block?
  • Answer:

    A local block is any portion of a C program that is enclosed by the left brace ({) and the right brace (}). A C function contains left and right braces, and therefore anything between the two braces is contained in a local block. An if statement or a switch statement can also contain braces, so the portion of code between these two braces would be considered a local block.

    Additionally, you might want to create your own local block without the aid of a C function or keyword construct. This is perfectly legal. Variables can be declared within local blocks, but they must be declared only at the beginning of a local block. Variables declared in this manner are visible only within the local block. Duplicate variable names declared within a local block take precedence over variables with the same name declared outside the local block. Here is an example of a program that uses local blocks:


    #include
    void main(void);
    void main()
    {
    /* Begin local block for function main() */
    int test_var = 10;
    printf("Test variable before the if statement: %d\n", test_var);
    if (test_var > 5)
    {
    /* Begin local block for "if" statement */
    int test_var = 5;
    printf("Test variable within the if statement: %d\n",
    test_var);
    {
    /* Begin independent local block (not tied to
    any function or keyword) */
    int test_var = 0;
    printf(
    "Test variable within the independent local block:%d\n",
    test_var);
    }
    /* End independent local block */
    }
    /* End local block for "if" statement */
    printf("Test variable after the if statement: %d\n", test_var);
    }
    /* End local block for function main() */

    This example program produces the following output:

    Test variable before the if statement: 10

    Test variable within the if statement: 5

    Test variable within the independent local block: 0

    Test variable after the if statement: 10

    Notice that as each test_var was defined, it took precedence over the previously defined test_var. Also notice that when the if statement local block had ended, the program had reentered the scope of the original test_var, and its value was 10.

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 4. Should variables be stored in local blocks?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 5. When is a switch statement better than multiple if statements?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 6. Is a default case necessary in a switch statement?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 7. Can the last case of a switch statement skip including the break?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    Wipro 

  • 8. How can you tell whether a loop ended prematurely?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 9. What does the modulus operator do?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

  • 10. What is meant by "bit masking"?
  • Answer:

    No Discussion on this question yet!

    Please Login First :
    Tags:

    No Tags on this question yet!

Frequently asked C Interview Questions for Freshers C Logical Questions at Freshers and experience level. All Question are based on the real time experience of previous candidates. You can search and filter the question set by company name from the tag cloud.

Q4I Collection of C Programming Interview Questions and Answers with Explanations asked in campus/off-campus interviews, walk-in interview and various IT companies Interview at Freshers & Experienced level. Multiply your selection chance by practicing the C Interview Question from basic to Standard, or by going through Company specific pattern of question asked from C Programming.

So, next time, when you prepare for a company's interview, please check your knowledge against these C language technical interview questions and answers.