C Programming MCQs with answers Page - 11

Here, you will find a collection of MCQ questions on C Programming. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. Which of the following is not an operator in C?

  • (A) ,
  • (B) sizeof()
  • (C) ~
  • (D) None

A

Admin • 833K Points
Coach

Q. scanf() is a predefined function in______header file.

  • (A) stdlib. h
  • (B) ctype. h
  • (C) stdio. h
  • (D) stdarg. h

A

Admin • 833K Points
Coach

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

A

Admin • 833K Points
Coach

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
", y);
        return 0;
    }
  • (A) Compile time error
  • (B) Hello World! 34
  • (C) Hello World! 1000
  • (D) Hello World! followed by a junk value

A

Admin • 833K Points
Coach

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

A

Admin • 833K Points
Coach

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

Code:
#include  <stdio.h>
    int main()
    {
       signed char chr;
       chr = 128;
       printf("%d
", chr);
       return 0;
    }
  • (A) 128
  • (B) -128
  • (C) Depends on the compiler
  • (D) None

A

Admin • 833K Points
Coach

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

A

Admin • 833K Points
Coach

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
", k);
        return 0;
    }
  • (A) 0
  • (B) Compile time error
  • (C) 1
  • (D) 8

A

Admin • 833K Points
Coach

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

A

Admin • 833K Points
Coach

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

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