8
D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS - XI COMPUTER SCIENCE Q1. Input a number and then print the sum of the digits. [4] Q2. Input a number and then print its reverse. [4] Q3. Input a number and then check whether it is prime or not. [4] Q4. Input 10 numbers in an array and then print the largest number [4] Q5. WAP which will accept a character and then check whether the character is an alphabet, a number or a special symbol. [4] Q6. WAP which will accept 16 number in a 20 array size 4x4 and then print the sum of diagonal elements (Both Left and Right) [4] Q7. How you can provide alternatives names for a data-type. Describe using example. [4] Q8. What is the difference between entry controlled and exit controlled loop. [2] Q9. Differentiate between POST increment and PRE increment operators using example. [2] Q10. Differentiate between the statement 1 and 2 [1] int x = 5; x+=5; 11---------------- Statement 1 x=+5; 11---------------- Statement 2 Q11 Differentiate between the statement 1 and 2 [1] signed int x ; 11---------------- Statement 1 unsigned int x ; 11---------------- Statement 2 Q12. Guess the output r1+3+3+3=1 0] void mainO { int x =5,y=7; x=(y=y+x,x=x+y); cout«x« " " «y; } W) void mainO { int y,z; int x[]={2,5,8,4}; for (y=O;y<=3;y++) { for( z=O;z<=y;z++) { x[z]=x[z]+y; } } for (y=O;y<=3;y++) cout«x[y]; void mainO . { int x=l ,y=2,z=3; for ( ; x<=4;x++) { for (y=4;y>=x;y--) { cout«z; z++; } cout«endl; } } void mainO { int x=5, y=2; y=x++ + ++x +y++; cout«x«y«endl; x= x+y; y=x+y; cout«x++«x++«endl; cout«++y«++y«endl; }

D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

D.A.V PUBLIC SCHOOLS, RANCHI ZONEFIRST SUMMATIVE ASSESSMENT 2011-2012

CLASS - XICOMPUTER SCIENCE

Q1. Input a number and then print the sum of the digits. [4]Q2. Input a number and then print its reverse. [4]Q3. Input a number and then check whether it is prime or not. [4]Q4. Input 10 numbers in an array and then print the largest number [4]Q5. WAP which will accept a character and then check whether the character is an

alphabet, a number or a special symbol. [4]Q6. WAP which will accept 16 number in a 20 array size 4x4 and then print the sum

of diagonal elements (Both Left and Right) [4]Q7. How you can provide alternatives names for a data-type. Describe using example. [4]Q8. What is the difference between entry controlled and exit controlled loop. [2]Q9. Differentiate between POST increment and PRE increment operators using example. [2]Q10. Differentiate between the statement 1 and 2 [1]

int x = 5;x+=5; 11---------------- Statement 1x=+5; 11---------------- Statement 2

Q11 Differentiate between the statement 1 and 2 [1]signed int x ; 11---------------- Statement 1unsigned int x ; 11---------------- Statement 2

Q12. Guess the output r1+3+3+3=1 0]

void mainO{int x =5,y=7;x=(y=y+x,x=x+y);cout«x« " " «y;}

W) void mainO{int y,z;int x[]={2,5,8,4};for (y=O;y<=3;y++){for( z=O;z<=y;z++)

{x[z]= x[z]+y;}

}for (y=O;y<=3;y++)cout«x[y];

void mainO .{int x=l ,y=2,z=3;

for ( ; x<=4;x++){

for (y=4;y>=x;y--){cout«z;z++;}

cout«endl;}

}

void mainO{int x=5, y=2;y=x++ + ++x + y++;cout«x«y«endl;x= x+y;y=x+y;cout«x++«x++«endl;cout«++y«++y«endl;}

Page 2: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

Q13 Convert the following decimal numbers into binary:

i) 255 ii) 106 iii) 84.5

014 Convert the following binary numbers into decimal:

i) 10110 ii) 101011 iii) 1110~OO.011

