C Aptitude Questions and answers with explanation.

C Aptitude 5
C program is one of most popular programming language which is used for core level of coding across the board. C program is used for operating systems, embedded systems, system engineering, word processors,hard ware drivers, etc.

In this site, we have discussed various type of C programs till date and from now on, we will move further by looking at the C aptitude questions.

In the coming days, we will post C aptitude questions, answers and explanation for interview preparations.

The C aptitude questions and answers for those questions along with explanation for the interview related queries.

We hope that this questions and answers series on C program will help students and freshers who are looking for a job, and also programmers who are looking to update their aptitude on C program.
Some of the illustrated examples will be from the various companies, and IT industry experts.
Read more about C Programming Language . and read the C Programming Language (2nd Edition). by K and R.

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

C aptitude 5.1

    #define int char
main()
{
int i=65;
printf("sizeof(i)=%d",sizeof(i));
}

Answer: sizeof(i)=1

Explanation: Since the #define replaces the string int by the macro char

C aptitude 5.2

main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}


Answer:i=0

Explanation:In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).

C aptitude 5.3

     #include
main()
{
char s[]={'a','b','c','n','c',''};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}

Answer:77

Explanation: p is pointing to character ‘n’. str1 is pointing to character ‘a’ ++*p. “p is pointing to ‘n’ and that is incremented by one.” the ASCII value of ‘n’ is 10, which is then incremented to 11. The value of ++*p is 11. ++*str1, str1 is pointing to ‘a’ that is incremented by 1 and it becomes ‘b’. ASCII value of ‘b’ is 98. Now performing (11 + 98 – 32), we get 77(“M”); So we get the output 77 :: “M” (Ascii is 77).

Read more Similar C Programs
Learn C Programming
C Aptitude
C Interview questions

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

Leave a Reply