0% found this document useful (0 votes)
32 views31 pages

C Programming Complete 100 MCQs

The document contains a set of 100 multiple-choice questions (MCQs) focused on C programming, specifically covering topics related to 1D arrays. Each question presents a scenario or concept, with four answer options provided. The questions address various aspects of C programming, including program structure, data types, operators, loops, and functions.

Uploaded by

vivekpes2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views31 pages

C Programming Complete 100 MCQs

The document contains a set of 100 multiple-choice questions (MCQs) focused on C programming, specifically covering topics related to 1D arrays. Each question presents a scenario or concept, with four answer options provided. The questions address various aspects of C programming, including program structure, data types, operators, loops, and functions.

Uploaded by

vivekpes2025
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

C Programming MCQs (Up to 1D Arrays) - 100 Questions

Questions:

1. Which is the correct order of sections in a C program?

(a) main(), headers, declarations

(b) Declarations, main(), headers

(c) Headers, declarations, main()

(d) None of the above

2. Which is the correct order of sections in a C program?

(a) main(), headers, declarations

(b) Declarations, main(), headers

(c) Headers, declarations, main()

(d) None of the above

3. Which is the correct order of sections in a C program?

(a) main(), headers, declarations

(b) Declarations, main(), headers

(c) Headers, declarations, main()

(d) None of the above

4. Which is the correct order of sections in a C program?

(a) main(), headers, declarations

(b) Declarations, main(), headers

(c) Headers, declarations, main()

(d) None of the above

5. Which is the correct order of sections in a C program?

(a) main(), headers, declarations

(b) Declarations, main(), headers


(c) Headers, declarations, main()

(d) None of the above

6. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

7. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

8. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

9. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

10. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes
(d) Depends on compiler

11. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

12. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

13. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

14. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler

15. What is the size of an 'int' in a 32-bit system?

(a) 2 bytes

(b) 4 bytes

(c) 8 bytes

(d) Depends on compiler


16. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

17. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

18. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

19. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

20. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

21. What does the format specifier %f stand for in printf?


(a) Integer

(b) Float

(c) Character

(d) String

22. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

23. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

24. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

25. What does the format specifier %f stand for in printf?

(a) Integer

(b) Float

(c) Character

(d) String

26. What is the result of 5 + 2 * 3?

(a) 21
(b) 11

(c) 15

(d) 8

27. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

28. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

29. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

30. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

31. What is the result of 5 + 2 * 3?

(a) 21

(b) 11
(c) 15

(d) 8

32. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

33. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

34. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

35. What is the result of 5 + 2 * 3?

(a) 21

(b) 11

(c) 15

(d) 8

36. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes
(b) No

(c) Error

(d) 5

37. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

38. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

39. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

40. What will be the output of:

int a = 5;
if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

41. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

42. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

43. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5
44. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

45. What will be the output of:

int a = 5;

if(a == 5) printf("Yes"); else printf("No");

(a) Yes

(b) No

(c) Error

(d) 5

46. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

47. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

48. Which loop is guaranteed to run at least once?

(a) for
(b) while

(c) do-while

(d) switch

49. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

50. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

51. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

52. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

53. Which loop is guaranteed to run at least once?

(a) for

(b) while
(c) do-while

(d) switch

54. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

55. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

56. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

57. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

58. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while
(d) switch

59. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

60. Which loop is guaranteed to run at least once?

(a) for

(b) while

(c) do-while

(d) switch

61. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

62. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

63. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function


64. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

65. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

66. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

67. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

68. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

69. What does 'continue' do in a loop?


