CQUES1

download CQUES1

of 13

description

C questions

Transcript of CQUES1

Status: RO// 1) Consider the following program#include void main(){int y,z;int x=y=z=10;int f=x;float ans=0.0;f=x*y;ans=x/3.0 + y/3;printf("%d,%.2f",f,ans);}/* What will be the output of this program ?a) It will print 1000,6.66;b) It will give a type mismatch error;c) It will generate a compile-time error;d) None of the above; */// 2) Study the following code carefully#include void main(void);double dbl=20.4530,d=4.5710,dblvar3;void main(){double dbfn(void);dblvar3=dbfn();printf("%.2f\t%.2f\t%.2f\n",dbl,d,dblvar3);}double dbfn(void){double d,dblvar3;dbl=d=dblvar3=4.5;return(dbl+d+dblvar3);}/* The output of the above program will bea) 4.50 4.57 29.52;b) 4.50 4.57 13.50;c) 4.57 4.57 29.52;d) 4.57 4.50 13.50; */// 3) Consdier the following program#include int SumElement(int *,int);void main(void){int x[10];int i=10;for(;i;){i--;*(x+i)=i;}printf("%d",SumElement(x,10));}int SumElement(int array[],int size){int i=0;float sum=0;for(;i