(MODEL PAPER)
FIRST TERMINAL EXAMINATION
STD: XI MARKS: 60
SUBJECT: COMPUTER SCIENCE (H-4705)
TIME DURATION: 150 MIN
INSTRUCTIONS:-
(i) All questions are compulsory.
(ii) Programs should be written in Language C only.
(iii) State your assumptions clearly.
(v) Total Number of questions is 31.
(vi) There is no overall choice, however there is an internal
choice for question number 29,30 and 31.
(vii) Figures to the right indicate full mark.
1 Write the correct alternative from those given below: 1
Number with power 2 such as 32, 16, 4, 2, 1 are represented in the
form of binary integers as
• 110100
• 111110
• 110111
• 110110.
2 Write the correct alternative from those given below: 1
First step in process of problem solving is-------
• Design a solution
• Define a problem
• Testing
• Coding
3 Write the correct alternative from those given below:- 1
What is the output of the following C program
#include<stdio.h>
int main()
{
int var=052;
printf(“%d”,var);
return 0;
}
• 52
6 | Page
• 42
• 56
• Compiler error.
4 Write the correct alternative from those given below: 1
What is the output of the following C program fragment?
int a=1;
int b=1;
int c=++a || b++;
int d=b-- && --a;
printf(“%d%d%d%d”,a,b,c,d);
• 1111
• 0100
• 1001
• 1101
5 Write the correct alternative from those given below: 1
Sizeof operator return size in--------
⚫ Bits
⚫ Bytes
⚫ Megabytes
⚫ kilobytes
6 ASCII decimal range of characters from A….Z is? 1
⚫ 65-90
⚫ 97-122
⚫ 100-127
⚫ 1-28
7 Write the correct alternative from those given below: 1
What is the output of the following C program fragment?
int a=0,b=0;
int c=a++ + b++ + ++a;
int d=++a + ++b + c++;
printf("%d %d %d %d",a,b,c,d);
• 3237
• 3216
• 3326
• 3232
8 Convert the following algebric expression to C expression 1
(𝑎 + 𝑏)
(𝑎 − 𝑏)2
9 Define the term Keyword? 1
10 What is the purpose of comment statement in C language? 1
11 What is the difference between = and = = operators in C programming? 1
7 | Page
12 What is the significance of declaring a variable as an unsigned? 1
13 What extra step need to take to form the 2's complement of a negative 1
binary number?
14 What is Flowcharting? Draw different symbols used in flowcharting to 2
represent steps.
15 State two points of difference between compiler and interpreter. 2
16 Write any four rules of defining variables in C programming 2
Language?
17 Write any two header files with their purpose used in C programming 2
Language.
18 List Logical And Unary operators in C programming Language. 2
19 Any year is entered through the keyboard, write a C program to 2
determine whether the year is leap year or not. Use the logical
operators.
20 Perform the following conversion 2
(1010.110)2 = ( )10
(4589)10 = ( )16
21 Perform the following binary arithmetic operations. 2
1011111 + 1111111
10101010 – 11110000
22 #include <stdio.h> 2
int main()
{
int number, exp;
double result = 1.0;
printf("Enter the number: ");
scanf("%d", &number);
printf("Enter exponent: ");
scanf("%d", &exp);
// Missing code
printf("%d to the power %d is: %.0Lf", number, exp, result);
return 0;
}
Write the correct missing code to print the power of a given number
without using pow() function.
23 Consider the following program and write the correct missing code to 2
calculate the sum of positive integers entered by the user. Incase the
user enters a negative number, it should not be added to the sum.
#include<stdio.h>
Int main()
{
Int n,sum=0;
For(int i=1;i<=5;i++)
8 | Page
{
Printf(“\nEnter number”);
Scanf(“%d”,&n);
//Missing code
}
Printf(“\nThe sum is %d”,sum);
Return 0;
}
24 Write a complete C program to convert any given decimal number to its 3
binary equivalent.
25 Write a complete C program to print the sum of first and last digit of 3
any given number.
26 Write a complete C program to find the second largest integer number 3
from any three unique given numbers.
27 A positive integer is entered through the keyboard. Write a complete C 3
program to obtain and print the prime factors of this number.
Ex:- Prime factors of 24 are 2, 2, 2, and 3
28 3
#include <stdio.h>
int main()
{
int i, num, sum = 0;
printf("Enter any number ");
scanf("%d", &num);
for(i = 1; i <= num / 2; i++)
{
if(num%i == 0)
{
sum += i;
}
}
if(sum == num && num > 0)
{
printf("%d is PERFECT NUMBER", num);
}
else
{
printf("%d is NOT PERFECT NUMBER", num);
}
9 | Page
return 0;
}
Alter any three instructions from above code and write modified code
to check given number is Prime Number or not.
29 Perform the following conversion 4
1) (101010)2= ( )10
2) (1234)10 = ( )2
3) (123)8 = ( )2
4) (10101010)2 = ( )8
OR
29 Perform the following conversion
5) (101010)2= ( )16
6) (1234)10 = ( )8
7) (123)8 = ( )16
(10101)2 = ( )10
30 Write a complete C program to check if the given number is Happy 4
Number or Not .
Note:- Happy number is a any positive integer, replace the number by
the sum of the squares of its digits, and repeat the process until
the number either equals 1, or it will end at '4'. if Number is 1 than it is
Happy Number else if it end at 4 it is not Happy.
For Ex:- To check whether 19 and 25 are happy or not
N=19 N=25
N=12+92 =82 N=22+52=29
N=82 + 22 = 68 N=22+92=85
N=62 + 82 = 100 N=82+52=89
2 2 2
N=1 +0 +0 = 1 N=82+92=145
N=1 i.e its Happy Number N=12+42+52=42
N=42 +22=20
N=22+02=4
N=4 so number is Not Happy Number
OR
30 Write a complete C program to check Given two numbers are amicable
numbers or not
Note:- Two different numbers are said to be so Amicable Numbers if
each sum of divisors is equal to the other number.
Amicable Numbers are: (220, 284), (1184, 1210), (2620, 2924), (5020,
5564), (6232, 6368) etc.
Example– 220 and 284 are Amicable Numbers.
Divisors of 220 = 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110
10 |
Page
1+2+4+5+10+11+20+22+44+55+110=284
Divisors of 284 = 1, 2, 7, 71, 142
1+2+7+71+142=220
31 Write the output of following programs
1) 2) 4
int main() int main()
{ {
int i = 1; int x;
do x = 10;
{
printf("%d\n", i); if(x > 10)
i=i+2; x -= 10;
if (i % 5==0) else if(x >= 0)
break; x += 00;
} while (1); else if(x)
x += 10;
getchar(); else
return 0; x -= 10;
}
printf("%d\n",x);
return 0;
}
3. 4.
int main() int main()
{ {
int a = -10, b = 20; int a= -1,b = -a;
int x,y;
if(a > 0 && b < 0)
a++; x = (a> 0) && (b < 0) || (a<
else if(a < 0 && b < 0) 0) && (b > 0);
a--; y = (a<= 0) || (b >= 0) &&
else if(a < 0 && b > 0) (a>= 0) || (b <= 0);
b--;
else printf("%d\n",x == y);
b--;
return 0;
printf("%d\n",a + b); }
return 0;
}
11 |
Page
31 OR
1. 2.
int main() int main()
{ {
int x = 400, y, z; int p = 800, q, r;
if (x >= 500)
y = 400; if (p >= 700)
z = 300; q = 600;
printf("%d %d\n", y, z);
r = 500;
return 0;
} printf("%d %d\n", q, r);
return 0;
}
3. 4.
int main() int main()
{ {
int p = 4, q, r; int i = 0;
do
q = p = 15; {
r = p < 15; i++;
if (i == 2)
printf("p = %d q = %d r continue;
= %d\n", p, q, r); printf("In while loop ");
} while (i < 2);
return 0; printf("%d\n", i);
} }
12 |
Page