C Programming Questions and Answers

Unit 1: Basics of C

Question: Give some distinctive features of 'C' which states it to be a structured programming. What are the differences between a low level, a middle level and a high-level language? Answer

Question: Give the syntax and examples of usage of scanf() and printf(). Answer

Question: What are the different types of errors in C? Explain with examples. Answer

Unit 2: Variables and Constants

Question: Define the term 'variable'. What are the rules to be followed to name a variable in "C"? Write the syntax to declare a variable and also mention how to assign values to it (initialize them). Answer

Question: Name different categories of constants in C language. Answer

Question: What are different basic data types in C? Explain the need of different numeric data types with example of each. Answer

Unit 3: Expressions and Operators

Question: Explain different arithmetic, logical and relational operators in C, with the help of examples. Answer

Question: Explain comma and conditional operator in C language with examples. Answer

Question: Explain type cast and size of operator in C language with example. Answer

Question: Give the precedence chart for the operator in 'C'. Answer

Unit 4: Decision and Loop Control Statements

Question: Explain the following with the help of a suitable example for each:
(i) if statement
(ii) if..else statement
(ii) nested if statement
(iii) switch statement Answer

Question: Explain with example different types of Loops in C language. Answer

Question: Write a program and flowchart that asks the user to enter a number and prints its factorial. Answer

Question: Write a program and draw corresponding flow chart to check whether the given number is prime or not. Answer

Question: Write a program and draw corresponding flow chart to find the HCF of two numbers. Answer

Question: Write and explain the use of break and continue statement in C with an example of each. Answer

Unit 5: Functions

Question: What is function in C? What are the advantages of using function? Answer

Question: Write and explain the following types of functions with the help of an example program for each :
(i) Function with no arguments and no return value.
(ii) Function with arguments and no return value.
(iii) Function with no arguments and with return value.
(iv) Function with arguments and with return value.
Answer

Question: Explain various storage classes in 'C'.Answer

Question: Differentiate between local variable and global variable.Answer

Question: Differentiate between formal parameter and actual parameter.Answer

Question: What is recursion? Write down a recursive function in 'C' to calculate the factorial of a given number.Answer