0% found this document useful (0 votes)
95 views7 pages

2012 Annual Q Paper 2014

This document contains a computer science exam from Delhi Public School Bangalore South from 2013-2014. It has 3 sections - Type A with 14 short answer questions, Type B with 2 long answer questions, and Type C with 4 programming questions. The questions cover topics like data types, operators, functions, arrays, structures, classes and more. Students have to write code, find outputs, correct syntax errors, solve mathematical problems and more.
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)
95 views7 pages

2012 Annual Q Paper 2014

This document contains a computer science exam from Delhi Public School Bangalore South from 2013-2014. It has 3 sections - Type A with 14 short answer questions, Type B with 2 long answer questions, and Type C with 4 programming questions. The questions cover topics like data types, operators, functions, arrays, structures, classes and more. Students have to write code, find outputs, correct syntax errors, solve mathematical problems and more.
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/ 7

Delhi Public School Bangalore South

ANNUAL EXAMINATION 2013-14


Subject: Computer Science
Class: 11 Duration: 3 hrs
Date: 5 – 02 – 2014 Max Marks : 70

Type A 1x14 =14


1. Mention 2 applications of super computers.
2. Represent -12 in 2’s complement form (in 8 bit).
3. What is cache memory? Distinguish among the categories.
4. What is meant by polymorphism? Mention an example.
5. Identify the following program elements:
a. 010 b. num
6. What would the following statement result in? why?
unsigned int x = -12;
7. Choose an appropriate data type (with appropriate modifier) to a person’s weight. Write the declaration.
8. Write the output:
a= 1, b= =3;
a * = (b*2, b+=6, b+2, b++ );
cout<<a<< a++;
9. Choose an appropriate datatype to store the following information: book name, author’s name, price and
date of publishing. Write the declaration.
10. Write a statement to store 10- 12- 2014 in the date variable dt declared below:
struct date{ int d, m, y};
struct test{
date dt;
} t1;
11. Write the output:
int d = -6;
if( !d )
cout<<d;
else
cout<< !d;
12. Write the output:
int a[3][3] = {-4, 2, 0,
6, -1, 10,
19, 0, 21};
cout<<a[1][1] + a[2][2];
13. What is wrong with the following code?
x =0, y = 3;
do
{
cout<<x++ ;
y = x + 5;
}while(x > 0);
14. Write prototype for a function “result” that accepts an integer by value, a positive number by reference,
a constant character and returns an integer location.

Type B 2 x 16 = 32
1. Classify job scheduling techniques. Compare them.
2. Convert the following to decimal: (11000111.101) 10
3. What is polymorphism? How is it implemented? Explain with an example.
1
Identify syntax errors and correct them:
4. unsigned int x;
long int y;
double z;
cin>>x;
y = x+ 20000;
z = y+ 12.5;
if( x+ y > 2000)
{
x> 0? y += x : x> -10 ? x += 100;
y-= x;
}
else if( z > 100);
{
while(z> 0)
{
cout<<z;
z = ( x, x+y );
z % = 10;
}
}
else
{
if( x++, y--)
x* = 8;
cout<<x <<y;
break;
}

5. void main( )
{
int a, b;
cin>>a>>b;
cout<<f1(a, b, ‘A’);
}
void f1(int p, int q = 2 , char &m)
{
int i = 1;
do ;
{
if(p++ > q )
goto end;
m -= 2;
int m = m;
mout<<m;
if( sqrt(p + q, 2) >2 && m > 65 )
m += 10;
end:
mout<<a<<” “<<b<<” “<<m;
i*=2;

} while( i <= 10) ;


}

2
6. char f2(char txt[30])
{
char ch; int n;
for(; txt!=’a’ && txt!=’e’&& txt!=’i’&& txt!=’o’&& txt!=’u’; --txt)
{
switch(n) ;
{
case 1: n=1;
break;
case 2: n=2;
break;
case 3: n=3;
break;
default: n+=4;
++n;
ch = txt-1;
}
}
cout<<n;
return ch;
}
void main( )
{
char str[4, 5];
gets(str);
int p= strlen(str);
while( --p ;p>=0; --p)
str[p] = str[p]+1;
str =f2(str[p+2])
}
7. struct {
int no = 1;
char nm[30], desig[30];
float sal;
};
emp e[10];
struct staff{
int no = 1;
char nm[30], desig[30];
float sal;
}s[10];
int i;
for(i=0;i<10;++i)
{
cin>>emp[i].no;
}
s[0] = e[1];
i=0;
while(i<10)
{
if(sal>10000)
no += 10;
}

