0% found this document useful (0 votes)
10 views

QUESTION+BANK+-+C+PROGRAMMING

The document is a comprehensive question bank covering various topics in C programming, including concepts such as variables, pointers, data types, structures, memory allocation, and functions. It also includes programming exercises and theoretical questions related to algorithms, data structures, and the C language's syntax and semantics. The questions are designed to test both theoretical knowledge and practical coding skills in C programming.

Uploaded by

sachhusachin277
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

QUESTION+BANK+-+C+PROGRAMMING

The document is a comprehensive question bank covering various topics in C programming, including concepts such as variables, pointers, data types, structures, memory allocation, and functions. It also includes programming exercises and theoretical questions related to algorithms, data structures, and the C language's syntax and semantics. The questions are designed to test both theoretical knowledge and practical coding skills in C programming.

Uploaded by

sachhusachin277
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

C Programming Question Bank www.cranesvarsity.

com

C PROGRAMMING

1. What does static variable mean?


2. What is a pointer? And its types.
3. What is a structure?
4. What are the different data types in C? How many bytes they occupy?
5. Define data type NodeCD, declare 100 variables of CD1 & access data?
6. What are the differences between structures and arrays?
7. In header files whether functions are declared or defined?
8. What are the differences between malloc () and calloc ()?
9. What are macros? What are its advantages and disadvantages?
10. Difference between pass by reference and pass by value?
11. What is static identifier?
12. Where is the auto variables stored?
13. Where does global, static, local, register variables, free memory and C Program
instructions get stored?
14. Difference between arrays and linked list?
15. Write a program to illustrate difference b/w auto & static variables.
16. What are enumerations?
17. Describe about storage allocation and scope of global, extern, static, local and
register variables?
18. What are register variables? What are the advantages of using register variables?
19. What is the use of type def?
20. Can we specify variable field width in a scanf () format string? If possible how?
21. Out of fgets () and gets () which function is safe to use and why?
22. Difference between strdup and strcpy?
23. What is recursion?
24. Differentiate between for loop & while loop? What are it uses?
25. What are the different storage classes & specifiers in C?
26. Write down the equivalent pointer expression for referring the same element
a[i][j][k][l]?
27. What is difference between Structure and Unions?
28. What the advantages of using Unions?
29. What are the advantages of using pointers in a program?
30. What is the difference between Strings and Arrays?
31. What is the difference b/w declaration & definition?
32. What is a far pointer? Where we use it?
33. What is a function pointers ? Where do you use it & Give e.g?

© Cranes Varsity r2.0v1.0-2014-15 1/ 13


C Programming Question Bank www.cranesvarsity.com

34. How will you declare an array of three function pointers where each function
receives two ints and returns a float?
35. What is a NULL Pointer? Whether it is same as an uninitialized pointer?
36. What is a NULL Macro? What is the difference between a NULL Pointer and a NULL
Macro?
37. What does the error 'Null Pointer Assignment' means and what causes this error?
38. What is near, far and huge pointers? How many bytes are occupied by them?
39. How would you obtain segment and offset addresses from a far address of a
memory location?
40. Are the expressions arr and & arr same for an array of integers?
41. Does mentioning the array name gives the base address in all the contexts?
42. Explain one method to process an entire string as one unit?
43. What is the similarity between a Structure, Union and enumeration?
44. Can a Structure contain a Pointer to itself?
45. How can we check whether the contents of two structure variables are same or
not?
46. How are Structure passing and returning implemented by the complier?
47. How can we read/write Structures from/to data files?
48. What is the difference between an enumeration and a set of pre-processor #
defines?
49. What do the 'c' and 'v' in argc and argv stand for?
50. Are the variables argc and argv are local to main?
51. What is the maximum combined length of command line arguments including the
space between adjacent arguments?
52. If we want that any wildcard characters in the command line arguments should
be appropriately expanded, are we required to make any special provision? If yes,
which?
53. Does there exist any way to make the command line arguments available to other
functions without passing them as arguments to the function?
54. What are bit fields? What is the use of bit fields in a Structure declaration?
55. To which numbering system can the binary number 1101100100111100 be easily
converted to?
56. Which bit wise operator is suitable for checking whether a particular bit is on or
off?
57. Which bit wise operator is suitable for turning off a particular bit in a number?
58. Which bit wise operator is suitable for putting on a particular bit in a number?
59. Which bit wise operator is suitable for checking whether a particular bit is on or
off?

© Cranes Varsity r2.0v1.0-2014-15 2/ 13


C Programming Question Bank www.cranesvarsity.com

60. Which one is equivalent to multiplying by 2: Left shifting a number by 1 or Left


