Question Bank-Module1 2
Question Bank-Module1 2
(MODULE 1)
include(stdio.h)
int main()
{
int a,b,c
printf(“Enter the value for a,b,c”);
scanf(“%f %c”, a,b,c)
c=a+b
Printf(“the value of c is %d”, c);
return 0;
}
16. Write a C program to swap two numbers: i) without using temporary variable ii) using
Temporary variable.
QUESTION BANK
(MODULE 2)
1.What are operators? Explain types of operators supported in C language with example.
2. What is type conversion? Explain two types of type conversions with examples.
3.What is the value of “x” in following code segment? Justify your answer:
i) int a, b;
float x;
a=4;
b=5;
x=b/a;
ii) int a, b;
float x;
a=4;
b=5;
x=(float)b/a;
4. Write a C program that computes the sizeof (Basic Data Types) int, float, double and char
variable.
5.Write the output for the below code:
#include<stdio.h>
int main()
{
int p,q,a,b,c,d,e,f
p=4;
q=2;
a=p/q + p%q;
printf(“the value of a=%d\n”,a);
b= p&&q || p>q;
printf(“the value of b=%d\n”,b);
c=p & q;
printf(“the value of c=%d\n”,c);
d= p>q? p:q;
printf(“the value of d=%d\n”,d);
e= ++p - q - - ;
printf(“the value of e=%d\n”,e);
f= sizeof(p);
printf(“the value of f=%d\n”,f);
return 0;
}
6. Write a C program to find the area of triangle.
7. Write a C program to find the area and perimeter of rectangle.
8. Write a C program to input three numbers and print the largest of three numbers.
9. Write a C program to compute simple interest and display the result.
10. Write a C program to compute area and circumference of a circle.
11.Write the algorithm and flowchart to find area of triangle.
12.What are different types of conditional branching statements? Explain each with syntax and
suitable example program.
13.Illustrate how break and continue statements are used in C with example program.
14.What are unconditional statements (jump)?Explain working of goto statement with example.
15.Write a C program to simulate simple calculator that perform arithmetic operation using
switch case. Error message should be displayed, if any attempt to make to divide by zero.
16.Write a C program to check whether the given alphabet is vowel or not using switch case.
17.Write a C program to check if a number is even or odd
18.Write a C program to check if the year is a leap year or not
19.Write a C program to check whether a character is a vowel or consonant
20.Write a C program to Findthe roots of a quadratic equation
21.Write a C program to perform simple arithmetic operation using switch-case statement
22.Write differences between entry-controlled loop and exit controlled loop.
23.Explain different types of loops with syntax and example.
24.Write a C program to find factorial of a number
25.Write a C program to find sum of digits of a number
26.Write a C program to display Fibonacci series
27.Write a C program to find HCF of two numbers
28.Write a C program to find LCM of two numbers
29.Write a C program to count number of digits of an integer
30.Write a C program to find the sum of N natural numbers
31.Write a C program to generate multiplication table.
32.Design & develop C program to find the square root of given number ‘n’ without using
library function sqrt(n).
33.Write the algorithm and flowchart to check a given number +ve , -ve or Zero and display the
message accordingly
34.Write a C program to check whether given number is prime or not.
35. Write the algorithm and flowchart to check a given number +ve , -ve or Zero and display the
message accordingly.
36.. Write a C Program to display the following pattern by reading the number of rows as input.
1
1 21
1 2 321
1 2 34321
n th row