C Language MCQ Questions and Answers

C Language MCQs

 

1. Who is the father of C language ?

a) Bjarne stroustrup
b) James A.gosling
c) Dennis ritchie
d) Dr. e.f codd

Show Answer
c) Dennis ritchie

 

2. How many keyword’s in C ?

a) 0
b) 32
c) 48
d) 255

Show Answer
b) 32

 

3. How many types of loop in C?

a) one
b) two
c) three
d) none

Show Answer
c) three

 

4. Which of the following function is user defined ?

a) printf
b) scanf
c) main
d) none

Show Answer
c) main

 

5. Void occupy how many bytes in memory ?

a) 0
b) 1
c) 2
d) 4

Show Answer
a) 0

 

6. In C, we used for input/output ?

a) cin & cout
b) input & output
c) scanf & printf
d) Both b & c

Show Answer
c) scanf & printf

 

7. What is the range of int data type ?

a) 0to 255
b) -127 to +128
c) -32768 to +32767
d) none

Show Answer
c) -32768 to +32767

 

8. What is the range of char data type ?

a) 0to 255
b) -128 to +127
c) 0 to 127
d) none

Show Answer
b) -128 to +127

 

9. In which year, C Language was Developed?

a) 1979
b) 1972
c) 1991
d) 1995

Show Answer
b) 1972

 

10. Which type of Language is C ?

a) Procedural oriented programming
b) object oriented programming
c) Semi-object oriented programming
d) none

Show Answer
a) Procedural oriented programming

 

11. The format identifier ‘%c’ is used for which datatype ?

a) int
b) double
c) char
d) float

Show Answer
c) char

 

12. size of () is a ?

a) function
b) variable
c) Both a & b
d) operator

Show Answer
d) operator

 

13. Break statement is used for ?

a) Quit a program
b) Quit the current itration
c) Both a & b
d) none

Show Answer
b) Quit the current itration

 

14. Is it possible to run program without main() ?

a) Yes
b) No
c) error
d) Can’t say

Show Answer
a) Yes

 

15. Which of the following is a logical NOT operator ?

a) ||
b) &&
c) !
d) +

Show Answer
c) !

 

16. what is the default value of local variable?

a) 0
b) 1
c) garbage
d) null

Show Answer
c) garbage

 

17. What is the default value of static variable ?

a) 0
b) null
c) garbage
d) none

Show Answer
a) 0

 

18. Which of the following will not return a value?

a) void
b) int
c) null
d) char

Show Answer
a) void

 

19. Is const better than #define?

a) Yes
b) No
c) Can’t say
d) none

Show Answer
a) Yes

 

20. Can we assign null on void pointer ?

a) Yes
b) No
c) error
d) none

Show Answer
a) Yes

 

21. Prototype of a function means ?

a) Name of function
b) Parameter of function
c) Declaration of function
d) All

Show Answer
d) All

 

22. float a[15] , what is the size of array ?

a) 17
b) 64
c) 16
d) 60

Show Answer
d) 60

 

23. Variable that are declared but not initialized contains,_____________?

a) 0
b) Blank space
c) garbage
d) none

Show Answer
c) garbage

 

24. Which of the following is not a valid storage class?

a) auto
b) extern
c) dynamic
d) register

Show Answer
c) dynamic

 

25. Which type of statement is ‘break’ in C language?

a) Conditional statement
b) Jump statement
c) Looping statement
d) All of above

Show Answer
b) Jump statement

 

26. What is the scope of local variable ?

a) Entire program
b) Within the block or function
c) Only main function
d) All of above

Show Answer
b) Within the block or function

 

27. Which operator is used to access value at address stored by a pointer variable?

a) *
b) &
c) #
d) @

Show Answer
a) *

 

28. Which of the following user-defined datatype share it’s memory each other ?

a) structure
b) union
c) class
d) array

Show Answer
b) union

 

29. Which pre-defined function is used for comparing two strings?

a) strepy()
b) strcat()
c) strrev()
d) strcmp()

Show Answer
d) strcmp()

 

30. Which standard liberary file printf & scanf are located ?

a) conio.h
b) string.h
c) math.h
d) stdio.h

Show Answer
d) stdio.h

 

31. Can we print normal variable inside static function ?

a) Yes
b) No

