sfex9750 - page 1 of Signature:_ DO NOT OPEN THIS BOOKLET...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
page 1 of Signature:____________________ DO NOT OPEN THIS BOOKLET UNTIL YOU ARE INSTRUCTED TO DO SO ELEE 3331 FINAL EXAM Fall 1997 I.Indicate the output that would be produced by each of the following. Consider each case separately. A.(10pts) #include <stdio.h> #include <string.h> main( ) {char s[ ]="Algernon",t[20]="Timbuktu"; printf("%c\n",s[2]); ANSWERS printf("%s\n",&s[2]); g printf("%d\n",strncmp(s,"Algeria",5)); gernon printf("%s\n",strcpy(t,strstr(s,"no"))); 0 printf("%d\n",strlen(t)); non } 3 output: B.(3pts) #include <stdio.h> ANSWERS main( ) 4.3 ,+1.23 {float x = 4.26,y=1.2345,z=0.00000421; 4.21e-006 printf("%-6.1f,%+.2f\n%.2e",x,y,z);} output: C.(8pts) #include <stdio.h> main( ) {int i = 3,j=11,k=4; float a = 2.4,b=5,x,y; x = j/i; y = a++*b; k += 25%j*3+4; ANSWERS printf("%f %f %f %d",x,y,a,k);} 3.000000 12.000000 3.400000 17 output: D.(10pts) #include <stdio.h> #include <stdlib.h> int fun1(int ,int *); void fun2(int *,int ); main ( ) {int a=4,b=2,c=5; fun2(&a,b); printf("%d %d\n",a,b); c = fun1(a,&b); ANSWERS printf("%d %d %d",a,b,c);} 18 2 18 16 6 int fun1(int x,int *y) {int c = 3; if(x<=0) return(*y+c++); else { *y = abs(x-*y); c= fun1(x-5,&c);} return(c);} void fun2(int *x,int y) {int a,b;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
page 2 of a = *x+5; b = y-a; *x = a-b+y;} II. Write the C statements necessary to do each of the following. Do not write complete programs. Unless otherwise indicated, assume variables have been appropriately declared and values assigned.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

sfex9750 - page 1 of Signature:_ DO NOT OPEN THIS BOOKLET...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online