ASSIGNMENT 2 UNIT AND 3 UNIT
1. Define all Arithmetic operators.
2. Explain the need of break in switch statement with example.
3. Write the syntax of continue statement.
4. What is the difference between while and do-while loop?
5. What do you mean by Operands? Discuss the operator precedence and associativity of all the operators.
6. Define recursive function? Write a program to find the factorial of a number with recursive function.
7. Write a program to find out the greatest number out of three numbers.
8. Explain different type of control statements used in c programming with example.
9. Write a program to print the pattern:
****
***
**
*
10. Write a Program to find the entered number is Palindrome number or not.
11. What is the output of the following code?
int a = 6;
b = ++a + a++ - a;
printf(“a=%d, b=%d”,a,b);
12. What is the difference between & and && operators?
13. Write a program in C to check whether the sum of individual digits of a number is even or odd.
14. Define looping and write a program in C to print the following pattern
54321
5432
543
54
5
15. Differentiate between while and do while and write a program to check whether a number is prime or not.
16. Write down the output of following code.
#include
int main()
{
int a=23;
printf("%d",a);
return 0;
}
17. Write down the output of following code.
#include
int main()
{
int a = 5;
a = 1, 2, 3;
printf("%d", a);
return 0;
}
18. Write the use of continue statement
19. What is the difference between entry control loop and exit control loop?
20. Write short note on array. Write the program for matrix multiplication of two matrix elements.
21. Write a program to find out the greatest number out of three numbers
22. Explain different type of operators in C programming. Which concept makes the difference between operators
when precedence is same?
23. Write a program to print the pattern
1
23
456
7 8 9 10
24. Find the output of the following code:
void main()
{
int x=3 , y = 4 , a=6 , z=7,result ;
result = (x>y) + ++a || !c ;
printf(“%d”, result);
}
25. Write limitations of switch case.
26. Show the usage of break statement.
27. Differentiate between scope and lifetime of variable.
28. Write limitations of subscript operator in an array
29. Differentiate between type conversion and typecasting. Write a program to input a floating-point number and
find leftmost digit of integral part of a number.
30. Write a program to find the sum of series using function 1! + 2! + 3! + 4! +----------- n terms.
31. Explain Logical, Unary and Bitwise operators in detail.
32. Compare if-else-if ladder and switch case. Write a menu driven program to perform basic functions of calculator.
33. Describe the use of logical AND and logical OR operators in C with example.
34. Write a program to print the following pattern.
1
22
333
4444
35. Write a Program to print the all prime numbers between 1 to 500.
36. Write a program to find maximum and minimum element of an array
37. Write a program to find the number of vowels in a string.
38. Find the output:
#include
int main()
{
int a=100;
printf("%d\n"+1, a);
printf("Value is = %d"+3, a);
return 0;
}
39. Find the output: #include
int main()
{
int arr[1]={10};
printf("%d\n", 0[arr]);
return 0;
}
40. Illustrate the concept of type conversion and type casting with program.
41. Write a program to print the pattern
1
12
123
1234
123
12
1
42. Write a Program for pattern
*****
****
***
**
*
**
***
****
*****
43. Write the advantage of using array. Write the program for matrix multiplication of two matrix elements.
44. What are the merits and demerits of array?
45. Differentiate between GUI and CUI.
46. Evaluate the expression a&b when a = 121 and b = -15
47. Draw flowchart to check number is positive, negative or equal to zero.
48. Explain the different way to initialize the 2-D array. WAP in C to subtract two matrices.
49. The marks obtained by a student in 5 different subjects are input through keyboard. The student gets a division as
per the following rules:
Percentage >=60 – First Division
Percentage greater than or equal to 50 and less than 60 – Second division
Percentage greater than or equal to 40 and less than 49 – Third division
Percentage less than 40 – Fail
Draw a flow chart and Write a program to calculate the division obtained by the student.
50. What do you mean by two-dimensional array? Write a program for multiplication of two matrices of size 3 X 3
using functions.
51. Explain ternary operator in C with example.
52. Write a program in C that computes the area of different shapes such as Circle, Rectangle, and Square&
Triangle.