1 Computer Science (Theory) Class XI - Code: 083 Design of Question Paper for 2010-2011 Time: 3 Hours M.M. 70 weightage oI marks over diIIerent dimensions oI the question paper shall be as Iollows: A. Weightage to diIerent topics / content units S.No. Topics Marks 1 Computer Fundamentals 10 2 Programming Methodology 10 3 Introduction to C11 15 4 Programming in C11 35 b. Weight
1 Computer Science (Theory) Class XI - Code: 083 Design of Question Paper for 2010-2011 Time: 3 Hours M.M. 70 weightage oI marks over diIIerent dimensions oI the question paper shall be as Iollows: A. Weightage to diIerent topics / content units S.No. Topics Marks 1 Computer Fundamentals 10 2 Programming Methodology 10 3 Introduction to C11 15 4 Programming in C11 35 b. Weight
1 Computer Science (Theory) Class XI - Code: 083 Design of Question Paper for 2010-2011 Time: 3 Hours M.M. 70 weightage oI marks over diIIerent dimensions oI the question paper shall be as Iollows: A. Weightage to diIerent topics / content units S.No. Topics Marks 1 Computer Fundamentals 10 2 Programming Methodology 10 3 Introduction to C11 15 4 Programming in C11 35 b. Weight
Class XI - Code: 083 Design of Question Paper for 2010-2011
Time: 3 Hours M.M. 70
Weightage oI marks over diIIerent dimensions oI the question paper shall be as Iollows: A. Weightage to diIIerent topics/content units
S.No. Topics Marks 1 Computer Fundamentals 10 2 Programming Methodology 10 3 Introduction to C 15 4 Programming in C 35
B. Weightage to diIIerent Iorms oI questions S.No. Forms of Questions Marks for each questions Number of questions Total Marks 1 Very Short Answer questions(VSA) 1 14 14 2 Short answer questions-Type I (SA I) 2 15 30 3 Short answer questions-Type II (SA II) 3 6 18 4 Long answer questions (LA) 4 2 8
C. Scheme oI Options There will be no overall choice. All questions are compulsory. D. DiIIiculty level oI questions
S.No. Estimated difficulty level Percentage of Marks 1 Easy 15 2 Average 70 3 DiIIicult 15
O Based on the above design, two sets oI sample papers along with their blue prints and Marking schemes have been included in this document.
O About 15 weightage has been assigned to questions testing higher order thinking (HOT) skills oI learners.
2 SAMLL ULS1ICN ALk SL1 I CCMU1Lk SCILNCL (083) C|ass kI &E PRINT
S.No. &NIT VSA (1 Mark) SA I (2Marks) SAII (3 Marks) A (4 Marks) TOT A (70 Marks) 1 COMP&TER F&NDAMENTAS a) SofLware concepLs CperaLlng SysLem b) number SysLem n) ncodlng Mlcroprocessor Memory ConcepLs
1(1) 4(4) 3(3)
2(1)
3(2) 4(4) 3(3)
2 PROGRAMMING METHODOOGY a) Ceneral ConcepLs b) roblem Solvlng MeLhodology and 1echnlque
3(3) 1(1)
4(2) 2(1)
7(5) 3(2) 3 INTROD&CTION TO C++ a) CeLLlng SLarLed b) uaLa 1ypes varlables and ConsLanLs c) CperaLors and presslons
1(1) 1(1)
4(2) 4(2) 2(1)
3(1)
4(2) 5(3) 6(5) 4 PROGRAMMING IN C++ a) llow of ConLrol b) luncLlons from header flles(SLrlngh cLypeh maLhh sLdllbh) c) user ueflned luncLlons d) SLrucLured uaLa 1ype Array e) user ueflned daLa Lypes f) SLrucLures
6(3)
2(1)
2(1) 2(1) (HOTS)
9(3)
3(1) 3(1)
4(1)(HOTS)
4(1)(HOTS)
9(3) 6(3)
5(2) 7(2) 2(1) 6(2)
14(14) 30(15) 18(6) 8(2) 70(37 ) 3 SAMPE Q&ESTION PAPER Set I Computer Science (083) Class - XI Time : 3 hours Maximum Marks : 70
General Instructions:- All the questions are compulsory The paper contain 7 Questions Programming language used. C
S.NO. Sub Part Question Marks Q1.
(a)
(b)
(c)
(d)
(e)
(I) Explain the need oI Operating System.
Name any two Utility SoItwares.
Convert the Iollowing : i) (213) 10 ( ?) 2
ii) (1100.01) 2 ( ?) 8
iii) (AF) 16 (? ) 2
iv) (56) 10 (? ) 8
What is the need Ior Cache memory ?
Which technology is used Ior sending inIormation through wireless devices ?
1024 KB GB 1 PB KB
2
1
(1*44)
1
1
1 Q2
(a)
(b)
(c)
(d)
(e)
(I)
(g) What is debugging ?
What is the diIIerence between Iinite and inIinite loop?
What do you understand by modularity ?
Give the diIIerence between source code and object code.
What are the diIIerences between an entry controlled loop and an exit controlled loop ?
What are the characteristics oI a good program ?
DiIIerentiate between syntax and logical errors. Give examples. 1
1
1
1
2
2
2
Q3.
(a)
(b) Name the header Iiles to which the Iollowing Iunctions belong. i) strcat( ) ii) clrscr() iii) pow() iv) isupper()
What are preprocessor directives ? Explain with example. 2
2 4
(c)
(d)
(e)
(I)
(g)
(h)
(i)
Give output oI the Iollowing program segments : (i) a=5; cout<<(a = = 8);
(ii) int a = 10; a 10 . cout << a : cout<< `a'; (iii) int x; char ch = 'A'; x = ch; cout << x;
Consider the Iollowing program code:
int R=25000; int S=2R; cout<<S<< <<R;
The above program does not give the desired output. Give reason. Also give the correct statement.
i) How a` is diIIerent Irom 'a? ii) Name and ~~ operators.
How many bytes oI memory is allocated to a and b, iI a and b are declared as below: int a; long b;
Solve the Iollowing:
i) 8 / 2 + 9 10 % 2 ii) a && b || a <= b if a = 10, b = 5
Variables a , b are integers and c is a Iloat. II a is 15 and b is 4 then what can be done to get the result oI a / b as a decimal and store the result in c. Write the appropriate statement.
1*33
2
2
1
2
1 Q4.
(a)
(b)
Write a Iunction to accept no. oI calls made by user and calculate the mobile call bill as per the Iollowing criteria:
No. of Calls Amount 0-50 Free 51-100 20p per call 101- 200 50 p per call 201 and above 75p per call Rent will be Rs 100 and is compulsory.
Give the output oI the Iollowing program segment: char fname50,= Charlie; 3
Write a Iunction that takes a long type variable as parameter and returns the sum oI its digits. Example Input : 3264 Output : Sum is 15
2
3
Q5.
(a )
(b)
Give the output oI the Iollowing program: # include <iostream.h int x=10;
void increase(int a,int &b, int c) , ++a; b++; ++c; Cout << a << '\t' << b << '\t' << c; ,
void main() , int x = 5,y = 10; increase(x, y, ::x); cout<<'\n'<<::x<<'\t'<<x<<'\t'<<y ,
Write a Iunction .4:39 that takes array - list, its size and an integer number as parameter and returns the numbers oI times n appears in the list. Example : Input : Array is 3 4 6 12 6 7 5 2 6 2
4
6
(c)
n is 6 Output : 3
Write a Iunction in C to print the sum oI leIt diagonal elements and right diagonal elements oI 3 x 3 matrix. Example Input : Array is 3 4 6 1 5 7 2 4 8 Output : Sum of left diagonal elements is 16
3
Q6.
(a)
(b)
(c)
d) Illustrate the use oI typedef with an example.
Rewrite the Iollowing program aIter correcting the error(s), iI any. Also underline the corrections made. # include<iostream.h # include<string.h int main( ) , int vehicleno, vehiclename30,,nowheels=0; cinvehicleno; gets(vehiclename); if (vehiclename= Car) nowheels=+4; ,
Rewrite the Iollowing code using switch case statements char ch ; int x,y,z; cinchxy; if (ch= ='+') z=x+y; else if (ch= = `-`) z = x- y; else if (ch = = `') z = x y; else cout<<Invalid Jperator;
Rewrite the Iollowing using hile loop int n=15, sume=0; for( int i=1; i<=n; i++) , if( i % 2 == 0 ) sume + = i ; , 2
2
3
3
Q.7 a)
Declare a structure studrec which contains rollno, name, address, and phoneno. Address is also a structure ads having house no, street no, city, state and country.
2
Studrec rollno name address phoneno houseno city streetno 7
b)
Declare a structure length that contains two members metre and centimeter oI type integer. This structure is used to store distance in metres and centimeters. Write a Iunction addlength() that takes two lengths as parameters and displays the sum oI these lengths. Example Input : ength 1 m 2 . cm 60 ength 2 m - 3, cm 80
Output : Sum of lengths m 6 cm 40
4
8 SAMPE Q&ESTION PAPER SET I Computer Science (083) Class - XI MARKING SCHEME Time : 3 hours Maximum Marks : 70
General Instructions:- All the questions are compulsory The paper contain 7 Questions Programming language used. C
S.NO. Sub Part Question Marks Q1.
(a)
(b)
(c)
(d)
(e)
(I) Explain the need oI Operating System. Ans: The need of OS is to perform . i) Disk management ii) File management iii) Memory management iv) IO management
Name any two Utility SoItwares. Ans: i) Antivirus ii) Disk Defragmentor
Convert the Iollowing : v) (213) 10 ( ?) 2
vi) (1100.01) 2 ( ?) 8
vii) (AF) 16 (? ) 2
viii) (56) 10 (? ) 8
Ans: ix) (213) 10 (11010101 ) 2
x) (1100.01) 2 (14.2 ) 8
xi) (AF) 16 (10101111) 2
xii) (56) 10 ( 70) 8
What is the need Ior Cache memory ? Ans: Cache is the fastest
memory of computer
Which technology is used Ior sending inIormation through wireless devices ? Ans: Bluetooth or IR(Infra Red Rays)
(g) Tracing and Rectifying the errors in a program.
What is the diIIerence between Iinite and inIinite loop? Ans: Finite loop- loop where the no. iterations is finite because lower bound and upper bound have finite values Infinite loop A loop where the no. of iterations is not a finite no. due to the conditions given. The loop will go on endlessly.
What do you understand by modularity ? Ans: Modularity- breaking up of a program into small modules or functions
Give the diIIerence between source code and object code. Ans: Source code- Program created by the userin high level language is source code. Eg- .cpp file
Obfect code- After compiling the source code the resultant binary program is the obfect code. Eg- .obf file
What are the diIIerences between an entry controlled loop and an exit controlled loop ? Ans. Entry controlled loop . The condition for termination is checked before entering the loop e.g. While ] }. The loop may not execute even once of the condition is not satisfied. Exit controlled loop . The condition for termination is checked after the statements in the loop. e.g.do ]} while(). The loop will always execute at least once. Even if the condition is not satisfied. Illustrate with suitable example
What are the characteristics oI a good program ? Ans: i) program should be user friendly ii) Meaningful variable names should be used iii) Optimum use of memory iv) Low execution time
DiIIerentiate between syntax and logical errors. Give examples. Ans: $yntax errors When the rule of writing a program is not followed properly, syntax errors occurs. Eg- couta Logical errors- errors occurring in the concept of a program. eg- if (a 3)
1
1
1
2
2
2
Q3.
(a)
Name the header Iiles to which the Iollowing Iunctions belong. v) strcat( ) vi) clrscr() vii) pow() viii) isupper() Ans: i) strcat( ) string.h It is used to set width ii) clrscr( ) conio.h It is used to find the absolute value. iii) Pow() math.h 2
10
(b)
(c)
(d)
(e)
(I)
iv) Isupper() ctype.h
What are preprocessor directives ? Explain with example. Ans. Preprocessor directives are lines included in the code of our programs that are not program statements but directives for the preprocessor. These lines are always preceded by a hash sign (). Examples are # define TABLESIZE 100 # define getmax(a,b) a~b?a.b # includeiostream.h~
Give output oI the Iollowing program segments : (iv) a=5; cout<<(a = = 8); Ans : 0
(v) int a = 10; a 10 . cout << a : cout<< `a'; Ans : 10
(vi) int x; char ch = 'A'; x = ch; cout << x; Ans: 65
Consider the Iollowing program code:
int R=25000; int S=2R; cout<<S<< <<R; The above program does not give the desired output. Give reason. Also give the correct statement. Ans: The range of an int is upto -32768 to 32767, and the output S is funk value as it exceeds limit and R will give the value 25000.
i) How a` is diIIerent Irom 'a? ii) Name and ~~ operators.
Ans: i) 1) a is character constant and 'a` is string constant 2) Si:e of a is 1 byte and si:e of 'a` is 2 bytes 3) a contains a single character a and 'a` contains two characters a and 0 ( Any two ) Ans .ii) Extraction and insertion opperators
How many bytes oI memory is allocated to a and b, iI a and b are declared as below: int a; long b;
2
1
1*33
2
1
1
11
(g)
(h)
Ans: i) 2 bytes ii) 4 bytes
Solve the Iollowing:
i) 8 / 2 + 9 10 % 2 Ans: 4 ii) a && b || a <= b if a = 10, b = 5 Ans: 1
Variables a , b are integers and c is a Iloat. II a is 15 and b is 4 then what can be done to get the result oI a / b as a decimal and store the result in c. Write the appropriate statement. Ans. c (float) a / b , Typecasting
2
1 Q4.
(a)
(b)
Write a Iunction to accept no. oI calls made by user and calculate the mobile call bill as per the Iollowing criteria:
No. of Calls Amount 0-51 Free 51-101 20p per call 101- 200 50 p per call 201 and above 75p per call Rent will be Rs 100 and is compulsory. Ans: void bill(int call) { float charge; if (call<=50) charge = 100; else if((call>=51) && (call<=100)) charge=100+0.2*(call-50); else if((call>=101) && (call <= 200)) charge=100+ 0.2*50 + 0.5 * (call-100); else charge=100+0.2*50+0.5*100+0.75*(call-150); cout<<"Total Charge = `<<charge; }
Give the output oI the Iollowing program segment: char fname50,= Charlie; char lname50 ,= Tango; for (int i=0; i<strlen(lname)-2;++i) lnamei, = toupper( lnamei,); puts(lname); cout<<endl; strcat(lname, ); strcat(lname,fname); cout<<lname<< <<fname;
Ans: TANgo TANgo Charlie Charlie 3
2
12
(c)
(d)
Consider the Iollowing program code. Select the expected output Irom the options(i) to (iv)
# include <iostream.h # include <stdlib.h void main( ) , randomize(); int dice = 6, res; res = random(dice) + 1; for (int i = 1 ; i<res ; ++i) cout << I << ; ,
Also justiIy your answer. Ans: 1 2 3 4 5 As random( ) will generate number from 0 to 5 so the value of dice will be from 0 to 5. res will be from 1 to 6. Also loop is starting from 1 so (i) ,(iii) and (iv) can not be the possible output as they are not starting from 1.
Write a Iunction that takes a long type variable as parameter and returns the sum oI its digits. Example Input : 3264 Output : Sum is 15 Ans. int sumdigit( long num ) { int digit, sum = 0; while( num > 0 ) { digit = num % 10 ; sum = sum + digit; num = num / 10 ; } return(sum) }
2
3
Q5.
(a )
Give the output oI the Iollowing program: # include <iostream.h int x=10;
void increase(int a, int &b, int c) , ++a; b++; ++c; cout << a << '\t' << b << '\t' << c; ,
void main() , int x = 5,y = 10; 2
13
(b)
(c)
increase(x, y, ::x); cout<<'\n'<<::x<<'\t'<<x<<'\t'<<y ,
Ans: 6 11 11 11 5 10
Write a Iunction .4:39 that takes array - list, its size and an integer number as parameter and returns the numbers oI times n appears in the list. Example : Input : Array is 3 4 6 12 6 7 5 2 6 n is 6 Output : 3 Ans: int count(int list[], int size, int n) { int ctr=0; for ( int I = 0 ; I < size; ++ i) if (list[i] == n) ctr++; return ctr; }
Write a Iunction in C to print the sum oI leIt diagonal elements and right diagonal elements oI 3 x 3 matrix. Example Input : Array is 3 4 6 1 5 7 2 4 8 Output : Sum of left diagonal elements is 16 38 void sumdiag(int sqmatrix[ ][3] ) { int suml=0; for (int i = 0; i<3;++i) for (int j = 0; j<3;++j) if (i==j) suml += sqmatrix[i][j]; cout <<" sum of left diagonal elements is "<< suml; }
4
3
Q6.
(a)
(b)
Illustrate the use oI typedef with an example.
Ans : The typedef keyword allows you to create a new alias for an existing data type. For example: typedef unsigned int nint; // data1 and data2 have the same type nint data1; unsigned int data2;
Rewrite the Iollowing program aIter correcting the error(s), iI any. Also underline the corrections made. # include <iostream.h # include <string.h int main() 2
2
14
(c)
d) , int vehicleno, vehiclename30,,nowheels=0; cinvehicleno; gets(vehiclename); if (vehiclename= Car) nowheels=+4; , 38 # include <iostream.h> # include <string.h> # include <stdio.h> int main( ) { int vehicleno, vehiclename[30],nowheels=0; cin>>vehicleno; gets(vehiclename); if (!strcmp(vehiclename, ` Car") nowheels+=4; return 0; } Rewrite the Iollowing code using switch case statements char ch ; int x,y,z; cinchxy; if (ch= ='+') z=x+y; else if (ch= = `-`) z = x- y; else if (ch = = `') z = x y; else cout<<Invalid Jperator; 38 char ch ; int x, y, z; cin >> ch >> x >> y; switch(ch) { case + : z = x+y; break; case - : z = x-y; break; case * : z = x*y; break; default : cout<< ` Not a valid operator"; }
Rewrite the Iollowing using hile loop int n=15, sume=0; for( int i=1; i<=n; i++) , if( i % 2 == 0 ) sume + = i ; ,
38 int n=15, sume=0, i = 1; while( i <= n ) , if( i % 2 == 0 ) sume + = i ; }
3
3
15 Q.7 a)
b)
Declare a structure studrec which contains rollno, name, address, and phoneno. Address is also a structure ads having house no, street no, city, state and country.
Declare a structure length that contains two members metre and centimeter oI type integer. This structure is used to store distance in metres and centimeters. Write a Iunction addlength() that takes two lengths as parameters and displays the sum oI these lengths. Example Input : ength 1 m 2 . cm 60 ength 2 m - 3, cm 80
4 Studrec rollno name address phoneno houseno city streetno 16
SAMLL ULS1ICN ALk SET II CCMU1Lk SCILNCL (083) C|ass kI &E PRINT
S.No. &NIT VSA (1 Mark) SA I (2Marks ) SAII (3 Marks) A (4 Marks) TOT A (70 Marks) 1 COMP&TER F&NDAMENTAS a) SofLware concepLs CperaLlng SysLem b) number SysLem n) ncodlng Mlcroprocessor Memory ConcepLs
2(2) 4(4) 2(2)
2(1)
2(2) 4(4) 4(3)
2 PROGRAMMING METHODOOGY a) Ceneral ConcepLs b) roblem Solvlng MeLhodology and 1echnlque
1(1) 3(3)
2(1) 4(2)
3(2) 7(5) 3 INTROD&CTION TO C++ a) CeLLlng SLarLed b) uaLa 1ypes varlables and ConsLanLs c) CperaLors and presslons
1(1) 1(1)
4(2) 2(1) 4(2)
3(1)
4(2) 3(2) 8(4) 4 PROGRAMMING IN C++ a) llow of ConLrol b) luncLlons from header flles(SLrlngh cLypeh maLhh sLdllbh) c) user ueflned luncLlons d) SLrucLured uaLa 1ype Array e) user ueflned daLa Lypes f) SLrucLures
4(2) 2(1)
2(1) 2(1) 2(1) HOTS
3(1) 3(1)
3(1) 6(2)
4(1)HOTS
4(1)HOTS
7(3) 5(2)
3(1) 12(4) 2(1) 6(2)
14(14) 30(15) 18(6) 8(2) 70(37 )
17 SAMPE Q&ESTION PAPER SET II COMP&TER SCIENCE (083) Class - XI Time : 3 hours Maximum Marks : 70
General Instructions:- All the questions are compulsory The paper contain 7 Questions Programming language used. C S.NO. Sub Part Questions Marks Q1.
(a)
(b)
(c )
(d)
(e)
(I) DeIine Database Management System (DBMS). Name two database packages.
Name any 2 anti virus soItware
Arrange the units oI storage in descending order. TB, GB, PB,MB
Give the Full Iorm oI ASCII
Convert the Iollowing:- (1) (45.54) 10 (?) 2
(2) (735 )8 (?) 2
(3) (110100101111) 2 (?) 10
(4) (A3F) 16 (?) 2
DiIIerentiate between PS-2 port and serial port.
1
1
1
1
1X4
2 Q2
(a)
(b)
(c )
(d)
(e)
Arrange in order:- (i) Coding oI the program (ii) Design the program (iii) Testing the program (iv) Analyze the problem (v) Understand the problem
DiIIerentiate between /*...*/ and //
How many times the Iollowing loop will be executed:- for( int i=0;i<20;i+=2)
IdentiIy the correct identiIiers(any 2):- (i). AS_G_D (ii) 2wer (iii) roll number (iv) S.I. (v) age123 (vi) rate
What is the purpose oI Indentation? Indent the Iollowing program: -
#include<iostream.h void main() ,int i=0; for (i=0;i<20;i++), cout<<i;
1
1
1
1
2
18
(I)
(g) cout<<endl;, ,
IIelse is used instead oI switch-case in certain program segments, why? Explain giving examples.
IdentiIy the number oI variables Ior input and output in the Iollowing case study:- ABC bank wants to calculate Simple interest oI a customer depending upon the principle value, rate oI interest and time period. Note: - Simple Interest (Principal * Rate * Time period) /100
2
2
Q3.
(a)
(b)
(c)
(d)
(e)
(I)
(g)
(h)
IdentiIy the data types Ior the Iollowing (i) a` (ii) 0x234
Write an expression to Iind the greater oI two variables x, y and store in z using conditional/ternary operators.
Give the name oI related header Iiles (i) abs( ) (ii) atoi( ) (iii) setw ( ) (iv) isalpha ( )
What is the importance oI main ( ) in a C program?
How many bytes are required by the Iollowing (i) short int (ii)unsigned long (iii) long double (iv) signed char
II we are having Iour variables named as a, b, c, d having values 4 ,7,12,4 respectively .Solve the related expression Iollowing (i) (a~b)&&(a d),,(c~d) (ii) (ba)&&(d~a),,(ca) (iii) (True && ! False) ,, False
What is typecasting? Give an appropriate example.
What will be the output oI Iollowing code segment: includeiostream.h~ includeconio.h~ void main()
Convert Iollowing Ior loop into while loop:- fact=1; sum=0; for(int i=1;i<10;i++) , for(int j=i;j=1;j--) , fact=factj; , sum=sum+fact; fact=1; , Write a Iunction to accept garmentcode, cost oI the garment as input and calculate the bill amount aIter deducting DISCOUNT as per the Iollowing criteria: No. of Calls Amount ess than 500 no discount 501-2000 5 discount 2001-3000 10 discount 3001 and above 15 discount
Find the output:- (i) cout<< strcmp(computer,computer); (ii) cout<<isdigit(`b'); (iii) cout<<toupper(`m'); (iv) cout<<strlen(computer 123#5); (v) cout<<sqrt(pow(5, 2)); (vi) cout<<floor(7.8);
Write a user deIined Iunction Patternprinting() which takes a character and number oI time to print as argument and print triangle . Example
Input Char - *` No oI times 5 Output * ** *** **** *****
2
3
3
3
Q5.
(a)
Find the errors in the Iollowing code segment , int a5.5 ,=,1,7,8,9,10,; sum=0; 2
20
(b)
(c)
for (i=0;i<5;i++) if(ai,%2==0) sum +=a(i); else sum = - at,; coutsum=sumendl; ,
Consider the given code and answer question a to d 1 #include<iostream.h 2 #include<conio.h 3 void main() 4 , 5 int a,b; 6 cinab; 7 int disp(int , int &); 8 cout<< disp(a,b); 9 , 10 int disp(int x, int &y) 11, 12 int z=x+y; 13 return z; 14 , a. IdentiIy the line number in which Iunction prototype is given b. IdentiIy the line number where the Iunction disp() is called c. IdentiIy the number and types oI arguments d. What is the return type oI the Iunction disp()
Write a user deIined Iunction lsearch( ) which takes three parameters an integer array, size oI array and element to be search and Iunction return position oI the element iI the element is Iound and 0 iI not Iound Example:- Array 2,4,8,11,23,45,67,78,90} Element to search 11 Function should return 4
*42
3 Q6.
(a)
(b)
Consider the Iollowing code: - #define area(a) aa void Aarea(int a) , return aa; , void main ( ) , cout<<area(5+7); //Statement no 1 cout<<Aarea(5+7);// Statement no 2 , The output oI Statement no 1 and Statement 2 will not be same. Give the output and the explanation.
Write a user deIined Iunction in c which takes a string as parameter and it should also display total number oI words in the 2
3
21
(c)
string and return number oI words starting with A`. Note:- Assuming that each word is separated by a single space. Example:- String: An Apple A Day Keeps A Doctor aay Output:8 Function should return 4
Write a user deIined Iunction which takes one integer type 2-D array, no. oI rows, no. oI column as parameter and display product oI the elements oI each column
Example: Array 1 2 4 7 2 3 1 0 3 5 6 9 Output Column no 1: 6 Column no 2:30 Column no 3:24 Column no 4:0
4
Q7.
(a)
(b) What will be the output oI the Iollowing code:- struct Grocery , int I_no; char I_name20,; float I_price; int I_qty; ,; void main() , Grocery S4,=,,1,Bread,11.0,20,, ,2, Butter,25.0,40,, ,3,Cream,65,15,, ,4,Jam,95.5,20,,; cout<<S0,.I_no; cout<<S1,.I_name3,; cout<<S2,.I_qty; cout<<S3,.I_name; ,
Declare a structure Student with the Iollowing elements:
Rollno integer type Name string type DOB date type Marks An array oI Iloat type to store marks in 5 subjects Average Iloat
Write Iollowing user deIined Iunction in c to implement the above structure : 1 A Iunction Readstudent() which takes a structure object as a reIerence parameter and accept values oI Rollno, Name,
*42
4
22 DOB,Marks array
2. A Iunction CalculateAvg() which takes a structure object as a parameter and calculates the average marks oI the student
23 SAMPE Q&ESTION PAPER SET II COMP&TER SCIENCE (083) Class - XI Marking Scheme Time : 3 hours Maximum Marks : 70
S.NO. Sub Part Questions Marks Q1.
(a)
(b)
(c )
(d)
(e)
DeIine Database Management System (DBMS). Name two database packages.
Anser:- A Database Management System is a package that can handle or manage bulk oI stored data Example:- Ioxpro, Oracle, mysql, Ms- Acess
mark Ior correct deIinition mark Ior correct examples.
Anser:- PS/2 Port: - It stands Ior Personal System/2. It is most oIten used to plug in keyboard or mouse. Serial Port: - It transIers data serially one bit at a time. They are typically used to connect modem.
1 mark Ior each correct deIinitions mark Ior each correct example
2
Q2
(a)
(b)
(c )
(d)
Arrange in order:- (vi) Coding oI the program (vii) Design the program (viii) Testing the program (ix) Analyze the problem (x) Understand the problem
Anser:- (i) Understand the problem. (ii) Analyze the problem (iii) Design the program (iv) Coding oI the program (v) Testing the program
1 mark Ior correct order
DiIIerentiate between /*...*/ and //
Anser: - /*...*/ Multiline Comment // Single Line Comment
marks Ior each correct answers.
How many times the Iollowing loop will be executed:- for( int i=0;i<20;i+=2)
Anser:- 10 times.
1 mark Ior correct answer
IdentiIy the correct identiIiers(any 2):- (i). AS_G_D (ii) 2wer (iii) roll number (iv) S.I. (v) age123 (vi) rate
1
1
1
1
25
(e)
(I)
(g)
Anser:- Correct IdentiIiers:- ASGD, rate, age123
marks Ior any 2 correct identiIier
What is the purpose oI Indentation? Indent the Iollowing program: - #include<iostream.h void main() ,int i=0; for (i=0;i<20;i++), cout<<i; cout<<endl;, ,
Anser:- Indentation makes the program more readable and presentable. Its main role is to highlight nesting eg groups oI control statements. #include<iostream.h void main() , int i=0; for (i=0;i<20;i++) , cout<<i; cout<<endl; , ,
1 marks Ior correct purpose. 1 mark Ior indentation.
iI-else is used instead oI switch-case in certain program segments, why? Explain giving examples.
Anser:- Switch-case is not suitable where you need to check the range OI values. For example:- Grade allocation Ior percentage as shown below: 100 90 GRADE A 91 70 GRADE B switch case not suitable 71 50 GRADE C 50 GRADE D
1 mark Ior correct explanation 1 mark Ior appropriate example. OR 2 marks Ior appropriate Example with its explanation.
IdentiIy the number oI variables Ior input and output in the Iollowing case study:- ABC bank wants to calculate Simple interest oI a customer depending upon the principle value, rate oI interest and time period. Note: -
2
2
2 26 Simple Interest (Principal * Rate * Time period) /100 Anser: - Three Input Variables. One Output Variable. 1 mark each Ior correct answer No mark to be deducted Ior giving name
Q3.
(a)
(b)
(c)
(d)
(e)
(I)
IdentiIy the data types Ior the Iollowing (ii)a` (ii) 0x234
Answer:- (i)char (ii)int mark each Ior each correct data type
Write an expression to Iind the greater oI two variables x, y and store in z using ternary operators
Anser:- z(x~y)?x:y; 1 mark Ior correct answer No mark Ior any other answer
Give the name oI related header Iiles (i) abs( ) (ii) atoi( ) (iii) setw ( ) (iv) isalpha ( ) Anser:- (i) math.h (ii) stdlib.h (iii) iomanip.h (iv) ctype.h mark Ior each correct answer.
What is the importance oI main ( ) in a program?
Anser:- Every c program execution begins at main ( ) and continues by sequentially executing the statements within main ( ). 1 mark Ior correct explanation How many bytes are required by the Iollowing (ii)short int (ii)unsigned long (iii) long double (iv) signed char
Anser:- (i) 2 Bytes (ii) 4 Bytes (iii) 10 Bytes (iv) 1 Byte mark Ior each correct answer.
II we are having Iour variables named as a, b, c, d having values 4 ,7,12,4 respectively .Solve the related expression Iollowing (iv) (a~b)&&(a d),,(c~d) (v) (ba)&&(d~a),,(ca) (vi) (True && ! False) ,, False Anser:- (i) true or 1 (ii) Ialse or 0 1
1
2
2
2
1X3
27
(g)
(h)
(iii) true or 1
1 mark each Ior each correct answer
What is typecasting? Give an appropriate example.
Anser:- Explicit conversion oI an operand Irom one data type to another is called type casting. Example : (Iloat) (xy/2) // assume x and y are int type It will evaluate the result to type Iloat. 1 mark Ior correct deIinition 1 mark correct example
What will be the output oI Iollowing code segment: #include<iostream.h #include<conio.h void main() , int a,b; a=20; b=35; a++; cout<<a<<,; cout<<++a<<endl; cout<<b++<< , ; cout<<b; ,
Anser:- 21,22 35, 3 1 mark Ior each correct line mark to be deducted Ior ignoring new line character
2
2
Q4.
(a)
What will be the possible output oI the Iollowing Iunction void Rprint() , randomise( ); int x=random(3)+1; for(int i=0;i<=x;i++) cout<<i+2<<,; , (v) 0,1,2,3,4,,5 (vi) 1,2,3,4,5 (vii) 2,3,4,5 (viii) 2,3,4,5,6,
Anser: Option (iii) is correct because iI the random number will generate values between 0 to 2 and value oI x will vary Irom 1 to 3 so possible outputs can be (i) 2,3 (ii) 2,3,4 2
28
(b)
(c)
(iii) 2,3,4,5 1 mark Ior correct answer 1 mark Ior correct reason
Convert Iollowing Ior loop into while loop:- fact=1; sum=0; for(int i=1;i<10;i++) , for(int j=i;j=1;j--) , fact=factj; , sum=sum+fact; fact=1; ,
Anser:
fact=1; sum=0; int i=1; while(i<10) ,j=i; while(j=1) , fact=factj; j--; , sum=sum+fact; fact=1; i++ , 1 mark Ior each correct loop.
Write a Iunction to accept cost oI the garment as input and calculate the bill amount aIter deducting DISCOUNT as per the Iollowing criteria: No. of Calls Amount ess than 500 no discount 501-2000 5 discount 2001-3000 10 discount 3001 and above 15 discount void bill(int cost) , float Bill_amt,discount; if (cost<=500) discount=0; else if((cost=501) && (cost<=2000)) discount=5/100cost; else if((cost=2001) && (cost <= 3000)) discount=10/100cost; else discount=15/100cost;
Find the output:- (i) cout<< strcmp(computer,computer); (ii) cout<<isdigit(`b'); (iii) cout<<toupper(`m'); (iv) cout<<strlen(computer 123#5); (v) cout<<sqrt(pow(5, 2)); (vi) cout<<floor(7.8);
Anser: (i) 0 (ii) 0 (iii) M (iv) 14 (v) 5 7
mark Ior each correct answer
Write a user deIined Iunction Patternprinting() which takes a character and number oI time to print as argument and print lower triangle. Example
Input Char - *` No oI times 5 Output * ** *** **** ***** Anser: Using Ior loop: void PatternPrinting(char x, int y) , for(int i=0;i<y;i++) ,for(int j=0;j<=i;j++) cout<< x; cout<<endl;, , Using while and Ior loop: void Pattern_prinitng(char x, int y) , int i=0; whlie(i<y) ,for(int j=0;j<=i;j++) cout<< x; cout<<endl; , i++; ,
3
3
30 Using while loop only: void Pattern_prining(char x, int y) , int i=0; whlie(i<y) ,int j=0; while(j<=i) ,cout<< x; cout<<endl; j++; , i++;, , Or any other correct logic.
mark Ior each correct loop. mark Ior correct Iunction header. mark Ior declaring variables correctly. mark Ior displaying the character. mark Ior correct placement Ior newline character Q5.
(a)
(b)
Find the errors in the Iollowing code segment , int a5.5 ,=,1,7,8,9,10,; sum=0; for (i=0;i<5;i++) if(ai,%2==0) sum +=a(i); else sum = - at,; coutsum=sumendl; ,
Answer: Find the errors in the Iollowing code segment , int a5 ,=,1,7,8,9,10,; i39 sum=0; for (i39 i=0;i<5;i++) if(ai,%2==0) sum +=a[i]; else sum -= a[i]; cout<<sum=<<sum<<endl; ,
mark each Ior identiIying any 4 errors
Consider the given code and answer question a to d 1 #include<iostream.h 2 #include<conio.h 3 void main() 4 , 5 int a,b; 6 cinab; 7 int disp(int , int &); 2
*42
31
(c)
8 cout<< disp(a,b); 9 , 10 int disp(int x, int &y) 11, 12 int z=x+y; 13 return z; 14 ,
a. IdentiIy the line number in which Iunction prototype is given b. IdentiIy the line number where the Iunction disp() is called c. IdentiIy the number and types oI arguments d. What is the return type oI the Iunction disp()
Anser:- a. line no 7 b. line no 8 c. number oI arguments 2, 1 st argument - call by value and 2 nd
argument - call by reIerence d. int mark Ior each correct answer
Write a user deIined Iunction lsearch( ) which takes three parameters an integer array, size oI array and element to be search and Iunction return position oI the element iI the element is Iound and 0 iI not Iound Example:- Array 2,4,8,11,23,45,67,78,90} Element to search 11 Function should return 4
Answer: int lsearch(int a||,int n, int e)
int f=0; for(int i=0; i<n;i++) , if(ai,==e) f=i+1; , return f; , or int lsearch(int a,,int n, int e) , for(int i=0; i<n;i++) , if(ai,==e) return i+1; , return 0; }
Or any other correct logic.
3 32
1 mark Ior correct loop. 1 mark Ior correct Iunction header. mark Ior Iinding element (Correct iI condition) mark Ior correct return statement Q6.
(a)
(b)
Consider the Iollowing code: - #define area(a) aa void Aarea(int a) , return aa; , void main ( ) , cout<<area(5+7); //Statement no 1 cout<<Aarea(5+7);// Statement no 2 , The output oI Statement no 1 and Statement 2 will not be same. Give the output and the explanation.
Anser:- Aanswer oI statement no 1 is 47 and statement no 2 is 144 Reason: Statement no 1 replace the text Ior the value as 57*5747 Statement no 2 will pass the value to variable aIter solving the expression thereIore it will pass 12
Write a user deIined Iunction in c which takes a string as parameter and it should also display total number oI words in the string and return number oI words starting with A`. Note:- Assuming that each word is separated by a single space. Example:- String: An Apple A Day Keeps A Doctor aay Output:8 Function should return 4
Anser:- int Count_str(char s ,) , int w=0;wa=0; for (int i=0;si,!='\0';i++) , if (si,==' `) w++: if((si,==' ` && si+1,=='A') || (s0,=='A') wa++; , cout<<\n No of words << w+1; return wa; ,
Or any other correct logic. 2
3
33
(c)
mark Ior each correct loop. mark Ior correct Iunction header. mark Ior Iinding element Ior counting word Ior counting word beginning with A mark Ior correct return statement
Write a user deIined Iunction which takes one integer type 2-D array, no. oI rows, no. oI column as parameter and display product oI the elements oI each column Example: Array 1 2 4 7 2 3 1 0 3 5 6 9 Output Column no 1: 6 Column no 2:30 Column no 3:24 Column no 4:0
Answer:- void array(int a ,5,, int r, int c) , int p; for(int i=0; i<c;i++) , p=1; for(int j=0;i<r;i++) , p=aj,i,; , cout<<\n Coulmn no<<i+1<<:<<p; , Or any other correct logic. mark Ior each correct loop. 1 mark Ior correct Iunction header. 1 mark Ior calculation and display oI product
3
34 Q7.
(a)
(b) What will be the output oI the Iollowing code:- struct Grocery , int I_no; char I_name20,; float I_price; int I_qty; ,; void main() , Grocery S4,=,,1,Bread,11.0,20,, ,2, Butter,25.0,40,, ,3,Cream,65,15,, ,4,Jam,95.5,20,,; cout<<S0,.I_no; cout<<S1,.I_name3,; cout<<S2,.I_qty; cout<<S3,.I_name; ,
Anser: 1t15Jam 2 marks Ior correct output mark Ior each correct part 1 t 15 Jam
Declare a structure Student with the Iollowing elements: Rollno integer type Name string type DOB date type Marks An array oI Iloat type to store 5 elements Average Iloat
Write Iollowing user deIined Iunction in c to implement the above structure 1) A Iunction Readstudent() which takes a structure object as a reIerence parameter and accept values oI Rollno, Name, DOB,Marks array 2) A Iunction CalculateAvg() which takes a structure object as a parameter and calculates the average marks oI the student
Anser:- struct Date , int dd,mm,yy; ,; struct Student , int Rollno; char Name20,; Date DJB; *42
1 1 1 4
35 float Mark5,,Average; ,;
void Input(Student &S) , cout<<\n Enter Rollno of student; cinS.Rollno; cout<<\n Enter Name of student; gets(S.Name); cout<<\n Enter the Date of Birth ; cinS.DJB.ddS.DJB.mmS.DJB.yy; for(int i=0;i<5;i++) , cout<<\n Enter marks in subject no<<i+1; cinS.Marksi,; , ,
void Calculate_avg(Student &S) , float Sum=0; for(int i=0;i<5;i++) , Sum+=S.Marksi,; , S.Average=Sum/5; , Or any other correct logic. mark to be deducted Ior each incorrect structure
mark Ior correct Iunction header Ior accepting rollno and name Ior accepting marks in loop mark Ior correct Iunction header. Ior calculating sum in loop Ior calculating average