Final Exam PRF 192 - SP19, Top Exm Questions and answers, 100% Accurate.
Final Exam PRF 192 - SP19, Top Exm Questions and answers, 100% Accurate. Once the function ends, the control is returned back to the ... function and execution continues from the statement immediately after the function call a. executing b. called c. declared d. calling - -A what number is equivalent to -4e3? a.-4000 b.-400 c..004 d..0004 e.-40 - -A what is the output when the sample code below executed? #includestdio.h int fn(int v){ if(v==1||v==0) return 1; if(v%2==0) return (fn(v/2)+2); else return(fn(v-1)+3); } int main() { printf("%dn",fn(5)); return (0); } a.6 b.9 c.8 d.7 e.5 - -C which 2 options are correct about the function scanf? a.EOF indicates that scanf filled all addresses successfully b. scanf returns the number of addresses successfully filled of EOF n avoid type d.EOF indicates that scanf did not fill any address AND encountered an end of data character. D what is the output when the sample code below is executed? int s=35; printf("%d%d%d",s==35,s+20,s40) a.1 35 1 b.1 55 1 c.0 55 0 d.1 55 0 - -B D according to the standard C specification, what are the respective minimum sizes (in bytes) of the following two data type: int and long? a.2,8 b.4,8 c.2,4 d.2,2 - -C what does the following declaration mean (if there are more than one correct answers, choose the best one) int *ptr[10]; of 10 integer pointers ed to the array of 10 elements of 10 pointers - -B what would happen if the user types in the number 3 and presses Enter when running this program? main(){ int x=5; char c; printf("Enter x="); scanf("%d",&x); printf("Calculate square(Y/N):"); c=getchar(); if(c==Y||c==y) printf("sqr=%d",x*x); } =9 b.Its depend on whether the user enters 'Y' or not, being asked "calculate square?" =25 program exits without printing the square - -D what is the output when the sample code below is executed? int i,j,k,x=0; for(i=1;i5;i++) for(j=0;ji;++j){ switch(i+j){ case 0:x=x+1; break; case 1: case 2: case 3: x=x+2; break; }} printf("%d",x); a.12 b.13 c.10 d.8 e.6 - -D the while loop can be written as a for loop a.TRUE b.FALSE - -A what is the output when the sample code below is executed? char fun[]="How are you?"; char **p; p=fun; while(***p!='0'){ if(strlen(p)!=7) printf("%c",**p); p++;} a. How ar you b.Ho are you c.How re you d.How are you e. How ae you - -E given the below code ? char st[50]; scanf("%5[^]",st); printf("%s",st); a user enters "pfc is simple" what is printed? is is so simple output i - -E how is a variable accessed from another file? a. the global variable is referenced via the auto specifier b. the global variable is referenced via the extern specifier c. the global variable is referenced via the pointer specifier d. the global variable is referenced via the ext specifier e. the global variable is referenced via the global specifier - -B which one of the following is a variable, which can contain the address of the memory location of another variable?(choose the best answer) g t er - -B declare a two dimensional integer array of two rows and four columns having some initial values arr1[4][2]={{8,12},{22,45},{23,40},{44,79}} arr1[2][4]={{8,12},{22,45},{23,40},{44,79}} arr1[4][2]={{8,12};{22,45};{23,40};{44,79}} arr1[][2]={{8,12},{22,45},{23,40},{44,79}} - -A what value will x contain in the sample code below? int x=011|0x10; a.27 b.19 c.25 d.13 e.3 - -C what is the output when the sample code below is executed? int g=1; printf("%d %d %d",g,++g,g++); a.1 3 3 b.1 2 3 c.1 1 1 d.3 3 1 - -D what is the output when the sample code below is executed? int i=0; for(;i;) printf("This is a loop"); if(i0) printf("in C program"); a. nothing
Document information
- Uploaded on
- August 12, 2023
- Number of pages
- 33
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers