0% found this document useful (0 votes)
34 views12 pages

Computer Science 18

Cs2k24

Uploaded by

töp tën tëch
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)
34 views12 pages

Computer Science 18

Cs2k24

Uploaded by

töp tën tëch
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 : 11201819CS-A


Please check that this question
paper contains 7 questions and
12 printed pages.
Class : XI
computer science
Time Allowed : 3 Hours Maximum Marks : 70

General Instructions :
All the questions are compulsory
The Question paper contains 7 Questions.
Programming language used : C++

1. (a) Differentiate between compiler & interpreter. 2

OR

Differentiate between Real Time and Time Sharing Operating System. 2

(b) Convert the following memory units : 1


1 Tera Byte = _________ Giga Byte
1 Yotta Byte = _________ Peta Byte

(c) Convert : (11001010)2 to Hexadecimal 1

(d) Convert : (562.5)10 to Octal 1

(e) Convert : (6BA)16 to Binary 1

(f) Convert : (1110010)2 to Decimal 1

(g) Write names of any two popular open source software, which are used
as Operating System. 1

(h) Write any two features of Blue ray disk. 1

OR

Which port can be used to connect variety of peripheral devices and


supports plug and play installations? 1

(i) Expand the following : 1


(i) ISCII (ii) RISC

xi-computer science (1)


2. (a) Draw a flow chart to input any integer value and print its first
10 multiples. 4

(b) Out of the following, find those identifiers, which can be used for naming
variables, constants or functions in a C++ program : 2
For, Switch, case, A#num, else, 10books, include, define

OR

(b) (i) Convert the following if else to a single statement using conditional 1
operator :
if (marks >= 90)
Grade = 'A';
else
Grade = 'B';
(ii) What is debugging? 1

(c) Observe the given code and replace multi line comment with single
line comment : 1
void main ()
{ float percentage ;
cout<<"\n Enter the percentage";
cin>>percentage;
/* Following condition is giving the message for eligibility for
admission.*/
if (percentage >= 70 && percentage <=100)
{ cout<<"\n Eligible for admission";
}
}

(d) Observe the following loops and find the number of times these loops
will execute? 3
(i) Loop 1
for (int i = –12; i<=0; i++)
{
cout<<++i<<endl;
}

xi-computer science (2)


(ii) Loop 2
int I = 10, answer2=500;
while (I>=25)
{ answer2=2 * I;
I++;
}
(iii) Loop 3
int I = 30, answer2=500;
do
{
answer2 = 2*I;
I++;
} while (I>=25);

(e) The following code has few errors. Identify the errors & mention their
types : 2
#include<iostream.h>
void main()
{ int x=5, y = 0;
int d = x/y;
cout>>x;
}
OR
(e) Write the type of operators (Arithmetic, Logical and Relational operators) 2
from the following :
(i) ! = (ii) % (iii) ! (iv)

3. (a) Observe the following program very carefully and write the names of
those header file (s), which are essentially needed to compile and execute
the folowing program successfully : 2
void main ()
{ char ch = 'R';
char str [20]; gets (str);
cout<<tolower (ch);
cout<<strlwr(str);
}
xi-computer science (3)
(b) Write C++ statements/expressions for the following : 1+1=2
(i) Declare a varialbe Account_Type and assign a value "Saving".
(ii) Declare and assign variable cost in such a way that only positive
values can be assigned.

OR

(b) A IT institute decides to computerise its working. They need to create


a database to store information of the Students enrolled in various 2
courses. Suggest a suitable data types to store the following informations :
Variable Sample Value
SNAME ANKIT
Registration No. DAV 31102018
Course 'A'/'B'/'O'
'A' - 'A' level i.e. Equivalent to PGDCA
'B' - 'B' level i.e. Equivalent to MCA
'O' - 'O' level i.e. Bascic Computer Course
Fee 2000.50

