These C Programming multiple-choice questions and their answers will help you strengthen your grip on the subject of C Programming. You can prepare for an upcoming exam or job interview with these C Programming MCQs.
So scroll down and start answering.
A. main()
B. program()
C. start()
A. Format string
B. Stack overflow
C. Integer overflow
D. Race condition
E. Heap overflow
A. switch
B. static
C. extern
D. intern
E. struct
A. True
B. False
A. True
B. False
A. for(;;) { }
B. while(1) { }
C. loop: ... goto loop;
D. All answers are right.
A. It will include dir/x.h if __APPLE__ is defined, or other_dir/x.h, otherwise.
B. It will define __APPLE__, include dir/x.h and next time will include other_dir/x.h
C. It will define __APPLE__ and include dir/x.h
D. It will include dir/x.h if __APPLE__ is not defined, or other_dir/x.h, otherwise.
A. 0
B. 1
C. 5
D. 4
A. Program will not execute.
B. Array not initialized correctly
C. 6
D. Compile time error
A. 0.5
B. 0
C. Undefined
A. It will crash your program (an int is four bytes long, not two).
B. Nothing, it will yield a type mismatch compiler error.
C. It will make p point to an uninitialized two-byte piece of memory allocated from the heap.
D. It will make p point to the number 2.
A. a[0]th value of array
B. a[last]th value of array
C. All elements of an array
D. Address of array
A. tabulations
B. tags
C. angle brackets
D. curly braces
E. indentation
A. 0
B. 2
C. 1
A. None of them
B. Logical operator
C. Arithmetic Operator
D. Relational Operator
A. 5
B. 6
C. 6.0
D. 5.60
E. 5.666666
A. No
B. Yes
A. - (hyphen)
B. * (asterisk)
C. _ (underscore)
D. | (pipeline)
A. An int *
B. An int
C. It does not compile
A. =
B. equal
C. ==
D. :=
A. char
B. float
C. var
D. double
E. int
A. float
B. real
C. int
A. .
B. +
C. :
D. ;
A. False
B. True
A. 6
B. 3
C. 9
D. It depends on the compiler and the hardware architecture.
E. 12
A. value of variable b
B. address of variable a
C. value of variable a
D. address of variable b
A. It will cause segfault
B. no
C. yes
D. It will not compile
A. its size depends on the implementation
B. its size is 128 bits
C. it's an alias of float
D. it uses the GPU
A. arr[0]
B. (both of these)
C. *arr
A. float, double, long double
B. double, long int, float
C. short int, double, long int
D. float, double
A. 6
B. 14
C. 18
D. 10
A. *(&foo + 4)
B. (*foo + 4)
C. There is no equivalent using those notations
D. &(foo + 4)
E. *(foo + 4)
A. Undefined
B. 2
C. 1
A. Nothing, it will give a runtime error.
B. Nothing, it won't compile.
C. Unknown, it depends on what malloc will return.
D. 0
A. 2
B. 0
C. 1
D. 3
A. actual arguments
B. formal arguments
C. array definitions
D. arguments with data types
E. macros used with variable argument functions
A. double
B. long
C. float
D. int
A. doThis(*array)
B. doThis(array[size])
C. doThis(&array)
D. doThis(array)
A. 2
B. Depends on the implementation, but always some number > 1.
C. 1
D. 4
E. Depends on the implementation, but always some number >= 1.
A. True
B. False
A. ~
B. ^
C. <<
D. !
E. |
A. ELANCE
B. NULL
C. Sengmentation Fault
D. It Won't Compile
A. NULL
B. The program segfault
C. The behavior is implementation-defined
D. A unique pointer
A. *p
B. &p
C. &(p)
D. **(p)
E. *(*p)
A. Garbage
B. Null
C. Not equal
D. Equal
E. Compilation error
A. 24
B. 2
C. 4
D. 1
E. 3
A. 0 0
B. 1 1
C. 1 3
D. Garbage Values of i & j
E. Compile Time Error
A. False
B. True
A. 0
B. 1
C. 25
D. -1
E. 2
A. fopen
B. close
C. printf