Professional Documents
Culture Documents
PART – A (7 x 2 = 14 Marks)
Max. CO-Bloom’s
Q.No Question KC PI
Marks Level
Algorithm and
flowcharts help us to create new
programs, specifically in
1. 02 CO1-K2 CONCEPT 1.3.1
computer programming. These
tools are very helpful for
02 PROCEDU
2. Step 3 - if n%2==0 then the CO1-K2 3.2.2
RE
number is even.
Step 1: Start
#include <stdio.h>
int main() {
4. PROCEDU
char c = 97; 02 CO2-K3 3.2.2
RE
sizeof(i), sizeof(c));
return 0;
ANS: 2, 1, 1981033920
#include <stdio.h>
int main() {
return 0;
Ans:16
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,f=1;
clrscr();
scanf("%d",&n); PROCEDU
6. 02 CO2-K2 3.2.2
RE
//LOOP TO CALCULATE
FACTORIAL OF A NUMBER
for(i=1;i<=n;i++)
{
f=f*i;
}
getch();
#include<stdio.h>
int main() {
int n;
printf("Enter a positive
integer: ");
scanf("%d",&n);
printf("Factorial of %d =
%ld", n, multiplyNumbers(n)); PROCEDU
7. 02 CO3-K2 3.2.2
RE
return 0;
if (n>=1)
return
n*multiplyNumbers(n-1);
else
return 1;
PART – B (2 x 13 = 26 Marks)
CO-
Max.
Q.No Question Bloom’s
Marks
Level
#include <stdio.h>
int main()
scanf("%d", &num1);
scanf("%d", &num2);
scanf("%d", &num3);
return 0;
Output:
Algorithm
Step 1: Start
Step 6: increment i
Step 8: Stop
Output: sum
#include<stdio.h>
int main() {
(ii) // Read n 6 CO1-K2 PRO
int n;
scanf("%d", &n);
int sum = 0;
int i = 1;
for(i=1;i<=n;i++){
sum = sum + i;
}
return 0;
(OR)
8 (b) (i)
7 CO1-K2 PRO
#include <stdio.h>
void main()
int tmp;
printf("Input days temperature :
");
scanf("%d",&tmp);
if(tmp<0)
else if(tmp<10)
printf("Very cold
weather.\n");
else if(tmp<20)
printf("Cold
weather.\n");
else if(tmp<30)
printf("Normal in
temp.\n");
else if(tmp<40)
printf("Its
Hot.\n");
else
printf("Its
very hot.\n");
Output:
Write a C program to
b) #include <stdio.h>
int main() {
int i, n;
int t1 = 0, t2 = 1;
scanf("%d", &n);
t1 = t2;
t2 = nextTerm;
nextTerm = t1 + t2;
return 0;
}
1. c) #include<stdio.h>
2. int main()
3. {
4. int n,sum=0,m;
5. printf("Enter a number:");
6. scanf("%d",&n);
7. while(n>0)
8. {
9. m=n%10;
10. sum=sum+m;
11. n=n/10;
12. }
13. printf("Sum is=%d",sum);
14. return 0;
15. }
d) /**
*/
int main()
int arr[MAX_SIZE];
scanf("%d", &size);
scanf("%d", &arr[i]);
max = arr[0];
min = arr[0];
/*
*/
max = arr[i];
/* If current element is
smaller than min */
min = arr[i];
printf("Maximum element =
%d\n", max);
printf("Minimum element = %d",
min);
return 0;
(OR)
#include<stdio.h>
int main()
int i,j,k;
for(i=0;i< 3;i++)
for(j=0;j< 3;j++)
printf("a[%d][%d]=",i,j);
scanf("%f", &a[i][j]);
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
scanf("%f", &b[i][j]);
for(i=0;i< 3;i++)
for(j=0;j< 3;j++)
mul[i][j] = 0;
for(k=0;k< 3;k++)
for(i=0;i< 3;i++)
for(j=0;j< 3;j++)
printf("%f\t", mul[i][j]);
printf("\n");
return 0;
}
Write a C program to perform
b. transpose of a matrix
a) #include<stdio.h>
#include<conio.h>
int main()
scanf("%d",&mat1[i][j]);
scanf("%d",&mat2[i][j]);
mat3[i][j]=mat1[i][j]+mat2[i][j];
printf("%d ",mat3[i][j]);
printf("\n");
getch();
return 0;
b) #include<stdio.h>
#include<conio.h>
int main()
scanf("%d", &mat[i][j]);
matTrans[j][i] = mat[i][j];
{
for(j=0; j<3; j++)
printf("\n");
getch();
return 0;
PART – C (1 x 10 = 10 Marks)
Q.No Question
b) #include <stdio.h>
return (x * y);
int main(){
int a, b, prod;
scanf("%d", &a);
// Displaying result
return 0;
// Create a function
void myFunction() {
int main() {
return 0;
}
10 (a) (i)
A function consist of two parts:
void myFunction() { // declaration
#include <stdio.h>
void main()
int x=10,y=7;
printf("x-y = %d",res);
}
#include<stdio.h>
int main()
int sum();
int c = sum();
printf("Sum = %d",c);
int x=10,y=20,z=5;
printf("x = %d ; y = %d ; z = %d \n",x,y,z);
return(sum);
}
Write the sum of digits program in c language by
the help of loop and mathematical operation only.
1. #include<stdio.h>
2. int main()
3. {
4. int n,sum=0,m;
5. printf("Enter a number:");
6. scanf("%d",&n);
7. while(n>0)
8. {
9. m=n%10;
10. sum=sum+m;
11. n=n/10;
12. }
(ii)
13. printf("Sum is=%d",sum);
14. return 0;
15. }
Output:
Enter a number:654
Sum is=15
Enter a number:123
Sum is=6
(OR)
1. #include<stdio.h>
2.
3. void swap(int, int);
4.
5. int main()
6. {
7. int a, b;
8.
9. printf("Enter values for a and b\n");
10. scanf("%d%d", &a, &b);
11.
2. printf("\n\nBefore swapping: a = %d and b = %d
\n", a, b);
13.
14. swap(a, b);
10 (b) (i)
15.
16. return 0;
17. }
18.
19. void swap(int x, int y)
20. {
21.
22.
23. x=x+y;
24. Y=x-y;
25. X=x-y;
26.
27.
8. printf("\nAfter swapping: a = %d and b = %d\n",
x, y);
29. }
#include <stdio.h>
int main()
{
int c = 0, count = 0;
char s[1000];
printf("Input a string\n");
gets(s);
while (s[c] != '\0') {
if (s[c] == 'a' || s[c] == 'A' || s[c] == 'e'
|| s[c] == 'E' || s[c] == 'i' || s[c] == 'I' ||
s[c] =='o' || s[c]=='O' || s[c] == 'u' || s[c] == 'U')
count
++;
c++;
}
(ii)
printf("Number of vowels in the string: %d", count);
return 0;
1. B)
2. #include <stdio.h>
3. #include <string.h>
4. int main()
5. {
6. char str[40]; // declare the size of character stri
ng
7. printf (" \n Enter a string to be reversed: ");
8. scanf ("%s", str);
9.
10. // use strrev() function to reverse a string
11. printf (" \n After the reverse of a string: %s ", str
rev(str));
12. return 0;
13. }
Competency Level Analysis:
Revised Blooms‘
Question No. Marks Contribution in %
Taxonomy
Remember
Analyze
Evaluate
Create
Total 86 100
Staff-In ChargeSM-MemberHOD