# HFCL C Language Questions January 2012

Posted on :19-02-2016
HFCL Placement Paper - January 2012:-

Q1. What will be output of the following program?

int a=1.1
float b=1.1
if (a==b)
{
printf(both are same)
}
else
{
printf(both are different)
}

Q2. What will be output of the following program?

main()
{
int i;
float *pf;
pf = (float *)&i;
*pf = 100.00;
printf( %d, i);
}

a) Runtime error.
b) 100
c) Some Integer not 100
d) None of the above

ANS: d

Q3. How many times main is get called?

main()
{
printf(Jumboree);
main();
}

ANS: Till stack overflow.

Q4. A batsman scores 23 runs and increases his average from 15 to 16. Find the runs to be made if he wants top inc the average to 18 in the same match.

ANS: 39 runs.

Q5. A rich merchant had collected many gold coins. He did not want anybody to know about them. One day, his wife asked, how many gold coins do we have? After pausing a moment, he replied, Well! If I divide the coins into two unequal numbers, then 37 times the difference between the two numbers equals the difference between the squares of the two numbers. The wife looked puzzled. Can you help the merchants wife by finding out how many gold coins they have?

ANS: 37 coins.

Q6. What will be the output of the following program?

main()
{
char *str;
str=char*malloc(20*sizeof(char));
strcpy(str,test);
strcat(str,,!,);
printf(%s,str);
}

Q7. What will be the output?

main()
{char*a,*f();
a=char*malloc(20*sizeof(char));
a=f();
printf(%s,a);
}
char *f()
{char n[20];
strcpy(n,Hello World);
return(n);
}

Q8. Find the output for the following C program

int i =10
main()
{int i =20,n;
for(n=0;n<=i;)
{int i=10;
i++;
}
printf(%d, i);

ANS: i=20

Q9. Jhaveri invested in Upendra & Upendra, Celco and Winger shares at Rs. 300,Rs.200 and Rs.5 per share respectively. He bought 100 shares for Rs.1000.The number of Upendra & Upendra and Celco shares he bought are respectively:

a) 23,17
b) 17,23
c) 17,60
d) 15,25

ANS: b)17,23

Q10. Which statement is true about main?

a) Variable number of Arguments can be passed main.
b) Main can be called from main();
c) We can not pass arguments are passed in main
d) main always returns an int.

Q11. A cone and a sphere have the same radius and in the cone we put the sphere. Then how much of sphere will be inside the cone?

a) 1/2
b) >1/2
c) <1/2
d) 1/4

ANS: d)1/4

Q12. What is the output of the following program?

#include
#include
void main()
{
int i=1*4/3-27%3^2+100*0.5-(4>3?1:2);
clrscr();
printf(%d,i);
getch();
}

a) 49
b) compile error
c) 51
d) 48

ANS: b

FreshersLive - No.1 Job site in India. Here you can find latest 2018 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.

 ✖