Q15 Convert (11011010101110h to hexadecimal

016 Convert 488C16 to binary.

Q17 Convert FACE16 to binary.

Q18 Convert A2F16 to octal.

Q19 What is the function of Memory? What are its measuring units?

Q20 What are the three types of computers?

Q21. What are the characteristics of a good program?

Q22. Differentiate between Run Time Errors and Logical Errors

Q23 Why do we use comments?

Q24. What is the use of indentation? Explain.

Q25. What is meant by Top down design?

Q26. Find the error(s)

Viod mainO

{

for (y=1; y<=10;y++)

{

cout»y+10;..

Page 3: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

~n-.~g -,-.-' tO~6~.- <""?-

Class:XI

- ~.21~']h J"--0r.or)/O~>{ (0/ (Jol· 0))2(1;'

~~

~ h tAJ< AA 1(r;tr\A-I l 0 IV • r- ,. "bA~ Put) ~chool, Ranch. Zone c!Cl-JJ-:>sJ. D, ' .•st Term Examination 2012-2013 RDf)"..,O·?:!I.

Sub: Computer Science Time: 3 Hr M.M :·70

1.a) What are the different hardware components of computer.X ~Write the names of any four Antivirus Software?

c) Differentiate between dot matrix and inkjet printer.d) Write difference between binary and decimal no. system.e) Expand the following: (i) ASCII (ii) ISCIIf) Convert following decimal no. into its equivalent binary no (i) (106)10 (ii) (41.25)10g) Convert the following into decimal equivalent: (i) (10101.011h .2/.31-5(ii) (111011hh) Convert the octal number (127.3)8 into its decimal equivalent.i) Write the binary equivalent of the hexadecimal (BAD)16 (J 0 I) / 0 I 0 I J 0 V2,~ What is pre-processor directive? Discuss its use in C++.b)' . Name the header files under which the following functions run:

i) powO ii) c1rscrO

c) Rewrite the corrected version after removing the error(s) from the given program:(Underline each correction]#include <isotream.h>#include <conio.h> ~~~ ~'h)void mainO ---7{

grscrO;int a b c= 50000'~J' I

unsigned int.x = -~4;cout«"enter three nos \n"cin»a»b» G; .

sum = a + b + c;cout«x«pow(a,b);

Write the output after carefully studying the follOWing code:void mainO{..

int X[6] = {22,3;4:7;12,65},a=0;while(a<=5){

if(X[a]%2==0)cout«X[a] - 2«endl;

a++;}cout«a«end/;

Write a program to input a number and then print its reverse.(Example: if input number is 356 : output will be 653

3~b)c)4.a)

Write importance of documentation and indentation of a C++ program. Give example.What is the difference between Runtime errors and Syntax errors?Explain the stages of program development process.Why is main( ) function essential for all C++ programs?

[2][2][2][2][2][2]

S} [2][1][1] t.4z

[2][1]

[2]

[3][2][4][2]

Page 4: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

.~~.-;~._,.}Write the output of following program(all header files are present)int i=0,a=1 ,b=2,c=3,d=4;while(i<=5){

switch{i++ ){

What is the difference between unary and binary operators?What is the difference between 'A' and "A" ?Explain briefly about basic and derived data types with suitable example.What is wrong with following declarations:

AC;onst float pi; . ii) int x = 50000;iii) char st = uAshwin" iv) int y = 2.8;Evaluate int X = a++ + ++a - --b + b-- + ++b + b++ + a++ + ++b if a = 2 and b= 3.Write output of : cout«a++ + ++a + a++ + ++a - --a; if a = 3. lvWrite the output if a = 2 and b = 5 : i) cout«++a; - .3 ii) cout«b++; ~fa = 2, b= 3 and c = 4,what is the value of

Ans = (a+b»c && (c-a) > b II a= ::b. y

)1 [1]

9 [1][2][1]

[2]Convert the following if-else statement into conditional statement (ternary operatorif(Msalary >=25000){tax = salary * .10;}else{tax = 0;}What will be output of following code if a is entered as i) 5 and ii) 0{int a,b=3;cin»a;if(a)

b = at+ - 1;cout«"a="«a«end/;cout«'b="«b«endl;

case 1 ~#++a;

break;case 2:

++a;·case 3:

++b;break;

I\:~ case 4:++c;

case 5:,.'

++d;'f

default:++d;

}i++;cout«a«" u«b«" U «c«" u«d«" u«i«endJ;}

Page 5: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

N~i11 be the output of following two code fragments if the input for a and b is given asi) a = 30 , b = 30 and ii) a = 60, b = 70. : '[2]

! INersion-1 INersion-2,int i=20,j=10; int i=10,j=20;if(a<100) if(a<100)

if(b>50) {++i; if(b>50)

++i;++j;

cout«i«" u«j«endl;}else

++j; ~)cout«i«" u«j«endl;

6.a) Write a program which will store 10 numbers~n an array and then print the largest numberfrom the array [4]

b) Write a program which will store 10 numbers in an array and then count total odd numberspresent in the array. [4]

Page 6: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

/ DAV Public School, Ranchi Zone1st Term Examination 2010-2011

