C Programming MCQs with answers Page - 140

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 does 'fgetc()' return at EOF?

  • (A) ''
  • (B) NULL
  • (C) -1
  • (D) 0

A

Admin • 833K Points
Coach

Q. Which of the following will compile successfully?

Code:
const int a;
a = 5;
  • (A) Yes
  • (B) No
  • (C) Only in C++
  • (D) Only for global vars

A

Admin • 833K Points
Coach

Q. Which function moves the file pointer to a specified location?

  • (A) fseek()
  • (B) ftell()
  • (C) rewind()
  • (D) fmove()

A

Admin • 833K Points
Coach

Q. What does fclose() return on success?

  • (A) 1
  • (B) 0
  • (C) -1
  • (D) NULL

A

Admin • 833K Points
Coach

Q. What happens if you dereference a NULL pointer?

  • (A) Returns 0
  • (B) Segmentation fault
  • (C) Prints NULL
  • (D) Undefined result

A

Admin • 833K Points
Coach

Q. Which keyword is used to define macros?

  • (A) macro
  • (B) #define
  • (C) define
  • (D) #macro

A

Admin • 833K Points
Coach

Q. What is a dangling pointer?

  • (A) Pointer to a variable
  • (B) Pointer to freed memory
  • (C) Pointer to null
  • (D) Pointer not initialized

A

Admin • 833K Points
Coach

Q. Which of the following is a correct way to define a struct?

  • (A) struct A { int x; }
  • (B) structure A { int x; }
  • (C) class A { int x; }
  • (D) define A { int x; }

A

Admin • 833K Points
Coach

Q. Which of the following is correct about array indexing?

  • (A) a[5] = 0 is valid for array of size 5
  • (B) a[0] is always the last element
  • (C) a[-1] is valid
  • (D) a[0] is the first element

A

Admin • 833K Points
Coach

Q. What is the result of sizeof(char)?

  • (A) 2
  • (B) 1
  • (C) 4
  • (D) Depends on OS

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