3
8. car f3(car d, int n);
void main( )
{
struct det{
int f1, f2, f3;
};

struct cr{
char nm[30];
float pr;
char flav[30];
int r;
det d;
} c[10];
int i, n;
cin>>n;

for(i=0;i<n;++i)
{
cin>>c[i].nm>>c[i].pr>>det.f1;
}
cout<< f3( c , n);
}
cr f3(cr c1[10], int n)
{
int i;
for(i=0;i<n;++i)
{
if(c1[i].pr>c1[i+1].pr)
{
++r;
f3 =0;
}
}
return c1;
}

Write the output with 4 to 5 major steps of working:


9. int r, i, j, s;
cin>>r;
for(i= r; i >= 1; --i)
{
for(s=0; s < r - i; ++s)
cout<<" ";
for(j=i; j <= 2 * i - 1; ++j)
cout<<"* ";
for(j=0 ;j < i-1 ;++j)
cout<<"* ";
cout<<endl;
}
Input: r = 4
10. void f1(int a, int b = 3)
{
int i = 1;

4
do
{
b ++;
if(b < b/a +2 || a++ <= b)
cout<<b<<” “;
++i;
}while(i<= 3 && b <= 5);
}
void main( )
{
int m,n;
m=1, n= 2;
f1(m++, n);
cout<<”\n”<<m<<” “<<n<<”\n”;
f1(m);
cout<<”\n”<<m<<” “<<n<<”\n”;
}
11. void chk( int a[10], int n )
{
int i , j, t;
for(i = 0; i < n; ++i)
{
if(i%2== 0)
t = a[i];
a[i]= a[i+1];
a[i+1]=t;
if(i%2==1)
continue;
}
}
void main( )
{
int num[10], n, i;
cin>>n;
for(i=0;i<n;++i)
cin>>num[i];
chk(num, n);
for(i=0;i<n;++i)
cout<<num[i];
}
Input: n = 4
1 -1 2 -2
12. int m1[10][10], r, c, i, j, s1=0, s2=0;
cin>>r>>c;
for( i = 0; i < r; ++i)
{
for( j = 0; j < c; j++)
cin>>m1[i][j];
}
for( j = 0; j < c; j++)
{
for( i = 0; i < r-1; ++i)
{
s1+ = m1[i][j];

5
}
s2+= m1[i][j]
s1 += 5;
}
cout<<s1<<”\t”<<s2;
Inputs: r = 2, c = 3
1 0 2
-4 8 2
13. struct air{
int fltno;
char nm[30];
int pr;
int sr, d;
int hr,min;
float bg;
int cl;
};
void res( air a[4] )
{
int i, cnt;
for(i = 0; i < 4; ++i)
{
if( a[i].pr > 2000)
if(a[i].hr > 2)
a[i].hr -= 3;
if(a[i].bg >=15 && a[i].bg<=30)
cl =1;
else
c1 = 2;
if(a[i].pr<1000 && i+1 < 4)
a[i] = a[i+1];
}
}
void main( )
{
air a[4];
int i;
for(i=0;i<4;++i)
{
cin>>a[i].fltno;
gets(a[i]. nm);
cin>>a[i].pr>>a[i].sr>>a[i].d;
cin>>a[i].hr>>a[i].min>>a[i].bg;
}
res(a);
for(i=0;i<4;++i)
{
cout<<”\n”<<a[i].fltno<<”\t”;
cout<<a[i]. nm<<”\t”;
cout<<a[i].pr<<”\t”<<a[i].sr<<”\t”<<a[i].d<<”\t”;
cout<<a[i].hr<<”\t”<<a[i].min<<”\t”<<a[i].bg;
}
}

6
Inputs:

fltno 1213 4379 9017 6543


nm Jet Airways Indigo Spicejet Air India
pr 5500 5200 900 5000
sr, d 1, 2 1, 2 1, 2 1,2
hr,min 1, 30 1, 45 1, 15 1, 45
bg 30 20 35 33

14. Mention any 4 uses of documentation.


15. Write a function to accept a number ‘n’ from main and print its reverse.
16. What is cache memory? How is L1 different from L2 cache?

Type C 4 x 6 = 24

1. A Pythagorean triplet is a set of three natural numbers, a b c, for which,a2 + b2 = c2 . For example,
32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Write a program to find the product abc.
2. Write a program to accept the number of terms and print the sum of the following series:

x – x2 + x3 – x4 +………….up to n
2! 3! 4!
3. Store the following information for ‘n’ records: Name, runs scored, indication if out, total runs, overs
played, total overs and extras for batsmen and name, overs bowled, maiden overs, runs given and wickets
taken for bowlers. Accept a choice from the user to display either batsman or bowler’s information. Also
display the batsman details with highest score record.
4. Write a program to accept ‘n’ student records with the following information: Name, Class, Roll and total
percentage. Sort all the student records roll number wise. The result must be printed in a tabular form.
5. Write a program to accept a line of text and reverse each word beginning with the letter ‘G’.
6. Write a program to accept 2 matrices. Transpose the first one. Reverse the main diagonal elements of the
second one. Print the sum of the altered matrices.

You might also like