Q. What is meant by ‘a’ in the following C operation?

Code:
fp = fopen("Random.txt", "a");
  • (A) Attach
  • (B) Append
  • (C) Apprehend
  • (D) Add
πŸ’¬ Discuss
βœ… Correct Answer: (B) Append

Q. What will be the output of the following C code?

Code:
#include <stdio.h>
    int main()
    {
        int y = 10000;
        int y = 34;
        printf("Hello World! %d\n", y);
        return 0;
    }
  • (A) Compile time error
  • (B) Hello World! 34
  • (C) Hello World! 1000
  • (D) Hello World! followed by a junk value
πŸ’¬ Discuss
βœ… Correct Answer: (A) Compile time error

Q. What will happen if the following C code is executed?

Code:
#include <stdio.h>
    int main()
    {
        int main = 3;
        printf("%d", main);
        return 0;
    }
  • (A) It will cause a compile-time error
  • (B) It will cause a run-time error
  • (C) It will run without any error and prints 3
  • (D) It will experience infinite looping
πŸ’¬ Discuss
βœ… Correct Answer: (C) It will run without any error and prints 3

Q. What will be the output of the following C code?

Code:
#include  <stdio.h>
    int main()
    {
       signed char chr;
       chr = 128;
       printf("%d\n", chr);
       return 0;
    }
  • (A) 128
  • (B) -128
  • (C) Depends on the compiler
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (B) -128

Q. What will be the output of the following C code on a 64 bit machine?

Code:
#include <stdio.h>
    union Sti
    {
        int nu;
        char m;
    };
    int main()
    {
        union Sti s;
        printf("%d", sizeof(s));
        return 0;
    }
  • (A) 8
  • (B) 5
  • (C) 9
  • (D) 4
πŸ’¬ Discuss
βœ… Correct Answer: (D) 4

Q. What will be the output of the following C function?

Code:
#include <stdio.h>
    enum birds {SPARROW, PEACOCK, PARROT};
    enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
    int main()
    {
        enum birds m = TIGER;
        int k;
        k = m;
        printf("%d\n", k);
        return 0;
    }
  • (A) 0
  • (B) Compile time error
  • (C) 1
  • (D) 8
πŸ’¬ Discuss
βœ… Correct Answer: (D) 8

Q. What will be the output of the following C code?

Code:
#include <stdio.h>
    int const print()
    {
        printf(" example.com");
        return 0;
    }
    void main()
    {
        print();
    }
  • (A) Error because function name cannot be preceded by const
  • (B) Example.com
  • (C) Example.com is printed infinite times
  • (D) Blank screen, no output
πŸ’¬ Discuss
βœ… Correct Answer: (B) Example.com

Q. Will the following C code compile without any error?

Code:
#include <stdio.h>
    int main()
    {
        for (int k = 0; k < 10; k++);
            return 0;
    }
  • (A) Yes
  • (B) No
  • (C) Depends on the C standard implemented by compilers
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Depends on the C standard implemented by compilers

Q. What will be the final value of x in the following C code?

Code:
#include <stdio.h>
    void main()
    {
        int x = 5 * 9 / 3 + 9;
    }
  • (A) 3.75
  • (B) Depends on compiler
  • (C) 24
  • (D) 3
πŸ’¬ Discuss
βœ… Correct Answer: (C) 24

Q. What will be the output of the following C code? (Initial values: x= 7, y = 8)

Code:
#include <stdio.h>
    void main()
    {
        float x;
        int y;
        printf("enter two numbers \n", x);
        scanf("%f %f", &x, &y);
        printf("%f, %d", x, y);
    }
  • (A) 7.000000, 7
  • (B) Run time error
  • (C) 7.000000, junk
  • (D) Varies
πŸ’¬ Discuss
βœ… Correct Answer: (C) 7.000000, junk