shifting an unsigned int or char by 1?
61. Write a program to compare two strings without using the strcmp () function.
62. Write a program to concatenate two strings.
63. Write a program to interchange 2 variables with & without using the third one.
64. Write programs for String Reversal & Palindrome check
65. Write a program to find the Factorial of a number.
66. Write a program to generate the Fibonacci Series.
67. Write a program to check movement of Knight on a chess board is valid or not?
68. Write a program which employs Recursion.
69. Write a recursive function to calculate Fibonacci series?
70. Write a program which uses Command Line Arguments.
71. Write a program which uses functions like strcmp (), strcpy (), strlen (), strcmp
()? etc
72. Write a program for deletion of a node in doubling Linked List?
73. If array is given like 6, 53, 7, 9, 49, 12, write the output at the end of 3rd loop in
the outer loop in both insertion sort & bubble sort?
74. What are the advantages of using type def in a program?
75. How would you dynamically allocate a one-dimensional and two-dimensional
array of integers?
76. How can you increase the size of a dynamically allocated array?
77. How can you increase the size of a statically allocated array?
78. When reallocating memory if any other pointers point into the same piece of
memory do you have to readjust these other pointers or do they get readjusted
automatically?
79. Which function should be used to free the memory allocated by calloc ()?
80. How much maximum can you allocate in a single call to malloc ()?
81. Can you dynamically allocate arrays in expanded memory?
82. What is object file? How can you access object file?
83. Which header file should you include if you are to develop a function which can
accept variable number of arguments?
84. Can you write a function similar to printf ()?
85. How can a called function determine the number of arguments that have been
passed to it?
86. Can there be at least some solution to determine the number of arguments
passed to a variable argument list function?
87. How do you declare the following:
o An array of three pointers to chars

© Cranes Varsity r2.0v1.0-2014-15 3/ 13


C Programming Question Bank www.cranesvarsity.com

o An array of three char pointers


o A pointer to array of three chars
o A pointer to function which receives an int pointer and returns a float
pointer
o A pointer to a function which receives nothing and returns nothing
88. What do the functions atop (), itoa () and gcvt () do?
89. Does there exist any other function which can be used to convert an integer or a
float to a string?
90. How would you use qsort () function to sort an array of structures?
91. How would you use qsort () function to sort the name stored in an array of
pointers to string?
92. How would you use bsearch () function to search a name stored in array of
pointers to string?
93. How would you use the functions sin (), pow (), sqrt ()?
94. How would you use the functions memcpy (), memset (), memmove ()?
95. How would you use the functions fseek (), freed (), fwrite () and ftell ()?
96. How would you obtain the current time and difference between two times?
97. How would you use the functions randomize () and random ()?
98. How would you implement a substr () function that extracts a sub string from a
given string?
99. What is the difference between the functions rand (), random (), srand () and
randomize ()?
100. What is the difference between the functions memmove () and memcpy ()?
101. How do you print a string on the printer?
102. Can you use the function fprintf () to display the output on the screen?
103. Give the size of int, short int, and long int.
104. Why is the size of far, near and huge pointers different?
105. Stacks, queue, & subroutines their application.
106. How stack can be used to solve postfix expression?
107. Using which tree order of traversal will you convert infix exp to postfix?
108. How to implement a double liked List (structure)?
109. Write an algorithm or program for circular linked list?
110. What is Binary tree & what are its applications.
111. To delete a node from the binary tree, what are the steps that need to be
performed?
112. What is graph & it’s applications
113. How many searching methods do you know? Write a program for Binary search.
114. Write a program for bubble sort, selection sort, shell sort, quick sort.

© Cranes Varsity r2.0v1.0-2014-15 4/ 13


C Programming Question Bank www.cranesvarsity.com

115. Explain the difference b/w const char *p and char *const p.
116. What is the use of volatile key word?
117. What is the use of keyword ‘extern’?
118. How to calculate the efficiency of sorting & searching? Which is efficient?
119. How is Queue implemented?
120. Differences b/w macro & function.
121. Where is a stack used in compilation process?
122. Take 3 nodes and write statements to link these nodes.
123. Explain Sorting techniques.
124. Explain Binary search (algorithm)
125. Explain the C precedence, hierarchy.
126. What is the difference b/w #define and typedef.
127. What is the difference b/w typedef and macros?
128. Subtract 2 no. without using minus (-).
129. Write a program to implement stack.
130. Write a function to find the length of the string without using library functions.
131. Compare 2 strings without using strcmp ().
132. Where do we use union in comparison to structure?
133. Write a strcpy () function in one line?
134. Static member functions.
135. There are n elements in an array .First ‘K’ elements are reversed and then (n-K)
elements are
reversed . After that whole array is reversed. So what will be the pattern?
a) Original array will be reversed.
b) Array will be shifted K times counter clockwise.
c) Array will be shifted K times in clockwise.
d) None of the above