Class:XI Sub: Computer ScienceAnswer all the questions:

1.a) Write differences b~tween interpreter and compiler. [2]b) Briefly explain ab0tf. 3rd and 4th generation of computer. [2]c) What is analog aIlf digital computer? Give 1 example for each types. [2]d) Differentiate between impact and non impact printer with example. [2]e) Explain about super computers developed by India. (2]

2.a) What is pre-processor directive? Discuss its use in C++. [2]b) Name the header files under which the following functions run : [1]

i) gets() ii) getch()c) Rewrite the corrected version after removing the eITor(s) from the given program: [2]

[Underline each correction] .-#include <isotream.h>#include <conio.h>.void main ()

Clrscr();int a,b,c= 50000;unsigned int x = -34;cout«"enter three nOB \n"cin»a»b;

sum = a + b + c;cout«x«pow(a,p);

I - -

Write the output after carefully studying the following code:void main ()

int X[6] = {22,3,4,7,12,65},a=0;while (a<=5){

if(X[a]%2==0)cout«X[a) - 2«endl;

}cout«a«endl;

Write a program to print sum of following:S =_(1)+ (1+2) +(1+2+3 N)Write a program to input a no. and print the sum of all digits of the no.(Example: ifno. is 356 : (3 + 5 + 6 = 14)

Page 7: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

3.a) Why is mainO function essential for all C++ programs? [2]b) Discuss ways to give comments in a program. Show it with example. [2]c) . What is the difference between unary and binary operators? Justify with example. [2]d) What are punctuators in C++? Write names and uses of two. [2]e) What is the difference between 'r' and "r" ? [2]f} Explain briefly about basic and derived data types.Write two names of basic and

derived data types. [2]g) What is wrong with following declarations: [4]

i) const float pi; ii) int x = 50000;iii) char st[20] = "Ash win" iv) unsigned int x = -45;

g) Evaluate int X = art + ++a - --b + b-- + ++b + b++ + a++ + ++b if a = 2 and b= 3. [1]h) Write equivalent statement in C++ for: a2 + b3 + c4 + ut + 'li ae [1]i) Write the output if a = 2 and b = 5: i) cout«++a; ii) cout«b++; [I]j) Ifa = 2, b= 3 and c = 4,what is the value of Ans:= (a+b»c && (c-a) > b II a= =b. [1]

4.a) What is the difference between while and do while loops? Justify with example. [2]b) Convert the following if-else statement into single conditional statement: [2]

if(Msalary>=25000)tax salary * .10;

What will be output of following code if a is input as i) 5 and ii) 0int a,b=3;cin»a;if (a)

b = a++ - 1;cout«ua=u«a«endl;cout«ub=u«b«endl;

What will be the output of following two code fragments://Version-1 //Version-2

int i=20,j=10; int i=10,j=20;if(a<100) if(a<100)

if (b>50) {i'f(b>50)++i;

++j;cout«i«u "«j«endl; else

++j;cout«i«u "«j«endl;

If the input given is i) a = 30 , b = 30 and ii) a = 60, b = 70.

Study the following code carefully and rewrite it in for loop:int x = 5;

while(x>=-5){

cout«x«endl;x-=5;

}cout«x;

Page 8: D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ...davhzb.ac.in/File/af03b908-e562-48fc-a254... · D.A.V PUBLIC SCHOOLS, RANCHI ZONE FIRST SUMMATIVE ASSESSMENT 2011-2012 CLASS-

Write the output of following program(all header files are present)int i=O,a=O,b=O,c=O,d=O;while (i<=5){

switch(i++){

case 1break;case 2case 3break;case 4 ++c;case 5 ++d;default : ++d;

++a;++b;

i++;cout«a«u "«b«u " «c«U "«d«u "«i«endl;

5.a) What is an array? Discuss its need in e++. Show example to justify. [2]b) An array of integers Num[500] stores numbers which contains odd nos., even nos. and also

nos. completely divisible by 5 and 7 . Write a program to print [4Ji) the total nos. of odd nos.ii) total nos. of even nos andiii) nos. completely divisible by 5 and 7.

c) An organization stores salary of 1000 employees and wants to know how many employees aredrawing salary more than 25000. If the employees are drawing more than Rs. 25000.00tax is calculated as 10% of salary and deduction is made while salary is paid. Write a programin e++ to store salaries of 1000 employees and .change the value by deducting 10% of thesalary if it exceeds Rs 25000.00. [4][Ex: if salary is 30000.0Q. then it will be 30000.00 - 3000.00 = 27000.00]