Show Answer
b) No

 

32. How many way to calling of function in C language ?

a) two
b) three
c) four
d) one

Show Answer
a) two

 

33. Which of the following is more memory efficient ?

a) structure
b) union
c) Both a & b
d) Depends on system

Show Answer
b) union

 

34. Which of the following is the correct operator to compare two variables?

a) =
b) !=
c) equal
d) ==

Show Answer
d) ==

 

35. Which of the following is the correct comment ?

a) ** comment **
b) */ comment*/
c) /* comment */
d) { comment }

Show Answer
c) /* comment */

 

36. What is the index number of the last element of an array in 5 elements?

a) 5
b) 0
c) 3
d) 4

Show Answer
d) 4

 

37. The parameters specified in the function call are called parameters?

a) Actual
b) Formal
c) value
d) all

Show Answer
a) Actual

 

38. Which type of loop are while and for ?

a) Entry control
b) Exit control
c) both
d) none

Show Answer
a) Entry control

 

39. What is the ASCII value of space character ?

a) 32
b) 0
c) 65
d) 255

Show Answer
a) 32

 

40. Logical expressions produce type results ?

a) explicit
b) garbage
c) bool
d) static

Show Answer
c) bool

 

41. If int a=5/2; will return a value ?

a) 2.5
b) 2.0
c) 3
d) 2

Show Answer
d) 2

 

42. By default how the values are passed to the function ?

a) Call by value
b) Call by reference
c) Call by pointer
d) All of above

Show Answer
a) Call by value

 

43. C language developed at_________________

a) AT & T’s Bell lab
b) Sun micro system
c) Cambridge university
d) none

Show Answer
a) AT & T’s Bell lab

 

44. C programs are converted into machine language with the help of ?

a) An editor
b) A compiler
c) An operating system
d) None of these

Show Answer
b) A compiler

 

45. C was primarily developed as ?

a) System programming
b) General purpose
c) Data processing
d) none

Show Answer
a) System programming

 

46. Which of the following is not a reserved keyword for C ?

a) auto
b) case
c) main
d) default

Show Answer
c) main

 

47. Which one of the following is not a valid indentifier ?

a) _a;
b) 1a;
c) a_b;
d) a1;

Show Answer
b) 1a;

 

48. Which is the only function all C programs must contain ?

a) system()
b) start()
c) main()
d) getch()

Show Answer
c) main()

 

49. Which of the following is not a correct variable type ?

a) double
b) int
c) char
d) real

Show Answer
d) real

 

50. Which loop execute at_least once even condition is false ?

a) do while
b) while
c) for
d) for_each

Show Answer
a) do while

 

51. strlen() is used for ?

a) Calculate string length
b) Reverse string
c) Concat two strings
d) Copy string

Show Answer
a) Calculate string length

 

52. Which operator is known as ternary operator ?

a) ::
b) ;
c) :
d) ?:

Show Answer
d) ?:

 

53. Recursive functions are executed in a ?

a) FIFO order
b) Load balancing
c) parallel
d) LIFO order

Show Answer
d) LIFO order

 

54. Which of the following are example of iteration in C?

a) for
b) while
c) do-while
d) all of above

Show Answer
d) all of above

 

55. Which keyword can be used for coming out of recursion?

a) break
b) exit
c) return
d) none

Show Answer
c) return

 

56. Associativity of an operator are ?

a) Left to right
b) Right to left
c) Random
d) Both a & b

Show Answer
d) Both a & b

 

57. Automatic variable are initialized with by default?

a) 0
b) garbage
c) blank
d) none

Show Answer
b) garbage

 

58. Can we overload function in C?

a) Yes
b) No
c) Can’t say
d) none

Show Answer
b) No

 

59. How many logical operator in C?

a) one
b) two
c) three
d) none

Show Answer
c) three

 

60. What is the return type of printf & scanf function?

a) void
b) int
c) char
d) bool

Show Answer
b) int

 

61. int **ptr is ?

a) pointer
b) pointer to integer
c) invalid
d) pointer to pointer

Show Answer
d) pointer to pointer

 

62. What is the return_type of sqrt() ?

a) int
b) float
c) double
d) depends on the datatype of parameter

Show Answer
c) double

 

63. Can function definition be present in header files ?