136. If a binary tree has K nodes, two children, L leaves then what will be relation
b/w K & L.
a) (K-L)
b) 2(K-L)

137. If there is a binary tree with three independent node X,Y, Z ,What are the
chances of getting XYZ

In preorder and ZYX in post order traversal.

© Cranes Varsity r2.0v1.0-2014-15 5/ 13


C Programming Question Bank www.cranesvarsity.com

138. If there are two arrays of size ‘m’ and ‘n’ and if they are sorted what will be the
time complexity in merging the arrays.

139. AbCDefg is a strictly binary tree in which capital letters are nodes and small
letters are leaves .so what will be the depth of the binary tree.

140. Which is an efficient data structure to search an element in assorted array of


integers?
a) Stack
b) Queue
c) L-L
d) Array

141. In an unordered ‘n’ element linked list .what is the complexity of insertion &
deletion.

142. How many binary trees can be made from exactly 4 nodes?

143. In an AVL tree what is the average computational complexity.

144. What is the complexity of insertion and deletion in binary tree?

145. What is the complexity of breadth first search algorithm?

146. Elements of an array are 24, 6, 4,1,40. Take ‘6’ as prior element and apply quick
sort on this array.

147. Difference b/w function & macro?

148. What is pre-processor?

149. What is a volatile variable & where its use?

150. Difference b/w extern & static variable?

151. Explain following declarations

int * p ( char* );

int * ( * p )( char * );

int ( * p(char *[3) )[10];

152. Write the no. of clock cycles used to execute the following instruction.
a) CALL 020 Bh

© Cranes Varsity r2.0v1.0-2014-15 6/ 13


C Programming Question Bank www.cranesvarsity.com

b) OUT 20h
c) LXI SP, address

153. How do you compile different .C files, to make one executable file?

154. Difference b/w system calls & library functions?

155. What is the difference b/w static & global?

156. What is the difference b/w auto & register?

157. Size of char*p & int*p?

158. Can a variable declared global be made inaccessible outside a file/module?

159. How do you implement data hiding in C?

160. Write code to delete a node in linked list?

161. a++ ++? What is the output after executing?

162. How will you define a function that accepts variable arguments?

163. Count the number of bits in a character value?

164. Different factors supported by C?

164. Memory structure of C i.e. where the variables are stored?

165. Activation records?

166. Dijkstra’s algorithm?

167. What is the difference b/w static and local variable.

168. What is the computational complexity?

169. Write a program to reverse a given string?

170. What is the difference b/w global static and local static variable?

171. Difference b/w reentrant functions & variable argument functions?

172. Write about different types of bitwise operators.

173. Write the simplest C program?

174. Write a program to delete a node in single linked list?

175. Write a program without using a semicolon to print no. from 0 to 100?

176. What does the function returns by default?

© Cranes Varsity r2.0v1.0-2014-15 7/ 13


C Programming Question Bank www.cranesvarsity.com

177. Write a structure that contains all data types as members .(like int, float, char,
pointer)

178. How would u declare a 2 dimensional array?

179. What happens if u don’t specify the col. Size?

180. How do you insert an element in a linked list? Write the function?

181. How is cursor movement handled in text editor?

182. What happens to the stack when a function call is made?

183. Data segment ,code segment & stack segment?

184. How does stack & heap grow?

185. What are the operations performed on stack?

186. Advantages of using pointers.

187. Can a function be static?

188. What’s difference b/w char a[ ]; & char *p ?

189. Growth of stack and also movement of base pointer when a function is
called_________________

190. Scope and life of extern, static, register, auto?

191. Structure for double linked list?

192. Is it possible to create a pointer to a structure member & how?

193. Write a program for gets ( ) function?

194. Prototype for a function pointer taking arguments as integer pointer and returning
an integer value?

195. Will you be able to free the memory allocated to an array?

196. Write recursive program to reverse a string C?

197. Write a program to pass & return a pointer to function?

198. What will pragma macro will do?

199. What is the difference b/w pointer to function and function pointer?

200. Give memory outline for program.

201. How do you make files in C to do a project?

202. Different types of linkages in C?

203. Where are automatic variables stored & why?

© Cranes Varsity r2.0v1.0-2014-15 8/ 13


C Programming Question Bank www.cranesvarsity.com

204. Write a pointer to integer array array and access the third element?

205. char c=180 , k=-230, How can these be stored in memory?

206. Write a program to access external data from memory?

207. How arguments are pushed in stack?

208. What are the various data specifiers & what is the scope & life of the various data
specifiers?

