Professional Documents
Culture Documents
Assessment Pattern
Remember Understand Apply Analyze Evaluate Create Total
10 10 30 - - - 50
B2. main( ) CO 1.
{
float a = 13.5 ;
float *b, *c ;
b = &a ; /* suppose address of a is 1006 */
c=b;
printf ( "\n%u %u %u", &a, b, c ) ;
printf ( "\n%f %f %f %f", a, *(&a), *b, *c ) ;
}
B3. main() CO 1
{
Page 1 of 3
int n[3][3]={2,4,6,8,10,1,3,5,7}
printf(“%u %u %u”, n, n[2], n[2][2] );
}
B4. main() CO 1
{
int arr[ ]={0,1,2,3,4};
int *ptr;
for(ptr=arr+4;ptr>=arr; ptr- -)
printf(“%d \n”, arr[ptr-arr]);
}
B5. main() CO 1
{
int a=3, b=2, c=1, d;
d=a|b&c;
printf(“d=%d\n”,d);
d=a&b|c;
printf(“d=%d\n”,d);
}
(OR)
C2. Develop an algorithm to find the sum of the digits of a given number and CO 2
implement it using recursive function.
C3. Develop an algorithm, draw flowchart and write a program to process a 4×4 CO 2
matrix as given below.
(i) Interchange column1 and column 4
(i) interchange row3 and row4
and print the resultant matrix.
(OR)
C4. Given two ordered sets A and B with n and m elements respectively, CO 2
develop an algorithm to find the intersection of two sets and implement it
using any high level language. For example, if we have
A[5] = {2, 5, 7, 8, 12};
B[6] = {1, 2, 5, 12, 15, 20};
then C[9] = {2, 5,12}.
C5. Write a function that computes and returns the dot product of two vectors. CO 5
The dot product of two vectors a = [a0, a1, … , an-1] and b = [b0, b1, … , bn-1] is
Page 2 of 3
n−1
a⋅b= ∑ ai bi =a0 b0 +a1 b 1 +¿⋅¿⋅+a n−1 bn−1
defined as: i=0
OR
C6. Assume we are given some terrain data represented by a two-dimensional CO 5
array A[5][5], where each cell of the array is an integer number denoting the
elevation at that position. Develop an algorithm to determine the peak
values and its position. Implement the algorithm for an N*N matrix.
Note: A cell A[i][j] is considered having peak value, if A[i][j] is greater than
all of its neighborhood cells. Note that boundary cells do not have 8
neighbors, so we will not consider them.
[ ]
1 5 9 2 9
4 1 7 10 3
A= 5 15 8 6 2
12 7 9 1 10
3 5 8 9 1
e.g
o/p: peak value:10 position: A[2][4]
peak value: 15 position: A[3][2]
Page 3 of 3