Model Test Question Paper 2
Model Test Question Paper 2
PART-A
Sl No Marks CO BT PO PI
L CODE
1.1 1 1 1 1 1.6.1
_______ Phase is also called construction or code generation
phase.
1.2 1 1 1 1 1.6.1
C programs are converted into machine language with the help of
_________.
1.3 1 1 1 1 1.6.1
The size of integer variable in C is _____________.
1.4 1 1 1 1 1.6.1
Identify the program that combines object modules to form an
executable program.
1.5 What is the output of the following code? 2 2 2 2 2.5.2
#include<stdio.h>
int main()
{
int a=1, b=2, c=3, d=4, e=5, res;
res = a + b / c – d * e;
printf(“\n Result = %d”, res);
res = (a + b) / c – d * e;
printf(“\n Result = %d”, res);
res = a + (b / (c-d)) * e;
printf(“\n Result = %d”, res);
return 0;
}
#include<stdio.h>
int main()
{
int x=10, y=20, res;
res = y++ + x++;
res += ++y + ++x;
printf(“\n x = %d y = %d RESULT = %d”, x,y, res);
return 0;
}
1.7 If an array is declared as arr[] = {1,3,5,7,9}; then what is the value 1 2 2 2 2.5.2
of sizeof(arr[3])?
1.8 Differentiate loop regulating statement break from continue. 2 1 1 1 1.6.1
1.9 The memory address of the first element of an array is called 1 1 1 1 1.6.1
__________.
1.10 Name the function which returns the int type value of a string 1 1 1 1 1.6.1
passed to it.
1.11 What is the return value when the instruction 1 2 3 2 2.5.2
y=strcmp(“ABC”,”abc”); is executed?
1.12 The parameters passed to function are called _____________ 1 1 1 1 1.6.1
parameters.
1.13 The life of _____________ variable declared in a function ends 1 2 1 1 1.6.1
when the function is exited.
1.14 What is the use of structure? 1 2 3 2 2.5.2
1.15 What is the purpose of specifying data type for a pointer variable? 1 2 3 1 1.6.1
1.16 What is the output of the following code? 2 1 3 2 2.5.2
int main()
{
struct tree
{
int h;
int b;
}
struct tree tree1;
tree1.h=10;
printf("Height=%d, Width=%d\n",tree1.h,tree1.b);
return 0;
}
PART-B
2 a. What is the use of writing an algorithm? Explain the control 8 1 1 1 4.1.1
structures which can be employed by algorithms with example for
each.
b. With a neat diagram explain the working of a Processor in a 8 1 1 1 1.7.1
computer system.
******
*RVCE*
******
b. Write a program to count the total number of nonzero elements in a 6 3 3 3 3.7.1
two-dimensional array and add a brief note on logic.
c. Identify errors, correct them in the following program, rewrite and 4 2 4 2 2.8.2
mention the output of the corrected program.
#include<stdio>
int main([])
{
int i,c, n=4;
char vowels[5]={'a','e','i','o','u'}
for(i=n;i>=0:i- - )) {
c=(int) vowels[i]-32
printf(‘ "\t%c",c);
}
return 0;
}
}
OR
6 a. Write a program to compute and print the electricity bill as per the 6 3 3 4 4.5.1
rates given in the following table according to the units consumed.
Units Rate(Rs)
200-500 3.50/unit +
30
100-200 2.50/unit +
40
b. Write a program that reads an array of 100 integers. Then display all 6 2 3 3 3.6.2
the pairs of elements in the array whose sum is 50.
c. Compare the following code snippets and mention both are finite 4 2 4 2 2.7.1
loops or infinite loops or both are different loops and add a note on
the logic of any one code snippet.
#include<stdio.h> #include<stdio.h>
int main(){ int main(){
int i,j; int i=0,j=5;
sectionA: for (;;)
for {
(i=0,j=5;i<5,j>=0;i++,j--) printf("d
{ %d",j,i);
printf("%d %d",j,i); i++;
goto sectionA; j--;
} }
} }
9a. Write a C program to add two complex numbers using structures. 8 2 3 1 1.6.1
Explain the concept of structures within structures with the help of an 8 4 2 2 2.5.2
b.
example.
OR
10 With the help of pointers, write a C program to add two numbers. 6 2 3 2 2.5.3
a.
Explain the concept of pass by value and pass by reference with 10 1 2 1 2.5.2
b. example.