(c) Find and write the output of the following C++ Program code : 3
Note : Assume all required header files are already included in the
Program.
int x = 10;
void main ()
{
int x = 5, y =5;
cout<<x++;
cout<<",";
cout<<++::x;
cout<<",";
cout<<y%::x<<","<<- -::x;
cout<<",";
y=(x>::x)? x++:++x;
cout<<y<<","<<x;
}

xi-computer science (4)


(d) Evaluate the following expressions : 1+1=2
(i) cout<<64/4+3*10%2;
(ii) (a–b)>c || (b+c)<d where a = 500,
b = 300, C=400 and d=200

OR

(d) (i) Evaluate the following C++ expression : 1


int a, m = 2, k = 4;
a = m*3/4+k/4+8–m+5/8;
(ii) Write an equivalent C++ expression for the following : 1

−b + b 2 − 4ac
x=
2a
(e) Consider the part of code below : 1+1=2
double length;
int breadth;
cin>>length >>breadth;
cout<<length *breadth; // statement 1
cout<<(int)length * breadth; // statement 2
(i) Write the resultant data type of the value of statement 1 and
statement2.
(ii) Identify the type of conversion in statement 2.

OR

(e) What is cascading of I/O operators? Illustrate with a suitable C++ 2


example.

4. (a) Find and write the output of the following program : 3


Note : Assume all required header files are already included in the program.
void change (int &num, int end = 2)
{ if (end %2 ==0)
end = end+1;
else
end=end–1;
for (int c=1; c<=end; C++)
num+ = c;
}
xi-computer science (5)
void main ()
{
int a = 20, b = 4;
change (a, b);
cout<<a <<"&"<<b<< endl;
b– –;
change (a, b);
cout <<a<< "#"<<b<<endl;
change(b);
cout<<a<<"#"<<b<<endl;
}

(b) Rewrite the correct code after removing the errors and underline the
correction in following code : 2
#include<iostream.h>
void main ()
int count [30], S=0;
count = {15, 6, 60, 75, 80};
for (p = 0; p<5; p++)
{
if (count[p]%2 = 0)
S = S+count[p];
}
cout<<S;

}

(c) Write a program in C++ to accept an integer array of 7 elements
and interchanges elements is such a way that the first element is
swapped with the last, second element is swapped with the second
last element & so on, only if any one or both the elements are odd. 3
e.g. if array of seven elements is :
7, 18, 6, 9, 21, 10, 4
After execution of the above program, the contents of the array
will be :
4, 18, 21, 9, 6, 10, 7

xi-computer science (6)


(d) Rewrite the following code using for loop : 2
int A=250, num = 0;
while (A>=10)
{ num = 3*A;
cout<<num<<"@\n";
A = A – 25;
}

(e) Find and write the output of the following program : 2


Note : Assume all necessary header files are included in the program.
#define SMALL (A, B) (A<B)? A+1:B+2
void main ()
{ char W[] = "Comp";
int L = strlen (W);
for (int i=0; i<L–1; i++)
W[i] = SMALL (W[i], W[i+1]);
cout<<W<<endl;
}

5. (a) Observe the following program carefully and attempt the given
questions : 2
Note : Assume all the required header files are already included in the code.
void main ()
{
randomize();
int val []={450, 550, 650, 750};
int index;
for (int i=1; i<=3; i++)
{
index = random (i)+1;
cout<<val [index]<<"\t";
}
}

(i) Out of all the four values stored in the array val, which value will

never be displayed in the output and which value would be most
likely be displayed in the output?
xi-computer science (7)
(ii) Mention the minimum and maximum value assigned to the variable
index?

OR

(a) What is the benefit of using default parameter / argument in a function?
Give a suitable example to illustrate it using a C++ code. 2

(b) Find and write the output of the following program code : 2
Note : Assume all required header files are already being included in
the program.
void main ()
{
int Ar[] = {10, 12, 15, 21};
for (int i=0; i<4; i++)
{
if (Ar[i]%2==0)
Ar[i]/=2;
else if (Ar[i]%3==0)
Ar[i]+=3;
if (Ar[i]%5==0)
Ar[i] – = 5;
}
for (i=0; i<4; i++)
cout<<Ar[i]<<"#";
}

