C Programming MCQ PDF
C Programming MCQ PDF
A. 1
B. 0
C. 10
D. 2 or 4
Answer: 2 or 4
A. Pre-processor
B. Compiler
C. Linker
D. Editor
Answer: Pre-processor
B. Easy implementation
5. What is the maximum number of characters that can be held in the string variable
char address line [40]?
A. 39
B. 41
C. 40
D. 38
Answer: 39
A. Deque
B. Vector
C. List
D. Stack
Answer: Stack
7. If addition had higher precedence than multiplication, then the value of the
expression (1 + 2 * 3 + 4 * 5) would be which of the following?
A. 27
B. 105
C. 69
D. 47
Answer: 105
Explanation: (1 + 2 * 3 + 4 * 5)
= (1 + 2) * (3 + 4) * 5
=3*7*5
= 105
A. Attribute values
B. Class interfaces
C. Return types
D. Methods
A. An integer
C. Pointer to an integer
A. sizeof(a)/sizeof(a[0])
B. sizeof(a)
C. sizeof(a)*sizeof(a[0])
Answer: sizeof(a)/sizeof(a[0])
A. extern
B. volatile
C. typedef
D. static
Answer: volatile
12. Which of the following will occur if we call the free() function on a NULL pointer?
B. Compilation Error
C. Runtime error
D. undefined behavior
13. Which of the following should be used to free memory from a pointer allocated
using the “new” operator?
A. free()
B. realloc()
C. delete
Answer: delete
A. Stack
B. Queue
C. Trees
D. Deque
Answer: Stack
C. No data hiding
D. Cannot have static members in struct body
16. How is the 3rd element in an array accessed based on pointer notation?
A. *a + 3
B. *(*a+3)
C. *(a + 3)
D. & (a+3)
Answer: *(a + 3)
A. fgets
B. fseek
C. fclose
D. fopen
Answer: fopen ()
A. w
B. r
C. rb
C. Output data
D. Input data
A. C++
B. C
C. Python
D. Java
Answer: C
A. Error message
B. The value of (a + 1)
D. Garbage
23. What is the 16-bit compiler allowable range for integer constants?
A. -3.4e38 to 3.4e38
B. -32767 to 32768
C. -32668 to 32667
D. -32768 to 32767
A. Interactive debugger
B. C compiler
C. C interpreter
D. Analyzing tool
25. If p is an integer pointer with a value 1000, then what will the value of p + 5 be?
A. 1005
B. 1020
C. 1004
D. 1010
Answer: 1020
A. int **val
B. int *val
C. int **val
D. int &val
27. What is the size of the int data type (in bytes) in C?
A. 4
B. 8
C. 2
D. 1
Answer: 4
A. Before main
C. After main
A. An Array of characters
A. While loop
B. For loop
C. do-while loop