Computer Science 17
Computer Science 17
CLASS–XI
SUBJECT–COMPUTER SCIENCE
Time allowed : 3 Hrs. M.Marks : 70
General Instructions :
1. All questions are compulsory.
2. This question paper contains 7 questions and the programming language
used is C++
3. Please write down the serial number of the question before attempting it.
4. 15 minutes time has been allotted to read this question paper. During this
time, the student will not write on the answer book.
5. Do not write anything on the question paper.
(i) GUI
(ii) RISC
(i) LINUX
C.S. 1
(d) Convert the following : (2×2)
(ii) (BF)16 = ( ? )8 = ( ? )2
(f) Name the two units used for measuring the microprocesser clock
speed ? (1)
2. (a) The following program is used to calculate the Simple Interest for
the given values
P = Rs 1000 R = 5% T = 2 years
2. void main ()
3. {
4. float P, R;
5. int T;
7. float SI = (P*R*T*T)/100;
9. }
(c) Mention the type (finite, infinite) of loops in the following situations
(2)
C.S. 2
(i) int a=5, b=8;
do
a + = b++;
while (b);
(i) S= ut +½ ft2
R1
(ii) I1 = I
R1+R 2
C.S. 3
(b) Jayapriya has started learning C++ & has typed the following
program. When she compiled the code she discovered that she needs
to include some header files to successfully compile & execute it.
Write the names of header files which are essentially required for
execution of the following C++ code : (1)
void main ()
{
double item_price = 7638.342252 ;
cout<<”Price of Item with different precision “<<endl ;
cout<<setw(3) <<item_price<<endl;
cout<< setw (4) << item_price <<endl ;
}
(c) Observe the following C++ code carefully and rewrite the same
after removing all the syntax error (s) present in the code. Ensure
to underline each correction in the code. All desired header files are
already included. Correction should not change the logic of the
program. (2)
# include “iostream.h”
#include (ctype.h)
void main ()
{
cin>>x;
if isalpha (x)
cout<<”alphabet” ;
else if (isdigit (x)) ;
cout<<digit” ;
}
C.S. 4
(d) Convert the following expression into if-else construct : (2)
int a = 10, b = 10 ;
cout<< a++ ;
cout <<“,” ;
cout << ++ a ;
cout <<”,” ;
b = +a +++b/a ;
cout <<“,” ;
4. (a) Look at the following C++ code and find the maximum and the
minimum values that can be assigned to the variable PICKER.
Consider the value of N given by the user is 20. Also find the correct
possible output from the options (i) to (iv).
Note : Assume all required header files are already being included
in the code. (2)
void main ()
int N;
randomize () ;
C.S. 5
int PICKER ;
cin>>N;
cout<<i<<” ”;
(i) 10 11 12
(ii) 9 10 11 12
(iii) 11 12 13
(iv) 10 12 14 16 18
(b) Obseve the following program carefully & predict the output : (3)
Note : Assume all required header files are already being included
in the program.
void main ()
int Index = 0 ;
if (isupper (str[Index] ))
else if (str[Index] != ‘ ’)
C.S. 6
str [Index++] = ‘*’ ;
cout <<str ;
#include <iostream.h>
{ if (x%y = = 0)
return ++x;
else
return y-- ;
void main ()
q = func (p, q) ;
p = func (q) ;
cout <<p<<“t”<<q<<endl ;
C.S. 7
(d) Consider the following statements : (2)
1. #include<iostream.h>
2. #include<conio.h>
3. void main ()
4. {
5. clrscr () ;
6. i=i+1 ;
7. cout<<i<<endl ;
8. while (i<10)
9. int i = 1 ;
10. getch () ;
11. }
char ch ;
cout<<”\n Enter the grade from A–E” ;
cin>>ch;
switch (ch)
{
case ‘A’ :
case ‘B’ : cout<<”Excellent” ;
break;
C.S. 8
case ‘C’ :
break ;
break ;
5. (a) Give the output of the following program code (assume all necessary
header files are included in program) : (3)
int a= 3;
a+ = x +y;
z = a + y;
y+ = x;
cout<<x<<y<<z<<endl ;
void main ()
int a = 2, b = 5;
demo (: : a, a,b) ;
cout<< : : a<<a<<b<<endl ;
demo (: : a, a,b) ;
}
C.S. 9
(b) NDPL – Electricity Board charges according to the following rates
All customer has to pay meter charge at the rate of ` 50/- per meter.
(c) What is the difference between Type Casting & Automatic Type
Conversion ? Give suitable example to illustrate the difference using
C++ code. (2)
For example :
Output : 11
(b) Write a function Alter (int A[], int N) in C++, which should add
5 in all the odd values and 10 in all the even values of array. For
example (3)
Original Array A
50 11 19 24 28 10 5
C.S. 10
Modified Array A
60 16 24 34 38 20 10
To find and display the sum of all values which are ending with 7
(i.e. unit place is 7). For example, if the content of array NUM
is :
13 34 27
7 23 15
17 5 47
7. (a) Predict the output of the following code (assume all required header
files are included). (3)
struct pixel
int C, R ;
} ;
C.S. 11
void main ()
{
Pixel X = { 40, 50}, Y, Z;
Z = X;
X.C += 10;
Y = Z;
Y.C += 10;
Y.R += 20;
Z.C –= 15;
Display (X) ;
Display (Y) ;
Display (Z) ;
}
Code Integer
Salary Float
❒❒❒
C.S. 12