211 Revision
211 Revision
First name_____________________________________
Surname______________________________________ ID:________________________
Please don’t forget to write down your programme, otherwise your paper can easily get lost.
2. A compiler is
b. a programming language
c. a computer program
d. A machine code
3. Which of the following is not a procedure needed to solve a problem, before writing a C
program?
a. Algorithm
b. Flowchart
c. Piechart
d. Pseudocode
Page 1 of 1
4. Which of the following statements is false about an algorithm?
b. An algorithm is a computer
a. printf()
b. scanf()
c. get()
d. scan()
6. What is a flowchart?
b. a C program code
d. a C++ code
a. Input
b. Processing
c. Output
d. Decision
d. Once the pseudo code is verified, it can be converted into a program using vocabulary
and syntax
Page 2 of 2
a. A variable is any combination of 1 to 31 alphabets, digits or underscores
a. Hou_se
b. 2house
c. -house
d. Ho use
a. Arithmetic Operators
b. Logical Operators
c. Decimal Operators
d. Relational Operators
a. &&
b. !
c. ||
d. ==
a. 5
b. 3
c. 8
d. 9
int x = 3;
y=x>1?3:4
Page 3 of 3
a. 3
b. 4
c. 2
d. 5
15. What does the expression a%b evaluate to given a=3 and b= 2?
a. 1.5
b. 12
c. 1
d. 0
a. 4
b. 0
c. 1
d. 2
}
a. a is big
d. b is big
Page 4 of 4
void main()
{
int i;
printf(“The output values are\n”);
for(i=1;i<=5;i++)
{
printf(“%d”,i);
}
}
a. 1
b. 12345
c. 54321
a. A function is a self contained block of statements that perform a coherent task of some
kind
20. What is the output of the following code given that the user input the value of n as 3.
#include<stdio.h>
void main()
{
int i,n;
printf(“Enter the values for range”);
scanf(“%d”,&n);
i = 1;
while(i<=n)
{
printf(“%d”,i);
i = i +2;
}
}
Page 5 of 5
a. 123
b. 1 3
a. true
b. false
22. Which line of code in the C code below represents a function call?
Page 6 of 6
b. int d;
c. Return(d);
d. sum=calsum(a,b,c)
23. What is the output of the C code in question 22 given that the values of a=1,b=2 and c=3?
sum value = 6
24. What is the output of the following code if a=4 and b=6?
#include<stdio.h>
int sum(int a, int b);
void main() {
int a,b,x;
printf(“Enter the two integers”);
scanf(“%d%d”,&a, &b);
x=sum(a,b);
printf(“The sum of the numbers you entered is %d”, x);
}
return (a+b);
Page 7 of 7
}
a. Enter the two integers The sum of the numbers you entered is 10
b. Enter the two integers The sum of the numbers you entered is, 10
a. No return , No parameters
26. What is the output of the following code given a=2 and b=4?
#include<stdio.h>
Page 8 of 8
a. enter the value of a and b, the final value = 6, enter the value of a and b, the final value = 8
c. enter the value of a and b the final value = 6 enter the value of a and b the final value = 8
e. No return , No parameters
Page 9 of 9
a. Compiler defined and program defined
i. Writing function avoids rewriting the same code over and over
j. Using functions, it becomes easier to write programs and keep track of what they are
doing
#include<stdio.h>
void rect();
void main() {
int k;
k=rect();
printf(“area of rectangle is = %d”,k);
void rect()
{
int l,b,a;
l=2;
b=8;
a=l*b;
return (a);
}
b. Area of rectangle is = 16
c. area of rectangle is = 16
Page 10 of 10
d. area of rectangle is =
16
Page 11 of 11