C - Files and Preprocessors

C - Files and Preprocessors
81. file *fpl, *fp2;
fp1= fopen ("one", "w");
fp2=fopen("one", "w");
fputc ('a',fpl);
fputc ('B'fp2);
fclose (fp1);
fclose(fp2);
fp1=fopen("one", "r");
fp2=fopen("one", "r");
 = getc (fp2);
putchar (c);
c = getc (fp1);
putchar (c);
What is the output of the above code ?
  • error
  • AB
  • BA
  • BB
Show Answer
82. What is the output o the following code ?
# include <stdarg.h>
show (int t, va_list ptrl)
{
int a,x,i;
a=va arg (ptr1,int);
printf("\n %d", a);
}
display (char *s, ...)
{
int x;
va_list ptr;
va_start (ptr, s);
va_start (ptr,s);
x=va_arg(ptr,int);
show (x,ptr);
}
main()
{
display ("hello", 4, 12, 13, 14, 44)
}

  • 13
  • 12
  • 44
  • 14
Show Answer
83. main (int x, char *y [ ] )
{
printf ("%d %s", x, y [1]);
}
what is the output when the program is executed as prog arg1?
  • 1 prog
  • 1 arg1
  • 2 prog
  • 2 arg1
Show Answer
84. Study the following statements.
#define DELAYTIME 1000
volatile extern int k;
int j;
for (i = 0; i <DELAYTIME;i++);
j=k;
State which one of the following is true.
  • volatile is meaningless for the variable k.
  • volatile is meaningful for the variable k since k is external and can change.
  • volatile is meaningless for the variable k since k is loop invariant.
  • none of the above.
Show Answer
85. Which ANSI C function can be used to obtain a date string from structure *tm?
  • sttime(tm)
  • asctime(tm)
  • gmtime(tm)
  • strtime(tm)
Show Answer
86. What is the output of the following program /
enum mode {green, red orange, blue, white};
main ()
{
green = green + 1;
printf ("%d, %d", green, red);
}

  • 1, 1
  • 0, 1
  • no, output, error in compilation
  • none of the above
Show Answer
87. What is the output of the following program ?
# define  MAX(x, y) ((x) > (y) ? (x) : (y))
main ()
{
int x = 5, y=5;
printf ("maximum is %d", MAX (++x, ++y));
}

  • maximum is 7
  • maximum is 5
  • naxunyn is 6
  • none of the above
Show Answer
88. What is the value of  CAR in the following enumeration /
enum transport
{
SCOOTER = 1, BUS=4, CAR, TRAIN=8
};

  • 0
  • 5
  • 7
  • 4
Show Answer
89. What is the value of LOTUS in the following enumeration ?
enum symbol
{
HAND, SUN, LOTUS, UMBERLLA
};

  • 0
  • 3
  • 2
  • none of the above
Show Answer
90. What is the output the following code ?
enum fruits
{
APPLE = 1, ORANGE=1, GRAPES=3, PINEAPPLE
};
printf ("%d",ORANGE);
  • Compilation error
  • Execution error
  • 2
  • 1
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test