C Programming Question Bank 1, 2 & 3 PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document appears to be a collection of C programming questions and problems from different modules. It includes examples of C code and exercises focusing on various aspects of C programming, covering topics such as algorithms, operators, loops (while, for), arrays, and conditional statements (if-else). The questions are designed for practice, providing opportunities for learners to test their skills and understanding of the C programming language.
Full Transcript
Description: C:\\Users\\NALINAKSHI N\\AppData\\Local\\Packages\\Microsoft.Windows.Photos\_8wekyb3d8bbwe\\TempState\\ShareServiceTempFolder\\Logo 1 (1).jpeg **INTRODUCTION OF C PROGRAMMING** **QUESTION BANK 1** MODULE 1 1. Give the basic structure of C program and explain briefly about each...
Description: C:\\Users\\NALINAKSHI N\\AppData\\Local\\Packages\\Microsoft.Windows.Photos\_8wekyb3d8bbwe\\TempState\\ShareServiceTempFolder\\Logo 1 (1).jpeg **INTRODUCTION OF C PROGRAMMING** **QUESTION BANK 1** MODULE 1 1. Give the basic structure of C program and explain briefly about each section. 2. Define an algorithm. Develop an algorithm to find the simple interest and amount. 3. Develop a C Program to calculate and display the area, perimeter and volume of a CUBE 4. Explain the different operators in C with appropriate examples. 5. Write a C program to perform the following arithmetic operations on two numbers input by the user: addition, subtraction, multiplication, division, and modulus. The program should display the results of each operation. 6. Write the output for the following If a=8, b=15 and c=4 calculate the expression i. 2 \* ( ( a % 5 ) \* ( 4 + ( b -- 3 ) / ( c + 2 ) ) ) ii. a += b \*= c -=5 7. Find the output of the following. i. \#include\ printf(\"\--b = %d \\n\", \--b); printf(\"d\-- = %d \\n\", d\--); return 0; **ii)** \#include\ int main() { int a = 12, b = 10; printf(\"Output = %d\", a&b); printf(\"Output = %d\", a\|b); printf(\"Output = %d\", a\2) return 0; } 8. Develop a C Program to compute: Area of triangle with base and height as input 9. Evaluate the following expressions: i\) 22 + 3 \< 6 && !5 \|\| 22 = =7 && 22 -- 2 \> +5 ii\) a + 2 \> b \|\| !c && a = = d \*a -- 2 \< = e Where a=11, b=6, c=0, d = 7 and e=5. 10. What are the different data types available in C? Develop a program to explain the data types in C. 11. Describe the process of compiling and running a C program. 12. Develop a flowchart to find the area and perimeter of a circle 13. Explain the operator precedence rules in C. Provide examples. 14. Explain the various programming paradigms with examples. 15. Explain the various features of the C language. Discuss its importance as a structured programming language. 16. Develop a C program to demonstrate the use of preprocessor directives such as \#define and \#include. 17. Explain the different types of operators in C, including examples for conditional and bitwise operators. 18. What are formatted and unformatted input/output functions? Write a program to demonstrate the usage of getchar() and putchar(). 19. Develop a simple calculator program in C to perform arithmetic operations +, -, \*, /, %. **MODULE 2** 1. Explain switch statements with syntax, Flowchart and example. 2. Develop a program to compute the grade of students using an if else adder. The grades are assigned as followed: ![](media/image2.png) 3\. Develop a C program to find the largest of two Number using Conditional Operator. 4\. Write a program to print the following pattern. \*\*\*\* 5\. Explain the while loop with flowchart, syntax and example 6\. Write a program using for loop to calculate factorial of a number. 7\. Explain the **for** loop with flowchart, syntax and examples. 10\. Compare while and do-while looping statements with example. 11\. Write a C-Program to find factorial of a number. 12\. Write a C program to test whether a given number is +ve, -ve or equal to zero. 13\. Develop a C program to check whether a given number is palindrome or not. 14\. Compare the break and continue statements. Provide suitable examples to show their differences. 15\. Write the syntax for switch case statement. Develop C Program for arithmetic operations using switch case statement. 16\. Develop a C program to generate all the prime numbers between 1 and n is a value supplied by user. 17\. Explain the concept of decision-making in C. Discuss the working of the simple if statement with an example. 18\. Develop a program to demonstrate its usage. Explain the significance of the go-to statement in C. 19\. Develop a C program using the for loop to calculate the sum of even numbers from 1 to 100. 20\. Compare the for and while loops. Write a program to find the factorial of a number using a while loop. 21\. What is a conditional operator (?:) ? Explain its usage with a program to find the largest of three numbers. 22\. Develop a program to check whether a given number is prime or not using loops. **MODULE -3** 1. Write a C program to reverse the elements of the array of integers. 2. Write a C program to input n elements of an array and find the sum of all elements. 3. Explain the declaration, initialization and 2-Dimensional array with examples. 4. Write a C program to display the transpose of matrix. 5. Write a C program to read and find the sum of diagonal elements 6. What is an Array? Explain the declaration and initialization of one-dimensional array with example. 7. Write a C-program to read and display the elements of an array of integer. 8. Write a C program, read the elements of a matrix and print those elements. 9. Develop a C program, add elements of 2 Matrix and display the resultant matrix. 10. Determine the elements of the array after executing the following instructions a)int marks\[5\]={90,45,67,85,78};What are the index value of each elements of array? b)int marks \[5\]={90,45}; What are elements in array named marks? c)int marks \[5\]={0}; What are elements in array named marks? d\) int marks \[3\]={10,20,30,40}; Identify the error in the instruction and display the correct instruction. 13. Illustrate the different ways of initializing arrays with example. 14. Develop a C program to declare and initialize an integer array of size 10 and display its elements. 15. Explain the difference between arrays and normal variables with an example. 16. Differentiate between static and dynamic arrays. Illustrate static arrays with an example program. 17. Discuss the concept of nesting if statements with an example. How can multiple conditions be checked using nested if-else statements? 18. Write a program to find the second largest element in a given array. 19. What is the switch statement? Discuss its syntax, how it works, and give an example of its usage to display the name of the month based on the month number. 20. Explain how arrays are stored in memory. Discuss the concept of indexing in arrays. 21. Develop a C program to exit a loop when a specific number (e.g., 7) is entered using a break statement.