209. Write a program to implement two dimension array using pointers?

210. Write a program to scan all string until you press enter and display the entered
string?

211. What is a data structure?

212. What does abstract data type means?

213. Evaluate the following prefix expression " ++ 26 + - 1324" (Similar types can be
asked)

214. Convert the following infix expression to post fix notation ((a+2)*(b+4)) -1
(Similar types can be asked)

215. How is it possible to insert different type of elements in stack?

216. Stack can be described as a pointer. Explain?

217. Write a Binary Search program?

218. Write programs for Bubble Sort, Quick sort.

219. Explain about the types of linked lists

220. How would you sort a linked list?

221. Write the programs for Linked List (Insertion and Deletion) operations

222. What data structure would you mostly likely see in a non recursive implementation
of a recursive algorithm?

223. What do you mean by Base case, Recursive case, Binding Time, Run-Time Stack
and Tail Recursion?

224. Explain quick sort and merge sort algorithms and derive the time-constraint
relation for these.

225. Explain binary searching, Fibonacci search.

226. What is the maximum total number of nodes in a tree that has N levels? Note that
the root is level (zero)

227. How many different binary trees and binary search trees can be made from three
nodes that contain the key values 1, 2 & 3?

© Cranes Varsity r2.0v1.0-2014-15 9/ 13


C Programming Question Bank www.cranesvarsity.com

228. A list is ordered from smaller to largest when a sort is called. Which sort would take
the longest time to execute?

229. A list is ordered from smaller to largest when a sort is called. Which sort would take
the shortest time to execute?

230. When will you sort an array of pointers to list elements, rather than sorting the
elements themselves?

231. The element being searched for is not found in an array of 100 elements. What is
the average number of comparisons needed in a sequential search to determine that the
element is not there, if the elements are completely unordered?

232. What is the average number of comparisons needed in a sequential search to


determine the position of an element in an array of 100 elements, if the elements are
ordered from largest to smallest?

233. Which sort show the best average behavior?

234. What is the average number of comparisons in a sequential search?

235. Which data structure is needed to convert infix notations to post fix notations?

236. What do you mean by:

o Syntax Error
o Logical Error
o Runtime Error

How can you correct these errors?

237. In which data structure, elements can be added or removed at either end, but not
in the middle?

238. How will inorder, preorder and post order traversals print the elements of a tree?
Parenthesis are never needed in prefix or postfix expressions. Why?

239. Which one is faster? A binary search of an ordered set of elements in an array or a
sequential search of the elements

240. If a binary tree have K nodes & L leaves then what is the relation b/w them (K&L).

241. Which has a complexity order of O (logN)?

a) Binary tree search

b) LL

c) AVL tree

Continental Company

242. Explain function pointers in c programming? Write a program to demonstrate


function pointers?

© Cranes Varsity r2.0v1.0-2014-15 10/ 13


C Programming Question Bank www.cranesvarsity.com

243. How is function pointers advantageous compared to switch case?

244. What is the difference between structures and unions?

245. Explain bit fields in c programming?

246. What is function prototype?

247. What is the difference between function definition and function declaration?

248. What is stack? How is stack implemented using linked lists? Give the application of
stacks?

249. Difference between malloc and calloc?

250. Explain function pointers in c programming?write a program to demonstrate


function pointers?

251. How is function pointers advantageous compared to switch case?

252. what is the difference between structures and unions?

253. Explain bit fields in c programming

254. What is function prototype?

255. What is the difference between function definition and function declaration?

256. What is stack? How is stack implemented using linked lists? Give the application of
stacks?

257. Difference between malloc and calloc

258. What is the internal ram and rom of 8051 microcontroller?

259. What are the types of interrupts?

260. Name different types of addressing modes? explain in detail register addressing
mode and indirect addressing mode?

261. Explain special function registers?

262. What is flip flop? What are its applications?

263. How many flip flops are required for mod-12 counter?

Huawei

264. WAP to implement linked list in a queue?

265. WAP to find 2nd highest and 2nd lowest element of an integer array.

267. Write a function to find the index of a substring in the main string?

© Cranes Varsity r2.0v1.0-2014-15 11/ 13


C Programming Question Bank www.cranesvarsity.com

268. WAP to calculate x to the power of n, where n is an integer, x and result should be
float?

269. Write a program to get a string from user and using a child function calculate the
string length and print the same in the main function. The child function should not
return anything and global variable are not supposed to be used.

270. Write a program to get a string from the user and print only the consonants in
them.

© Cranes Varsity r2.0v1.0-2014-15 12/ 13


C Programming Question Bank www.cranesvarsity.com

© Cranes Varsity r2.0v1.0-2014-15 13/ 13

You might also like