0% found this document useful (0 votes)
31 views

Computer Science 17

Uploaded by

anirudhjindal032
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Computer Science 17

Uploaded by

anirudhjindal032
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Roll No.

_________________ Code : 11–201718CS–A

Please check that this question


paper contains 7 questions and
12 printed pages.

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.

1. (a) Expand the following terms : (1)

(i) GUI

(ii) RISC

(b) Categorize the following into Utility, System or Application softwares.

(i) LINUX

(ii) WinRar (1)

(c) Differeniate between : (1×2)

(i) Freeware & Shareware

(ii) Primary & Secondary Memory

C.S. 1
(d) Convert the following : (2×2)

(i) ( ? )8 = (13)10 = (?)2

(ii) (BF)16 = ( ? )8 = ( ? )2

(e) How many megabytes make 5 TB ? (1)

(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

While using this program, the programmer observed some errors in


the program. Identify and underline the errors and also mention
their types. (2)
1. #include<iostream.h>

2. void main ()

3. {

4. float P, R;

5. int T;

6. cin >> p >> r >> t;

7. float SI = (P*R*T*T)/100;

8. cout<<“Simple Interest : Rs. “<< SI ;

9. }

(b) Draw a flowchart to print the factorial of a number input by the


user. (4)

(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);

(ii) for ( cs = –5 ; cs < 0 ; cs ++)


cout << “POPULAR” << endl ;

(d) List any two advantages of Modular Approach. (2)

(e) Mr. Das is a teacher of class XII A. He wants to do the following


task : (2)

(i) Accept the marks in two subjects (sub1, sub2)

(ii) Calculate & display the average marks (avg) in decimals

(iii) Calculate and display grade (gr) as an alphabetic information.

Suggest the data types for sub1 , sub2 , avg and gr

3. (a) Write equivalent C++ expression for the following : (4)

(i) S= ut +½ ft2

R1
(ii) I1 = I
R1+R 2

(iii) If Basic_salary is greater than 50000 , DA will be 50% of


Basic_salary else 35% of Basic_salary

(iv) To check that My_char is an alphabet

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)

char y = x != 1 ? toupper (‘p’) : tolower (‘p’ ) ;

(e) Give the output of the following code : (2)

int a = 10, b = 10 ;

cout<< a++ ;

cout <<“,” ;

cout << ++ a ;

cout <<”,” ;

b = +a +++b/a ;

cout << b++ ;

cout <<“,” ;

cout << ++b ;

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;

PICKER = 10 + random (N – 10) ;

for ( int i=10 ; i <= PICKER ; i++)

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.

typedef char TEXT [80] ;

void main ()

TEXT str = “We love Peace” ;

int Index = 0 ;

while (str [Index] != ‘\0’)

if (isupper (str[Index] ))

str [Index++] = ‘#’ ;

else if (str[Index] != ‘ ’)

C.S. 6
str [Index++] = ‘*’ ;

else str [Index++] = ‘@’ ;

cout <<str ;

(c) Predict the output of the following code snippet : (2)

#include <iostream.h>

int func (int &x, int y=10)

{ if (x%y = = 0)

return ++x;

else

return y-- ;

void main ()

int p=20 , q=23;

q = func (p, q) ;

cout <<p <<“/t” <<q<<endl ;

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. }

Rearrange the above statements so that it displays first 10 natural


numbers. Do not add extra statements, but you can add the
punctuators like (), if required.

(e) Rewrite the following using if –else (3)

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’ :

case ‘D’ : cout<<”Good” ;

break ;

case ‘E’ : cout<<“Average” ;

break ;

default : cout<<“Wrong Choice” ;

5. (a) Give the output of the following program code (assume all necessary
header files are included in program) : (3)

int a= 3;

void demo (int x , int y , int &z)

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

For the first 100 units – 40 P per unit (p–Paise)

For the next 200 units – 50 P per unit

Beyond 300 units – 60 P per unit

All customer has to pay meter charge at the rate of ` 50/- per meter.

Based on above information, write the C++ program to input number


of units consumed and display total amount to find the payment to
be made to NDPL. (3)

(c) What is the difference between Type Casting & Automatic Type
Conversion ? Give suitable example to illustrate the difference using
C++ code. (2)

6. (a) Write a function count_word () to count and display the number


of words in a string. Function should take the string as argument.
(assume there is only one space between two words) (4)

For example :

Input String : Year 2017 is an International Year of Sustainable


Tourism for Development.

Output : 11

The code should be indented properly.

(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

A [0] A [1] A [2] A [3] A [4] A [5] A [6]

50 11 19 24 28 10 5

C.S. 10
Modified Array A

A [0] A [1] A [2] A [3] A [4] A [5] A [6]

60 16 24 34 38 20 10

(c) Write a user defined function (3)

SumLast7 (int NUM [] [4] , int N, int M)

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

The output should be 98

7. (a) Predict the output of the following code (assume all required header
files are included). (3)

struct pixel

int C, R ;

} ;

void Display (Pixel P)

cout<<” Col “ <<P.C<”ROW “ <<P.R<<endl;

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) ;
}

(b) Define a structure to store information about employees of an


organisation using of the following data elements. (4)

Data Item Type

Code Integer

Name Char (maximum 20 characters)

Dept. Char (maximum 30 characters)

Salary Float

Write a program to input the details of 10 employees and print the


details of all employees who work in Finance Department.

❒❒❒

C.S. 12

You might also like