C MCQ set number 00713

1. Which is true about function tolower?
a) The function tolower is defined in
b) Converts an upper case letter to lower case
c) returns other characters untouched
d) None of the mentioned

Answer

Answer: d [Reason:] None.

2. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char c = '�';
  5.         putchar(c);
  6.     }

a) Compile time error
b) Nothing
c) 0
d) Undefined behaviour

Answer

Answer: b [Reason:] None.

3. putchar(c) function/macro always outputs character c to the
a) screen
b) standard output
c) depends on the compiler
d) depends on the standard

Answer

Answer: b [Reason:] None.

4. What is the output of this C code if
    following commands are used to run(considering myfile exists)?
    gcc -otest test.c
    ./test < myfile

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char c = 'd';
  5.         putchar(c);
  6.     }

a) Compile time error (after first command)
b) d in the myfile file
c) d on the screen
d) Undefined behaviour

Answer

Answer: c [Reason:] None.

5. What is the output of this C code if
    following commands are used to run(considering myfile exists)?
    gcc -otest test.c
    ./test > myfile

  1.  #include <stdio.h>
  2.     int main(int argc, char **argv)
  3.     {
  4.         char c = 'd';
  5.         putchar(c);
  6.         printf(" %dn", argc);
  7.     }

a) d 2 in myfile
b) d 1 in myfile
c) d in myfile and 1 in screen
d) d in myfile and 2 in screen

Answer

Answer: b [Reason:] None.

6. What is the output of this C code if
    following commands are used to run and if myfile does not exist?
    gcc -o test test.c
    ./test > myfile

  1.  #include <stdio.h>
  2.     int main(int argc, char **argv)
  3.     {
  4.         char c = 'd';
  5.         putchar(c);
  6.         printf(" %dn", argc);
  7.     }

a) d 2 in myfile
b) d 1 in myfile
c) Depends on the system
d) Depends on the standard

Answer

Answer: b [Reason:] None.

7. The statement prog <infile causes
a) prog to read characters from infile.
b) prog to write characters to infile.
c) infile to read characters from prog instead.
d) nothing

Answer

Answer: a [Reason:] None.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.