C

1. Which of the following library function is not case-sensitive?
a) toupper()
b) tolower()
c) isdigit()
d) all of the mentioned

2. Comment on the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         char *a = {"p", "r", "o", "g", "r", "a", "m"};
  5.         printf("%s", a);
  6.     }
a) Output will be program
b) Output will be p
c) No output
d) Compile-time error
3. The correct way to generate numbers between minimum and maximum(inclusive) is _________________
a) minimum + (rand() % (maximum – minimum));
b) minimum + (rand() % (maximum – minimum + 1));
c) minimum * (rand() % (maximum – minimum))
d) minimum – (rand() % (maximum+minimum));

4. What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int a[4] = {1, 2, 3, 4};
  5.         int b[4] = {1, 2, 3, 4};
  6.         int n = &b[3] - &a[2];
  7.         printf("%d\n", n);
  8.     }
a) -3
b) 5
c) 4
d) Compile time error
5. Advantage of a multi-dimension array over pointer array.
a) Pre-defined size.
b) Input can be taken from user.
c) Faster Access.
d) All of the mentioned

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct p
  3.     {
  4.         int x;
  5.         char y;
  6.         struct p *ptr;
  7.     };
  8.     int main()
  9.     {
  10.         struct p p = {1, 2, &p};
  11.         printf("%d\n", p.ptr->x);
  12.         return 0;
  13.     }
a) Compile time error
b) Undefined behaviour
c) 1
d) 2

7. What is the output of this C code?

  1.     #include <stdio.h>
  2.     #include <ctype.h>
  3.     int main()
  4.     {
  5.         if (isspace('n'))
  6.             printf("space\n");
  7.         else
  8.             printf("not space\n");
  9.             return 0;
  10.     }
a) Compile time error
b) space
c) not space
d) None of the mentioned

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         char *a[10] = {"hi", "hello", "how"};
  5.         int i = 0;
  6.         for (i = 0;i < 10; i++)
  7.         printf("%s", a[i]);
  8.     }
a) hi hello how Segmentation fault
b) hi hello how null
c) hey hello how Segmentation fault
d) hi hello how followed by 7 nulls

9. What is the output of this C code?

  1.     #include <stdio.h>
  2.     struct student
  3.     {
  4.     };
  5.     void main()
  6.     {
  7.         struct student s[2];
  8.         printf("%d", sizeof(s));
  9.     }
a) 2
b) 4
c) 8
d) 0
10. What happens when we use fprintf(stderr, “error: could not open filen”);
a) The diagnostic output is directly displayed in the output.
b) The diagnostic output is pipelined to the output file.
c) The line which caused error is compiled again.
d) The program is immediately aborted.
0
{"name":"C", "url":"https://www.quiz-maker.com/QH4BEDU","txt":"1. Which of the following library function is not case-sensitive?, 2. Comment on the output of this C code? #include int main() { char *a = {\"p\", \"r\", \"o\", \"g\", \"r\", \"a\", \"m\"}; printf(\"%s\", a); }, 3. The correct way to generate numbers between minimum and maximum(inclusive) is _________________","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker