C Programming MCQs with answers Page - 141

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. What is the output of the following code?

Code:
int a = 10;
if (a = 0)
    printf("Zero");
else
    printf("Non-zero");
  • (A) Zero
  • (B) Non-zero
  • (C) Compile error
  • (D) Runtime error

A

Admin • 833K Points
Coach

Q. Which function is used to dynamically allocate memory in C?

  • (A) calloc()
  • (B) malloc()
  • (C) realloc()
  • (D) All of the above

A

Admin • 833K Points
Coach

Q. What is the output of the following code?

Code:
int x = 10;
printf("%d", x++);
  • (A) 10
  • (B) 11
  • (C) 9
  • (D) Undefined

A

Admin • 833K Points
Coach

Q. What is the output of the following code?

Code:
int arr[] = {1,2,3};
printf("%d", *(arr+1));
  • (A) 1
  • (B) 2
  • (C) 3
  • (D) Undefined

A

Admin • 833K Points
Coach

Q. Which header file is required for using printf()?

  • (A) conio.h
  • (B) math.h
  • (C) stdio.h
  • (D) stdlib.h

A

Admin • 833K Points
Coach

Q. Which operator is used for conditional branching?

  • (A) if
  • (B) switch
  • (C) ?:
  • (D) &&

A

Admin • 833K Points
Coach

Q. What is the output of this code?

Code:
int a = 1;
if (a)
    printf("True");
else
    printf("False");
  • (A) True
  • (B) False
  • (C) 1
  • (D) Compile Error

A

Admin • 833K Points
Coach

Q. Which of these is used to terminate a C statement?

  • (A) ,
  • (B) .
  • (C) ;
  • (D) :

A

Admin • 833K Points
Coach

Q. Which keyword is used to prevent modification of a variable?

  • (A) readonly
  • (B) final
  • (C) const
  • (D) static

A

Admin • 833K Points
Coach

Q. What is the output of the following code?

Code:
int i = 0;
while (i < 3)
{
  printf("%d", i);
  i++;
}
  • (A) 012
  • (B) 123
  • (C) 321
  • (D) Undefined

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