(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

70. What does 'continue' do in a loop?

(a) Stops loop

(b) Skips iteration

(c) Exits loop

(d) Returns from function

71. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

72. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

73. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

74. Which keyword is used to return a value from a function?

(a) return
(b) break

(c) continue

(d) exit

75. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

76. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

77. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

78. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

79. Which keyword is used to return a value from a function?

(a) return

(b) break
(c) continue

(d) exit

80. Which keyword is used to return a value from a function?

(a) return

(b) break

(c) continue

(d) exit

81. Which storage class makes a variable retain its value between function calls?

(a) auto

(b) static

(c) extern

(d) register

82. Which storage class makes a variable retain its value between function calls?

(a) auto

(b) static

(c) extern

(d) register

83. Which storage class makes a variable retain its value between function calls?

(a) auto

(b) static

(c) extern

(d) register

84. Which storage class makes a variable retain its value between function calls?

(a) auto

(b) static

(c) extern
(d) register

85. Which storage class makes a variable retain its value between function calls?

(a) auto

(b) static

(c) extern

(d) register

86. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

87. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

88. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage
(d) Error

89. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

90. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

91. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

92. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0
(b) 2

(c) Garbage

(d) Error

93. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

94. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

95. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

96. What is the output?

int arr[3] = {1,2};


printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

97. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

98. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error

99. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error
100. What is the output?

int arr[3] = {1,2};

printf("%d", arr[2]);

(a) 0

(b) 2

(c) Garbage

(d) Error
Answers with Explanations

1. (c) Headers, declarations, main()

Explanation: C program starts with headers, then global declarations, then main().

2. (c) Headers, declarations, main()

Explanation: C program starts with headers, then global declarations, then main().

3. (c) Headers, declarations, main()

Explanation: C program starts with headers, then global declarations, then main().

4. (c) Headers, declarations, main()

Explanation: C program starts with headers, then global declarations, then main().

5. (c) Headers, declarations, main()

Explanation: C program starts with headers, then global declarations, then main().

6. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

7. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

8. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

9. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

10. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

11. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.


12. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

13. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

14. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

15. (b) 4 bytes

Explanation: On a 32-bit system, 'int' is typically 4 bytes.

16. (b) Float

Explanation: %f is used to print float values.

17. (b) Float

Explanation: %f is used to print float values.

18. (b) Float

Explanation: %f is used to print float values.

19. (b) Float

Explanation: %f is used to print float values.

20. (b) Float

Explanation: %f is used to print float values.

21. (b) Float

Explanation: %f is used to print float values.

22. (b) Float

Explanation: %f is used to print float values.

23. (b) Float

Explanation: %f is used to print float values.


24. (b) Float

Explanation: %f is used to print float values.

25. (b) Float

Explanation: %f is used to print float values.

26. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

27. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

28. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

29. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

30. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

31. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

32. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

33. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

34. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.

35. (b) 11

Explanation: Multiplication has higher precedence: 2*3=6, 6+5=11.


36. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

37. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

38. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

39. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

40. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

41. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

42. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

43. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

44. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

45. (a) Yes

Explanation: a equals 5, so 'Yes' will be printed.

46. (c) do-while

Explanation: do-while executes body first, then checks condition.

47. (c) do-while

Explanation: do-while executes body first, then checks condition.


48. (c) do-while

Explanation: do-while executes body first, then checks condition.

49. (c) do-while

Explanation: do-while executes body first, then checks condition.

50. (c) do-while

Explanation: do-while executes body first, then checks condition.

51. (c) do-while

Explanation: do-while executes body first, then checks condition.

52. (c) do-while

Explanation: do-while executes body first, then checks condition.

53. (c) do-while

Explanation: do-while executes body first, then checks condition.

54. (c) do-while

Explanation: do-while executes body first, then checks condition.

55. (c) do-while

Explanation: do-while executes body first, then checks condition.

56. (c) do-while

Explanation: do-while executes body first, then checks condition.

57. (c) do-while

Explanation: do-while executes body first, then checks condition.

58. (c) do-while

Explanation: do-while executes body first, then checks condition.

59. (c) do-while

Explanation: do-while executes body first, then checks condition.


60. (c) do-while

Explanation: do-while executes body first, then checks condition.

61. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

62. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

63. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

64. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

65. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

66. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

67. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

68. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

69. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

70. (b) Skips iteration

Explanation: 'continue' skips the rest of loop body and moves to next iteration.

71. (a) return

Explanation: 'return' is used to pass control and value back to caller.


72. (a) return

Explanation: 'return' is used to pass control and value back to caller.

73. (a) return

Explanation: 'return' is used to pass control and value back to caller.

74. (a) return

Explanation: 'return' is used to pass control and value back to caller.

75. (a) return

Explanation: 'return' is used to pass control and value back to caller.

76. (a) return

Explanation: 'return' is used to pass control and value back to caller.

77. (a) return

Explanation: 'return' is used to pass control and value back to caller.

78. (a) return

Explanation: 'return' is used to pass control and value back to caller.

79. (a) return

Explanation: 'return' is used to pass control and value back to caller.

80. (a) return

Explanation: 'return' is used to pass control and value back to caller.

81. (b) static

Explanation: static variables keep their value across function calls.

82. (b) static

Explanation: static variables keep their value across function calls.

83. (b) static

Explanation: static variables keep their value across function calls.


84. (b) static

Explanation: static variables keep their value across function calls.

85. (b) static

Explanation: static variables keep their value across function calls.

86. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

87. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

88. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

89. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

90. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

91. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

92. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

93. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

94. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

95. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.


96. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

97. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

98. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

99. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

100. (a) 0

Explanation: Third element not initialized, defaults to 0 in static memory.

You might also like