C Functions Questions and Answers

Practice Mode
Showing 10 of 151 questions
Q141
Find the output void call (int); void main () { call (3); } void call (int a) { if (a<6) call (++a); printf("%d",a); }
  • A 4 5 6
  • B 6 5 4 3
  • C 6 6 5 4
  • D 5 5 4
Answer: Option C
Q142
Find the output void func( ) } printf("Function"); } void main ( ) { void main ( ) { func; func ( ); }
  • A Function
  • B Function
  • C Compilation error
  • D None of these
Answer: Option A
Q143
Which functions are used to mapping program from user area to kernel area.
  • A Standard Library function
  • B User defined function
  • C System call cunction
  • D None of the above
Answer: Option C
Q144
Find the output int i; int increment (int i) { i++ -2; return; } int main ( ) { for (i=2; increment (i);) { if (i>0) break; } printf("%d\n",i); return 0; }
  • A 1
  • B 2
  • C iniinite loop
  • D Compilation error
Answer: Option B
Q145
Find the output void fun(int [ ] [3]); void main( ) { int a[3] [3]={1 , 2, 3} {4, 5, 6), {7, 8, 9}}; fun (a); printf("%d", a[2] [1]); } void fun( int b [ ] [3]) { ++b; b[1+0] [1%2]= -9; }
  • A -8
  • B -9
  • C 9
  • D Compilation error
Answer: Option B
Q146
Find the output void main ( ) { static int val=7; int data; if (--val) { data=main( )+val; printf(%d ", data); } return 0; }
  • A 1 2 3 4 5 6
  • B 0 0 0 0 0 0
  • C INFINITE LOOP
  • D Compilation error
Answer: Option D
Q147
Which of the following three functions are likely to cause problem with pointers int *f1(void) { int x=10; return (&x); } int *f2(void) { int *ptr; *ptr=10; return ptr; } int *f3(void) { int *ptr; ptr=(int*) malloc(sizeof (int)); return ptr; }
  • A only f3
  • B only f1 and f3
  • C only f1 and f2
  • D f1, f2, f3
Answer: Option C
Q148
Find the output void main ( ) { int a,b; a=sd (123); b=sd (123); printf("%d %d",a,b); } sd (int n) { static int s=0; int d; if (n!0); { d=n%10; n=(n-d)/10; s=s+d; sd(n); } else return (s); }
  • A 12 6
  • B 6 12
  • C 3 15
  • D Compilation error
Answer: Option A
Q149
Which register holds the base address of the function frame
  • A AX
  • B CX
  • C SI
  • D BP
Answer: Option D
Q150
Find the output void fun (char**); void main() { har *argv [ ]={"ab", "cd" "er", "gh", "ij", "k1"); fun (argv); } void fun (char **p) { char *t; { char *t; t=(p+=sizeof (int)) [-1]; printf("%s", t); }
  • A ab
  • B cd
  • C ef
  • D gh
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test