Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

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

View 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

View 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

View 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

View 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

View 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

View 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

View Answer

Answer: a [Reason:] None.