OR

(b) Find and wirte the output of the following program code : 2
Note : Assume all required header files are already included in the program.
void MyStr (char str[], char CH)
{
for (int i=0; str[i]! = '\0'; i++)
{
if (str [i]>='C' && str [i] <='H')
str [i] = tolower (str [i]);

xi-computer science (8)


else
if (str [i]== 'O'¦¦str[i]=='o')
str[i] = CH;
else
if (i%2==0)
str[i] = toupper (str[i]);
else
str[i] = str [i–1];
}
}
void main ()
{ char MyCode [] = FlOopyDriVE"
MyStr (MyCode, '#');
cout<<MyCode;
}

(c) What is the difference between actual and formal parameter? Give a
suitable example to illustrate using a C++ code. 2

(d) Convert the following C++ code using switch case statements : 2
void main ()
{ char ch;
cout<<"\n Enter your choice to select subjects (a, b, c)" ;
cin>>ch;
if (ch=='a' ||ch=='b')
{ cout<<"Mathematics";
}
else if (ch=='c')
{ cout<<"History";
}
else
{
cout<<"Please enter valid choice";
}
}

xi-computer science (9)


6. (a) Write the definition of a function grace_score (int score [ ], int size) in
C++, which should check all the elements of the array and give an
increase of 5 marks to those scores which are less than 40. 3
Example : if an array of integers is as follows :
45, 35, 85, 80, 33, 27, 90
After executing the function, the array content should be changed as
follows :
45, 40, 85, 80, 38, 32, 90

OR

Write a function CHANGE () in C++, which accepts an array of


integer and its size as parameters and divide all those array elements
by 5 which are divisible by 5 and mulitply other array elements by 7.
Sample input data of the array
25, 12, 35, 11, 15
Content of the array after calling CHANGE() function
5, 84, 7, 77, 3

(b) Write a user defined function void count_letters (char sentence[]) to


count number of small letters 'e' and 'i' present in the string. 3
Example : Input sentence - "There is one law in the universe about
time - NOW"
Then the Output should be :
Number of 'e' = 7
Number of 'i' = 4

(c) Write a function PrintTwoDigit() in C++, which accepts a two


dimensional integer array and its size as parameters. Display only two
digit numbers present in the array. 4
Example : if the two dimensional array contains
15 122 28
2 70 5
Output 15, 28, 70

7. (a) Give the output of the following program : 3


struct Hall

xi-computer science ( 10 )
{
int L, B, H;
};
void HallIn(Hall & R, int Val = 1)
{
R.L +=val;
R.B – = val;
R.H += R.L.
}
void HallOut (Hall & R, int val =1)
{
R.L – = val;
R.B+ = val;
R.H –=R.L;
}
void main ()
{ Hall H1 = {10, 20, 5}, H2 = {30, 10, 40};
HallIn (H1);
HallOut (H2, 5);
cout<<H1.L<<","<<H1.B<<","<<H1.H<<endl;
cout<<H2.L<<","<<H2.B<<","<<H2.H<<endl;
HallIn (H2, 10);
cout<<H2.L<<","<<H2.B<<","<<H2.H<<endl;
}

OR

(a) Observe the following C++ code very carefully and rewrite it after
removing any / all syntactical errors with each corrections underlined.
Note : Assume all header files are already being included in the program.
structure Item
{
int item_no=501;
char item_name[20];
float price;
}

xi-computer science ( 11 )
void main ()
{
I Item;
cout<<"Enter Item No. =";
cin>>I.item_no;
cout<<"Enter Item Name =";
gets (Item_name);
cout<<"Enter price=";
cin>>price.I;
}

(b) Define a structure Travel to store information about travelers. The structure 4
has following data elements :
Data Item Type
t_no char[10]
t_Name char[30]
fare double
Write function definitions for the following :
void Input (Travel t[10]) to input details of 10 travelers.
void show_Details (Travel t[10]) to display details of the travelers who are
paying fare more than 20000.

xi-computer science ( 12 )

You might also like