a) yes
b) no
c) Depends on compiler
d) none

Show Answer
a) yes

 

64. Is initialization mandatory for local static variables?

a) Yes
b) No
c) Depends on compiler
d) none

Show Answer
b) No

 

65. All keywords in C are in ?

a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) none

Show Answer
a) LowerCase letters

 

66. Which of the following function is pre-defined ?

a) print()
b) input()
c) main()
d) sqrt()

Show Answer
d) sqrt()

 

67. Difference between ASCII value of Upper & Lower case of the same letter is, ?

a) 0
b) 32
c) 48
d) 255

Show Answer
b) 32

 

68. What is the size of struct always?

a) Equal to it’s Biggest data member size
b) Equal to sum of it’s all data member size
c) Equal to it’s Smallest data member size
d) none

Show Answer
b) Equal to sum of it’s all data member size

 

69. Which Datatype will throw an error when we perform modulus operation(%)?

a) int
b) short
c) float
d) All of above

Show Answer
c) float

 

70. float occupy how many bytes in memory ?

a) 0 byte
b) 1 byte
c) 2 bytes
d) 4 bytes

Show Answer
d) 4 bytes

 

71. C language is which language subset?

a) java
b) python
c) C++
d) C#

Show Answer
c) C++

 

72. Automatic variables are stored in__________

a) Stack
b) Heap
c) Register
d) none

Show Answer
a) Stack

 

73. An uninitialized pointer is called ?

a) Void pointer
b) Null pointer
c) Dangling pointer
d) Wild pointer

Show Answer
d) Wild pointer

 

74. A pointer that is initialized NULL value is called ?

a) Null pointer
b) Wild pointer
c) Function pointer
d) Pointer to pointer

Show Answer
a) Null pointer

 

75. A function can be defined inside another function?

a) true
b) false
c) can’t say
d) none

Show Answer
b) false

 

76. A function can be called inside a another function?

a) true
b) false
c) none
d) Both a & b

Show Answer
a) true

 

77. Declaration of single line comment is ?

a) /*
b) */
c) //
d)/* */

Show Answer
c) //

 

78. How many type of comments are in C?

a) one
b) two
c) three
d) four

Show Answer
b) two

 

79. The maximum number of arguments that can be passed in a single function ?

a) 127
b) 0
c) 255
d) 253

Show Answer
d) 253

 

80. How many types of assignment operator in C ?

a) One
b) Two
c) Three
d) None

Show Answer
b) Two

 

81. The format identifier ‘%i’ is used for which datatype ?

a) int
b) double
c) char
d) float

Show Answer
a) int

 

82. Every function must return a value?

a) Yes
b) No
c) Can’t say
d) None

Show Answer
b) No

 

83. Which keyword is used to come out of a loop only for that itration ?

a) break
b) continue
c) exit
d) return

Show Answer
b) continue

 

84. Result of logical expression in C is?

a) true
b) false
c) 0 or 1
d) All of above

Show Answer
c) 0 or 1

 

85. A variable that is declared inside another function can be used in main()?

a) Yes
b) No
c) Only for that function
d) Both b & c

Show Answer
d) Both b & c

 

86. C preprocessors are specified with ?

a) $
b) ::
c) ;
d) #

Show Answer
d) #

 

87. How many type of macros in C?

a) one
b) Two
c) Three
d) No any macros

Show Answer
b) Two

 

88. Which loop is best to perform the operation then test the condition?

a) for loop
b) while loop
c) do while loop
d) No any loop

Show Answer
c) do while loop

 

89. How many types of Datatype in C ?

a) One
b) Two
c) Three
d) four

Show Answer
b) Two

 

90. Which of the following is primary Datatype?

a) struct
b) class
c) enum
d) int

Show Answer
d) int

 

91. Escape sequences are prefixed with __________?

a) %
b) /
c) \
d) :

Show Answer
c) \

 

92. Which of the following is not an operator?

a) ,
b) size of
c) Il
d) none

Show Answer
d) none

 

93. In C, which function we use to clear the console?

a) getch()
b) clearscreen()
c) clrscr()
d) clearscr()

Show Answer
c) clrscr()

 

94. In which Datatype the size is not fixed?

a) int
b) float
c) struct
d) double

Show Answer
c) struct

 

Leave a Comment