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.
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.
Predict the output or error(s) for the following:
C aptitude 27.1
i = abc();
_AX = 1000;
Explanation: Normally the return value from the function is through the information from the accumulator. Here _AX is the pseudo global variable denoting the accumulator. Hence, the value of the accumulator is set 1000 so the function returns value 1000.
C aptitude 27.2
// If the inputs are 0,1,2,3 find the o/p
for ( t=4;scanf("%d",&i)-t;printf("%dn",i))
Answer: 4–0 3–1 2–2
Explanation:Let us assume some x= scanf(“%d”,&i)-t the values during execution will be, t i x 4 0 -4 3 1 -2 2 2 0
C aptitude 27.3
return( a= (a==b) );
printf("The value of process is %d !n ",process(func,3,6));
int (*pf) ();
Answer:The value if process is 0 !
Explanation: The function ‘process’ has 3 parameters – 1, a pointer to another function2 and 3, integers. When this function is invoked from main, the following substitutions for formal parameters take place: func for pf, 3 for val1 and 6 for val2. This function returns the result of the operation performed by the function ‘func’. The function func has two integer parameters. The formal parameters are substituted as 3 for a and 6 for b. since 3 is not equal to 6, a==b returns 0. therefore the function returns 0 which in turn is returned by the function ‘process’.
Read more Similar C Programs
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