C - Files and Preprocessors Questions and Answers

Practice Mode
Showing 10 of 96 questions
Q51
Identify the trigraph sequence for ^.
  • A ??/
  • B ??=
  • C ??'
  • D ??!
Answer: Option C
Q52
Which of the following is valid for opening a read-only ASCII  file ?
  • A fileopen (filenm, "read");
  • B fopen (filenm, "r");
  • C fileopen (filenm, "r");
  • D fopen (filenm, "read");
Answer: Option B
Q53
What are two predefined FILE pointers in C?
  • A stdout and stderr
  • B console and error
  • C stdout and stdio
  • D stdio and stderr
Answer: Option A
Q54
vaoid listfiele (FILE *f) { int C; while ( C = fgetc( f ) ! = EOF) { printf ("%d",c); } printf ("\n"); } What will be printed when the function above is called with pointer to an open file that contains the three characters abc ?
  • A The characters ab followed by an infinite number of c's
  • B 111
  • C abc
  • D 000
Answer: Option B
Q55
How could stderr be redirected from withing a program to force all error messages to be written to the end of the text file "error. log" instead of the location specified by the operating system ?
  • A stderr = fopen ( "error.log", "w");
  • B freopen ("error.log", "a", stderr);
  • C stderr = freopen (stderr, "a", "error.log");
  • D stderr = fopen ("errror.log", "a");
Answer: Option D
Q56
Which of the following would properly define a macro that doubled any expression passed to it ?
  • A # define DOUBLE (x ) x* 2
  • B # define DOUBLE (x) ((x)*);
  • C # define DOUBLE (x) (x) *2)
  • D # define DOUBLE (x) (x *2)
Answer: Option C
Q57
What will be the value of j in the following code ? # define CATCH (a) a + 1 int i = 2; int j = 4 * CATCH (I * 3);
  • A 24
  • B 25
  • C 28
  • D 32
Answer: Option B
Q58
Which of the following preprocessor directives will make the system-dependent constant INT_MAX available for an ANSI Ccompiler ?
  • A # include <limits.h>
  • B # include <int.h>
  • C # include <ctype.h>
  • D # define INT_MAX
Answer: Option A
Q59
Which of the following is NOT a pre-processor directive ?
  • A # if
  • B # line
  • C # elseif
  • D #pragma
Answer: Option C
Q60
Which of the following is NOT a pre-processor directive ?
  • A # elif
  • B # pragma
  • C # line
  • D #exclude
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test