0% found this document useful (0 votes)
28 views4 pages

HFCL PP

The document contains 12 multiple choice questions related to C programming concepts like data types, operators, functions, arrays and pointers. The questions test understanding of basic syntax, evaluation order, scope, memory allocation and other fundamental programming concepts.

Uploaded by

Akash Deria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views4 pages

HFCL PP

The document contains 12 multiple choice questions related to C programming concepts like data types, operators, functions, arrays and pointers. The questions test understanding of basic syntax, evaluation order, scope, memory allocation and other fundamental programming concepts.

Uploaded by

Akash Deria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

HFCL Placement Paper Questions

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

You might also like