Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK QNO 1 (a) 1 (a) Define the following terms: (i) Inheritance (ii) Encapsulation 2 1998 Delhi Board 1(a) Differentiate between a Run Time Error and Syntax Error. Also give suitable examples of each in C++. 2 Sample Paper I 1998 1. (a) Write two major difference between Object Oriented Programming and Procedural Programming? 2 Sample Paper Set II 1998 1 (a) Why main function is special? Give two reasons 2 1999 Delhi Board 1(a) Write two advantages of using include compiler directive? 1999 Outside Delhi 2 1 (a) Illustrate the concept of function overloading with the help of an example. 2000 Delhi Board 2 1 (a) Illustrate the concept use of this pointer with the help of an example. 2000 Outside Delhi Board 2 1 (a) Illustrate the concept of function overloading with the help of an example. Compartment 2000 2 1 (a) Encapsulation is one of the major properties of OOP. How is it implemented in C++? 2 2001 Delhi Board 1(a) Reusability of classes is one of the major properties of OOP. How it is implemented in C++? 2001 Outside Delhi 2 1 (a) What the purpose of a header file in a program? 2 1 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 2002 Delhi Board 1 (a) illustrates the concept of inheritance with the help of an example? 2002 Outside Delhi Board 2 1. (a) What is the difference between call by value and call by reference? Give an example in C++ to illustrate the same Delhi Board 2003 2 1. (a) What is the difference between Local Variable and Global Variable? Also, give a suitable C++ code to illustrate same. Outside Delhi Board 2003 2 1. (a) What is the difference between Local Variable and Global Variable? Also, give a suitable C++ code to illustrate same. Compartment 2003 2 1 (a) What is inheritance? Give an example in C++ to show its implementation in C++ 2004 Delhi Board 2 1. (a) What is polymorphism ? Give an example in C++ to show its implementation in C++. 2004 Outside Delhi Board 2 1. (a) What is polymorphism ? Give an example in C++ to show its implementation in C++. 2004 Compartment 2 1. (a) What is the difference between call by value and call by reference? Give an example in C++ to illustrate the same Delhi Board 2005 2 1.(a) Differentiate between a default constructor and copy constructor, using suitable examples of each Outside Delhi Board 2005 2 1. (a) What are the advantages of Object Oriented Programming over Procedural Programming? Compartment 2005 2 1. (a) Name the header file to which the following belong: (i) (ii) abs( ) isupper( ) 1 2006 Delhi 1. (a) Name the header file to which the following belong : (i) pow() (ii) random() 1 2006 OD 1. (a) Name the header file to which the following belong : (i) gets() (ii) open() 1 Compartment 2006 2 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 1. (a) Differentiate between a Run Time Error and Syntax Error. Also give suitable examples of each in C++. 2007 Delhi 2 1. (a) Differentiate between a Logical Error and Syntax Error. Also give suitable examples of each in C++. 2007 Outside Delhi 2 1. (a) What is the difference between #define and const? Explain with suitable example. 2008 D 2 1.(a) What is the difference between type casting and automatic type conversion? Explain with suitable example. Compartment 2008 2 1(a) What is the purpose of using a typedef command in C++. Explain with suitable example. 2008 OD 2 1. (a) What is the difference between call by value and call by reference? Give an example in C++ to illustrate both. 2009 D 2 1. (a) What is the difference between Actual Parameter and Formal Parameter? Give an example in C++ to illustrate both types of parameters. 2009 OD 2 1.(a) What is the function of #define keyword? Give an example to illustrate its use. Compartment 2009 2 1. (a) What is the difference between automatic type conversion and type casting? Also, give a suitable C++ code to illustrate both. 2010 D 2 1. (a) What is the difference between call by value and call by reference? Give an example in C++ to illustrate both. 2010 OD 2 1. (a) What is the difference between Local Variable and Global Variable? Also, give a suitable C++ code to illustrate both. 2011 D 2 1. (a) What is the difference between automatic type conversion and type casting? Also, give a suitable C++ code to illustrate both. 2011 OD 2 1. (a) What is the difference between Global Variable and Local Variable? Sample Paper Set I 2009 2 3 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 1. (a) What is the difference between Object Oriented Programming and Procedural Programming? Sample Paper Set II 2009 2 1. (a) What is the difference between Global Variable and Local Variable? 2 (Sample Paper Set I 2010 (Repeated in Sample Paper Set 1 2009) ) 1 ( a ) What is the difference between Actual Parameter and Formal Parameters ? Also, give a suitable C++ code to illustrate both. Sample Paper Set II - 2010 (asked in 2009 OD) 2 1 (a) Differentiate between the post-increment and pre-increment operators. Also, give suitable C++ code to illustrate both. 2 Sample Paper Set I - 2012 1 (a) What is the difference between Actual Parameter and Formal Parameters? Also, give a suitable C++ code to illustrate both. 2 Sample Paper Set II - 2012 (asked in 2009 OD and Sample Paper 2010 Set II) 1. (a) What is the difference between automatic type conversion and type casting? Also, give a suitable C++ code to illustrate both. 2 2012 OD (Repeated, asked in the year 2010 Delhi Paper) QNO 1 (b) 1 (b) Name the header file, to which following built-in function belong to: (i) cos() (ii) setw() (iii) toupper() (iv) strcpy() 1 1998 Delhi Board 1(b) Name the header files of C++ to which the following functions belong: 1 (i) strcat () (ii) scanf () (iii) getchar() (iv) clrscr () 1999 Delhi Board 1(b) Name the header file, to which following built-in functions belong: (i) isupper() (ii) setw() (iii) exp() (iv) strcmp() 1 2000 Delhi Board 4 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 1 (b) Name the header file to be included for the use of following built-in functions: 1 (i) frexp() ii) toupper() 2001 Delhi Board 31 1(b) Name the header files C++ to which the following functions belong: 1 (i) write() (ii) arc(iii) open() (iv) strlen() 2002 Delhi Board 32 (b) Write the names of the header files to which the following belong : 2 (i) getst( ) (ii) strcmp( ) (iii) abs( ) (iv) isalnum( ) 2004 Delhi Board 33 1(b) Illustrate the use of #define in C++ to define a macro. 2 2006 Delhi 34 1(b) Illustrate the use of inline function in C++ with the help of an example. 2 2006 Outside Delhi 35 1(b) Name the header file(s) that shall be needed for successful compilation of the following C++ code : 1 2007 Delhi void main( ) { char Text[40]; strcpy(Text, ”AISSCE”); puts(Text); } 36 1(b) Name the header file(s) that shall be needed for successful compilation of the following C++ code. 1 2007 Outside Delhi 37 1(b) Name the header files that shall be needed for the following code 1 2008 Delhi void main ( ) { char String [ ] = “Peace”; cout<<setw (20) << String; } 38 1 (b) Name the header files that shall be needed for the following code: 1 2008 Out side Delhi void main ( ) 5 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { char Word [ ] =”Exam”; cout<<setw(20)<<Word; } 39 1 (b) Write the names of the header files to which the following belong: (i) puts( ) (ii) sin( ) 1 2009 Delhi 40 1 (b) Write the names of the header files to which the following belong: 1 (i) setw( ) (ii) sqrt( ) 2009 Outside Delhi 41 1 (b) Which C++ header file(s) will be essentially required to be included to run/execute the following C++ code? 1 2010 Delhi void main( ) { int Eno=123, char Ename[ ]=”Rehan Swamp”; cout<<setw(5)<<Eno<<setw(25)<<EName<<endl; } 42 1(b) Which C++ header file(s) will be essentially required to be included to run/ execute the following C++ code: 1 2010 Outside Delhi void main() { int Rno=24; char Name[] =”Amen Singhania”; cout<<setw(lO)<<Rno<<setw(20)<<Name<<endl; } 43 1(b) Write the names of the header files, which is/are essentially required to run/ execute the following C++ code: 1 2011 Delhi void main ( ) { char C, String [ ] = "Excellence Overload"; for (int I=0; String [ I ] ! = '\ 0'; I ++ ) if (String [I] ==' ') cout<<end1; else 6 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { C=toupper(String[I]); cout<<C ; } } 44 (b) Write the names of the header files, which is/are essentially required to run/ execute the following c++ code: 1 2011 Outside Delhi void main ( ) { char CH,Text[ ] ="+ve Attitude"; for (int I=0 ; Text[I] ! ='\0' ;I++) if (Text[I]== ' ') cout<<end1; else { CH=toupper (Text [I]) ; cout<<CH; } } 45 1(b) Write the names of the header files to which the following belong: 1 (i) strcmp() (ii) fabs() Sample paper 2009 Set I 46 1(b) Write the names of the header files to which the following belong: 1 Sample paper 2009 Set II (i) frexp() (ii) isalnum() 47 1 (b) Which C++ header file(s) will be essentially required to be included to run / execute the following C++ code: 1 2010 Sample Paper Set I void main() { char Msg[ ]="Sunset Gardens"; for (int I=5;I<strlen(Msg);I++) puts(Msg); } 48 (b) Write the names of the header files to which the following belong: 1 2010 Sample Paper Set II (Repeated in Sample paper 2009 Set II) 7 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) frexp() (ii) isalnum() 49 (b) Which C++ header file(s) are essentially required to be included to run/execute the following C++ code: 1 Sample paper 2012 Set I void main ( ) { int Last =25 ; for ( int C=9 ; C <= Last ; C ++ ) cout<< C << “ : “ <<sqrt ( C ) <<endl; } 50 (b) Write the names of the header files to which the following belong: 1 2010 Sample Paper Set II (i) exp() (ii) strcmpi() 8 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 51 (b) Which of the header file(s) are essentially required to be included to run / execute the following C++ source code. (Note: Do not include any header file which is / are not required ) 1 2012 Outside Delhi void main ( ) { char TEXT [ ] = “Something” ; cout<< “Remaining SMS Chars : “ << 160-strlen(TEXT)<<endl; } QNO 1 (c) 52 1(c) Find the syntax error, if any, in the following program 2 1998 Delhi Board #include <iostream.h> void main() { int R;W = 90; while W > 60 { R = W- 50; switch(W) { 20:cout << "Lower Range"<<endl; 30:cout<< "Middle Range"<< endl; 40: cout<< "Higher Range"<<endl; } } } 53 1(c) Find the syntax error (s), if any, in the following program: 2 1999 Delhi Board # include <iostream.h> main() { int x[5], *y,z[5]: for (i = 0; i < 5; i++) { x[il=I; z[i] = i+3; y = z; x = y; } } 9 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 54 1(c) Will the following program execute successfully? If no, state the reason (s). 2 #include<stdio.h> 2000 Delhi Board void main () { int s1, s2, num; s1 = s2 = 0; for (x = 0; x<11; x++) { cin << num; if (num>0) s1 += num; else s2 = /num; } cout << s1 << s2; } 55 1(c) Identify the syntax error (s), if any (giving reason for error) 2 2001 Delhi Board class ABC { int x = 10; float y; ABC () { y = 5;} ~ ABC(){} }; void main () { ABC al,a2; } 56 1(c) Find the syntax error(s), if any, in the following program: 2 2002 Delhi Board # include <iostream.h> void main() { int x; cin<< x; for(int y = 0; y<10; y++); cout>>x + y; } 10 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 57 1 (c) Rewrite the corrected code for the following program. Underline each correction (if any) 3. 2004 Outside Delhi #include <iostream.h> structure Supergym { int member number; char membername[20]; char membertype[] = “HIG”; }; void main() { Supergym personl, person.2; cin<<“Member Number:”; cin>>personl.membernumber; cout<<“Member Name :“; cin>>personl.membername; personl.member type = “MIG”; person2 = personl; cin<<“Member Number:“<<person2.membernumber; cin<<“Member Name”<<person2.membername; cin<<“Member Number:“<<person2.membertype; } 58 1(c) Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. 2 Delhi 2006 #include<iostream.h> void main( ) { struct STUDENT { char stu_name[20]; char stu_sex; int stu_age=17; } student; gets(stu_name); gets(stu_sex);} 59 1(c) Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. OD 2006 2 #include <idstream.h> void main() { struct movie { char movie_name[20]; 11 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj char movie_type; int ticket_cost = 100 }MOVIE; gets(movie_name); gets(movie_type); } 60 1(c) Rewrite the following program after removing the syntactical error(s), if any. Underline each correction. Delhi 2007 2 #include <iostream.h> const int Size 5; void main() { int Array[Size]; Array = {50,40,30,20,10}; for(Ctr=0; Ctr<Size; Ctr++) cout>>Array[Ctr]; } 61 1(c) Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. OD 2007 2 # include <iostream.h> const int Max 10; void main ( ) { int Numbers [Max]; Numbers = { 20, 50,10, 30,40 } ; for (Loc= Max-1 ; Loc > = 0 ; Loc - -) cout>>Numbers [Loc]; } 62 1(c) Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. Delhi 2008 #include < iostream.h > void main ( ) { First = 10, Second = 20; Jumpto (First; Second); Jumpto (Second); } void Jumpto (int N1, int N2=20) { N1 = N1 + N2; cout<<N1>>N2; } 2 12 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 63 1(c) Rewrite the following program after removing the syntax error(s), if any. Underline each correction. OD 2008 2 #include <iostream.h> void main ( ) { One = 10, Two = 20; Callme (One;Two) ; Callme (Two) ; } void Callme (int Arg1, int Arg2=20) { Arg1 = Arg1 + Arg2; cout<<Arg1>> Arg2; } 64 1(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. Delhi 2009 #include [iostream.h] #include [stdio.h] class Employee { int EmpId = 901; char EName [20] ; public Employee ( ) { } void Joining () {cin>>EmpId; gets (EName);} void List ( ) {cout<<EmpId<<“ : ”<<EName<<endl;} }; 2 void main ( ) { Employee E ; Joining.E ( ) ; E. List ( ) } 65 (c) Rewrite the following program after removing the syntactical errors (if any).Underline each correction. Outside Delhi 2009 2 include <iostream.h> include <stdio.h> class MyStudent 13 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { int StudentId = 1001; char Name [20] ; public MyStudent( ){ } void Register ( ) {cin>>StudentId; gets (Name) ;} void Display ( ) {cout<<StudentId<< “:” <<Name<<end1;} }; void main ( ) { MyStudent MS ; Register.MS( ) ; MS.Display( ) ; } 66 1(c) Rewrite the following c++ program code after removing the syntax error(s) (if any). Underline each correction. Delhi 2010 2 include <iostream.h> class TRAIN { long TrainNo; char Description[25]; public void Entry ( ) { cin >>TrainNo; gets(Description); } Void Display ( ) { cout<<TrainNo<<“:”<<Description<<endl; } }; void main( ) { TRAIN T; Entry. T( ); Display. T( ); } 67 1(c) Rewrite the following C++ program code after removing the syntax error(s) (if any). Underline each correction. OD 2010 2 14 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj include <iostream.h> class FLIGHT { long FlightCode; char Description[25]; public void AddInfo() { cin>>FlightCode; gets (Description) ; { void ShowInfo() ( cout<<FlightCode<<“:”<<Description<<endl; } }; void main() { FLIGHT F; AddInfo.F(); ShowInfo.F(); } 68 1(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. Delhi 2011 2 #include[iostream.h] typedef char Text(80) ; void main ( ) { Text T= "Indian"; int Count=strlen(T) ; cout<<T<<'has'<<Count<< 'characters' <<end1; } 69 1(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. OD 2011 2 include<iostream.h> typedef char [80] String; void main ( ) { String S= "Peace"; int L=strlen(S) ; cout<<S<< 'has'<<L<< 'characters'<<end1; } 15 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 70 1(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. Sample Paper Set I 2009 2 #include [iostream.h] class PAYITNOW { int Charge; PUBLIC: void Raise(){cin>>Charge;} void Show{cout<<Charge;} }; void main() { PAYITNOW P; P.Raise(); Show(); } 71 1(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. Sample Paper Set II 2009 2 #include <iostream.h> struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout<<P.Color,P.Style<<endl; } void main() { Pixels Point1=(5,3); ShowPoint(Point1); Pixels Point2=Point1; Color.Point1+=2; ShowPoint(Point2); } 72 1(c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. Sample Paper Set I 2010 2 #include [iostream.h] class MEMBER { int Mno;float Fees; PUBLIC: void Register(){cin>>Mno>>Fees;} 16 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj void Display{cout<<Mno<<" : "<<Fees<<endl;} }; void main() { MEMBER M; Register(); M.Display(); } 73 (c) Rewrite the following program after removing the syntactical errors (if any). Underline each correction. SP 2010 #include <iostream.h> struct Pixels { int Color,Style;} void ShowPoint(Pixels P) { cout<<P.Color,P.Style<<endl;} 2 void main() { Pixels Point1=(5,3); ShowPoint(Point1); Pixels Point2=Point1; Color.Point1+=2; ShowPoint(Point2); } 17 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 74 Sample Paper Set I 2012 18 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 75 Sample Paper Set II 2012 76 2012 Outside Delhi 19 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj QNO 1(d) 77 1(d) Give the output of the following program segment: 3 1998 Delhi void main() { char *NAME = "IntRAneT"; for (int x = 0; x<strlen(NAME);x++) if(islower(NAME)) NAME[x]=toupper(NAME[x]); else if (isupper(NAME[x])) if (x%2==0) NAME[x]=tolower(NAME[x]); else NAME [x] = NAME[x - 1]; puts(NAME); } 78 1(d) Give the output of the following program: 3 1999 Delhi # include <stdio.h> void main() { char *p = "Difficult"; char c; c = *p++; printf("%c",c); } 79 1 (d) Give the output of following program segment (Assuming all required header files are included in the program). 3 2000 Delhi void main() { char *NAME = “a ProFile”; for (int x=0;x<strlen(NAME);x++) if (islower(NAME[x] NAME [x] = toupper(NAME)[x]; else 20 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj if (isupper(NAME[x]) if (x%2!=0) NAME [x]=tolower(NAME[x-1]); else NAME [x]--; cout << NAME << endl; } 81 1(d) Give the output of the following program (Assuming all required header files are included in the program) : 3 2001 Delhi void main() { int array[]={2,3,4,5}; int *arptr = array; int value = *arptr; cout << value << „\n'; value = *arptr++; cout<< value <<‟\n‟; value = *arptr; cout << value << „\n‟; value = *++arptr; cout << value << „\n'; } 82 1(d) Find the output of the following program: 3 2002 Delhi void main() { int x=5,y=5; cout << x++; cout<<","; cout<<++x; cout<< ","; cout << y++<<”,”<<++y; } 83 1(d) What will be the output of the following program : 2 2004 Delhi #include<iostream.h> #include<ctype.h> #include<conio.h> #include<string.h> 21 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj void ChangeString(char Text[], int &Counter) { char *Ptr = Text; int Length = strlen (Text); for ( ;Counter<Length-2; Counter+=2, Ptr++) { * (Ptr + Counter) = toupper( * (Ptr + Counter) ); } } void main() { clrscr(); int Position = 0; char Messaget[] = “Pointers Fun”; ChangeString (Message, Position); cout<<Message<<“ @ “<<Position; } 84 1. (d) Find the output of the following program : 3 Delhi 2006 #include<iostream.h> #include<string.h> class state { char *state_name; int size; public: state( ); { size=0; state_name=new char[size+1]; } state(char *s) { size = strlen(s) ; state_name = new char[size+1]; strcpy(state_name,s); } void display( ) {cout<<state_name<<endl;} void Replace (state & a, state & b) { size = a.size + b.size; delete state_name; state_name = new char[size+l]; strcpy(state_name, a.state_name); strcat(state_name, b.state_name); } }; void main( ) { char * temp = “Delhi”; state state1 (temp), state2(“Mumbai”), state3(“Nagpur”), S1, S2; 22 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj S1.Replace(state1, state2); S2. Replace(S1, state3); S1.display( ); S2.display( ); } 85 1(d) Find the output of the following program : #include<iostream.h> #include<string.h> class student { char *name; int l; OD 2006 3 public: student() { l=0; name=new char[1+1]; } student(char *s) { l=strlen(s); name=new char[1+1]; strcpy (name,s); } void display() { cout<<name<<endl;} void manipulate(student & a, student & b) { l =a.l + b.l; delete name; name=new char[l+l]; strcpy(name, a.name); strcat(name, b.name); } }; void main() { char * temp =''Jack''; student name1(temp), name2('' Jill''), name3('' John'' ),S1,S2; S1.manipulate(name1,name2); S2.manipulate(S1,name3); S1.display(); S2.display(); } 23 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 86 1(d) Find the output of the following program : #include<iostream.h> void main() { int Numbers[] = {2,4,8,10}; int *ptr = Numbers; for (int C = 0; C<3; C++) { cout<< *ptr << “@”; ptr++; } cout<<endl; for(C = 0; C<4; C++) { (*ptr)*=2; --ptr; } for(C = 0; C<4; C++) cout<< Numbers [C]<< “#”; cout<<endl; } 87 1(d) Find the output of the following program : # include < iostream.h> void main () { intArray[] = {4,6,10,12}; int *pointer = Array ; for (int I=1 ; I<=3 ; I++) { cout<<*pointer<<#”; pointer ++; } cout<<endl; for (I=1 ; I<=4 ; I++) { (*pointer)*=3 ; -- pointer; } for(I=l; I<5; I + + ) cout << Array [I-1] << “@”; cout << endl; } Delhi 2007 OD 2007 2 2 24 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 88 1(d) Find the output of the following program: Delhi 2008 3 #include<iostream.h> #include<ctype.h> void main ( ) { char Text [ ] = “Mind@Work!”; for (int I = 0; Text (I)! = ‘\0’; 1++) { if (!isalpha (Text[I])) Text [I] = ‘*’; else if (isupper (Text[I])) Text [I] = Text [I] + 1 ; Text [I] = Text [I] + 1 ; else Text (I) = Text [I+ 1]; } cout<<Text; } 89 1(d) Find the output of the following program : OD 2008 3 #include<iostream.h> #include<ctype.h> void main ( ) { char Mystring[ ] =“What@OUTPUT!” ; for(int I = 0; Mystring [I] ! =’ \0'; I++) { if (!isalpha (Mystring[I])) Mystring [I] = ‘*’; else if (isupper (Mystring[I])) Mystring [I] = Mystring[I] +1; else Mystring [I] = Mystring [I+1]; } cout<<Mystring; 25 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } 90 1(d) Find the output of the following program : Delhi 2009 3 #include<iostream.h> void main ( ) { int X[ ] = {10, 25, 30, 55, 100}; int *p = X ; while ( *p < 110) { if (*p%3 ! = 0) *p = *p + 1 ; else *p = *p + 2 ; p++; } for(int I = 4 ; 1>= 1 ; I - -) { cout << X[I] << “*” ; if ( I%3 = = 0) cout<<endl ; } cout<<X[0]*3<<endl ; } 91 1(d) Find the output of the following program: OD 2009 3 #include<iostream.h> void main ( ) { int A[ ] = {10, 15, 20, 25, 30} int *p = A; while (*p < 30) { if (*p%3 ! = 0) *p = *p + 2 ; else *p = *p + 1; p++; } for (int J = 0; J<=4; J++) { cout << A[J] << “*” ; 26 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj if ( J%3 = = 0) cout<<endl; } } 92 1(d) Find the output of the following program : Delhi 2010 3 #include <iostream.h> struct POINT {int X, Y, Z;}; void StepIn(POINT & P, int Step=1) { P.X+=Step; P.Y -=Step; P.Z+=Step; } void StepOut(POINT & P, int Step=1) { P.X-=Step; P.Y+=Step; P.Z–=Step; } void main ( ) { POINT P1={15, 25, 5}, P2={10, 30, 20}; StepIn(P1); StepOut(P2,4); cout<<P1.X<<“,”<<P1.Y<<“,”<<P1.Z<<endl; cout<<P2.X<<“,”<<P2.Y<<“,”<<P2.Z<<endl; StepIn(P2,12); cout<<P2.X<<“,”<<P2.Y<<“,”<<P2.Z<<endl; } 93 1(d) Find the output of the following program: OD 2010 3 #include <iostream.h> struct THREE_D {int X,Y,Z;}; void MoveIn(THREE_D &T, int Step=l) } T.X+=Step; T.Y-=Step; T.Z+=Step 27 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } void MoveOut(THREE_D &T, int Step=l) { T.X-=Step; T.Y+=Step; T.Z-=Step; } void main () { THREE_D Tl={lO,20,5},T2={30,lO,40}; MoveIn(T1); MoveOut(T2,5); cout<<Tl.X<<“,”<<Tl.Y<<“,”<<T1.Z<<endl; cout<<T2.X<<“,”<<T2.Y<<“,”<<T2.Z<<endl; MoveIn(T2,l0); cout<<T2.X<<“,”<<T2.y<<“,”<<T2.Z<<endl; } 94 1(d) Find the output of the following program: Delhi 2011 3 #include<iostream.h> void ChangeArray(int Number, int ARR[ ], int Size) { for (int L =0; L<Size; L++) if (L<Number) ARR [L] +=L; e1se ARR [L] *=L; } void Show (int ARR [ ], int Size) { for (int L=0; L<Size; L++) (L%2!=0) ?cout<<ARR[L] <<"#": cout<<ARR[L]<<end1 ; } void main ( ) { int Array [ ] = {30, 20, 40, 10, 60, 50}; ChangeArray (3, Array, 6) ; Show (Array, 6) ; } 95 1(d) Find the output of the following program: OD 2011 3 28 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj #include <iostream.h> void SwitchOver(int A [ ], int N, int Split) { for (int K=0 ; K<N; K++) if (K<Split) A(K]+ =K; else A [K]*=K; } void Display (int A [ ], int N) { for (int K=0 ; K<N ; K++) (K%2==0)? cout<<A[K]<<"%":cout<<A(K]<<end1; } void main ( ) { int H[ ]= {30,40,50,20,10,5}; SwitchOver (H, 6, 3); Display (H, 6); } 96 1(d) Find the output of the following program: #include <iostream.h> struct GAME { int Score, Bonus;}; void Play(GAME &g, int N=10) { g.Score++;g.Bonus+=N; } SP 2010 SET I 3 void main() { GAME G={110,50}; Play(G,10); cout<<G.Score<<":"<<G.Bonus<<endl; Play(G); cout<<G.Score<<":"<<G.Bonus<<endl; Play(G,15); cout<<G.Score<<":"<<G.Bonus<<endl; } 29 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 97 (d) Find the output of the following program: SAMPLE PAPER 2010 SET II 3 #include <iostream.h> void Changethecontent(int Arr[ ], int Count) { for (int C=1;C<Count;C++) Arr[C-1]+=Arr[C]; } void main() { int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200}; Changethecontent(A,3); Changethecontent(B,4); Changethecontent(C,2); for (int L=0;L<3;L++) cout<<A[L]<<'#'; cout<<endl; for (L=0;L<4;L++) cout<<B[L] <<'#'; cout<<endl; for (L=0;L<2;L++) cout<<C[L] <<'#'; } 30 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 98 Sample Paper Set I 2012 31 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 99 100 (d) Sample Paper Set II 2012 Find the output of the following program: SAMPLE PAPER 2009 SET I 3 #include <iostream.h> struct PLAY { int Score, Bonus;}; void Calculate(PLAY &P, int N=10) { P.Score++;P.Bonus+=N; } void main() { PLAY PL={10,15}; Calculate(PL,5); cout<<PL.Score<<”:”<<PL.Bonus<<endl; Calculate(PL); cout<<PL.Score<<”:”<<PL.Bonus<<endl; Calculate(PL,15); cout<<PL.Score<<”:”<<PL.Bonus<<endl; } 32 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 101 (d) Find the output of the following program: SAMPLE PAPER 2009 SET II (Repeated in Sample Paper 2012 Set II) 3 #include <iostream.h> void Changethecontent(int Arr[], int Count) { for (int C=1;C<Count;C++) Arr[C-1]+=Arr[C]; } void main() { int A[]={3,4,5},B[]={10,20,30,40},C[]={900,1200}; Changethecontent(A,3); Changethecontent(B,4); Changethecontent(C,2); for (int L=0;L<3;L++) cout<<A[L]<<’#’; cout<<endl; for (L=0;L<4;L++) cout<<B[L] <<’#’; cout<<endl; for (L=0;L<2;L++) cout<<C[L] <<’#’; } 33 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 102 CBSE Question Paper Outside Delhi 2012 34 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj QNO 1(e) 103 1(e) Write the output of the following program 3 Delhi 1998 # include<iostream.h> void Execute(int &X, int Y = 200) { int TEMP = X + Y; X += TEMP; if (Y != 200) cout << TEMP << " " <<X<<” “<<Y<<endl; } void main() { int A = 50, B = 20; Execute(B); cout << A << " " << B << endl; Execute(A,B); cout << A << " " << B << endl; } 104 1(e) Write the output of the following program : 3 Delhi 1999 # include <iostream.h> static int i=100; void abc() { static int i=8; cout<< "first=" <<i; } void main() { static int i = 2; abc(); cout << "second =” << i << endl; } 35 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 105 1 (e) Write the output of the following program: 3 Delhi 2000 # 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 << " " << " " << q << endl; p=func (q); cout<< p << " " << " " << q << endl; q=func (p); cout << p << " " << " " << q << endl; } 106 1(e) Give the output of the following program 3 Delhi 2001 # include <iostream.h> int global = 10; void func(int &x, int y) { x = x - y; y = x * 10; cout << x << << y << '\n'; } void main() { int global = 7: func (::global, global); cout << global <<”,” << ::global <<‟\n‟; func(global,:: global); cout<< global << “,”<<::global<<„\n‟; } 36 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 107 1 (e) Write the output of the following program: 3 Delhi 2002 #include <iostream.h> void X(int A, int &B) { A = A+B; B = A-B; A = A-B; } void main() { int a=4, b=l8; X(a,b); cout<< a <<”,”<<b; } 108 1(d) What will be the output of the following program : 2 Delhi 2004 #include<iostream.h> #include<ctype.h> #include<conio.h> #include<string.h> void ChangeString(char Text[], int &Counter) { char *Ptr = Text; int Length = strlen (Text); for ( ;Counter<Length-2; Counter+=2, Ptr++) { * (Ptr + Counter) = toupper( * (Ptr + Counter) ); } } void main() { clrscr(); int Position = 0; char Messaget[] = “Pointers Fun”; ChangeString (Message, Position); cout<<Message<<“ @ “<<Position; } 109 1(e) Find the output of the following program : 37 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Delhi 2006 2 #include<iostream.h> void main( ) { long NUM= 1234543; int F=0, S=0; do { int Rem = NUM% 10 ; if (Rem % 2 !=0) F+=R; else S+=R; NUM /=10; }while(NUM>0); cout<<F-S; } 110 1(e) Find the output of the following program : OD 2006 2 Delhi 2007 3 #include<iostream.h> void main() { long Number = 7583241; int First=0, Second=0; do { int R = Number%10; if(R%2==0) First+=R; else Second+=R; Number /=10; }while(Number>0); cout<<First-Second; } 111 1(e) Find the output of the following program : #include<iostream.h> void Indirect(int Temp=20) { for (int 1=10; I<=Temp; I+=5) cout<<I<<” , “ ; cout<<endl; } 38 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj void Direct (int &Num) { Num+=10; Indirect(Num); } void main() { int Number=20; Direct(Number) ; Indirect(); cout<< “ Number=” <<Number<<endl ; } 112 1(e) Find the output of the following program : # include < iostream.h> void Withdef (int HisNum = 30) { for (int 1=20 ; I<*= HisNum; I+=5) cout<<I<<””; cout<<endl; } void Control (int &MyNum) { MyNum+=10; Withdef(MyNum); } OD 2007 3 void main () { int YourNum=20; Control (YourNum); Withdef(); cout<<”Number=”<<YourNum<<endl; } 113 1(e) Find the output of the following program: Delhi 2008 2 #include<iostream.h> void main ( ) { 39 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj int U = 10, V = 20; for (int I = 1; 1 < = 2; 1++) { cout<<“[1]=”<<U++<<“&”<<V–5<<endl; cout<<“[2]=”<<++V<<“&”< <U+ 2< <endl; } } 40 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 114 1(e) Find the output of the following program : OD 2008 2 #include<iostream.h> void main ( ) { int A=5, B=10; for (int I = 1; I<=2; 1++) { cout<< “Linel=”<<A++<<“&”<<B–2<<endl; cout<<“Line2=”<<++B<<“&”<<A+3<<endl; } } 115 1(e) Find the output of the following program : Delhi 2009 2 OD 2009 2 #include<iostream.h> #include<ctype.h> void Encode (char Info [ ], int N) ; void main ( ) { char Memo [ ] = “Justnow” ; Encode(Memo, 2) ; cout<<Memo<<endl ; } void Encode(char Info[ ], int N) { for (int I = 0 ; Info[I] != ‘\0’ ; 1++) if (1%2= =0) Info[I] = Info[I] –N ; else if (islower(Info[I])) Info[I] = toupper(Info[I]) ; else Info[I] = Info[I] +N ; } 116 1(e) Find the output of the following program: #include <iostream.h> #include <ctype.h> 41 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj void Secret (char Mig [ ], int N); 42 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj void main ( ) { char SMS[ ] = “rEPorTmE” ; Secret{SMS,2); cout<<SMS<<end1; } void Secret(char Msg[ ], int N) { for (int C=0; Msg[C] ! =’ \0' ;C++) if (C%2==0) Msg[C] = Msg[C]+N; else if (isupper(Msg[C])) Msg[C] = tolower(Msg[C]); else Msg[C] = Msg[C]-N; } 117 1(e) Find the output of the following program : Delhi 2010 2 #include <iostream.h> #include <ctype.h> void ChangeIt(char Text[ ], char C) { for (int K=0;Text[K]!='\0';K++) { if (Text[K]>=’F’ && Text[K]<=’L’) Text[K]=tolower(Text[K]); else if (Text[K]=’E’ || Text[K]==’e’) Text[K]= =C; else if (K%2==O) Text[K]=toupper(Text[K]); else Text[K]=Text[K-l]; } } void main ( ) { char OldText[ ]=”pOwERALone”; ChangeIt(OldText,’%’); cout<<“New TEXT:”<<OldText<<endl; 43 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } 44 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 118 1(e) Find the output of the following program: OD 2010 2 Delhi 2011 2 #include <iostream.h> #include <ctype.h> void MyCode (char Msg [], char CH) { for (int (Cnt=O;Msg[Cnt]!=’\0';Cnt++) { if (Msg[Cnt]>=’B’ && Msg[Cnt]<=’G’) Msg[Cnt]=tolower(Msg[Cnt]); else if (Msg[Cnt]==’A’|| Msg[Cnt]==’a’) Msg[Cnt]=CH; else if (Cnt%2==0) Msg[Cnt]=toupper(Msg[Cnt]); else Msg[Cnt]=Msg[Cnt-l]; } } void main () { char MyText [] =” ApEACeDriVE”; MyCode(MyText,’@’); cout<<“NEW TEXT:”<<MyText<<endl; } 119 1(e) Find the output of the following program: #include<iostream.h> void main ( ) { int Track [ ] = {10, 20, 30, 40}, *Striker ; Stxiker=Track : Track [1] += 30 ; cout<<"Striker>"<<*Striker<<end1 ; Striker – =10 ; Striker++ ; cout<<"Next@"<<*Striker<<end1 ; Striker+=2 ; cout<<"Last@"<<*Striker<<end1 ; 45 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj cout<< "Reset To" <<Track[0] <<end1 ; } 120 1(e) Find the output of the following program: OD 2011 2 #include<iostream.h> void main ( ) { int *Queen, Moves [ ] = {11, 22, 33, 44}; Queen = Moves; Moves [2] + = 22; cout<< "Queen @"<<*Queen<<end1; *Queen - = 11; Queen + = 2; cout<< "Now @"<<*Queen<<end1; Queen++; cout<< "Finally@"<<*Queen«end1; cout<< "New Origin @"<<Moves[0]<<end1; } 121 1(e) Find the output of the following program: SAMPLE PAPER 2009 SET I #include <iostream.h> #include <ctype.h> void Encrypt(char T[]) { for (int i=0;T[i]!='\0';i+=2) if (T[i]=='A' || T[i]=='E') T[i]='#'; else if (islower(T[i])) T[i]=toupper(T[i]); else T[i]='@'; } void main() { char Text[]="SaVE EArtH";//The two words in the string Text //are separated by single space Encrypt(Text); cout<<Text<<endl; } 122 1(e) Find the output of the following program: SAMPLE PAPER 2009 SET II 2 2 46 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj #include <iostream.h> struct Game { char Magic[20];int Score; }; void main() { Game M={“Tiger”,500}; char *Choice; Choice=M.Magic; Choice[4]=’P’; Choice[2]=’L’; M.Score+=50; cout<<M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]=’A’;N.Magic[3]=’J’; N.Score-=120; cout<<N.Magic<<N.Score<<endl; } 123 1(e) Find the output of the following program: SAMPLE PAPER 2010 SET I #include <iostream.h> 2 void Secret(char Str[ ]) { for (int L=0;Str[L]!='\0';L++); for (int C=0;C<L/2;C++) if (Str[C]=='A' || Str[C]=='E') Str[C]='#'; else { char Temp=Str[C]; Str[C]=Str[L-C-1]; Str[L-C-1]=Temp; } } void main() { char Message[ ]="ArabSagar"; 47 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Secret(Message); cout<<Message<<endl; } 124 (e) Find the output of the following program: SAMPLE PAPER 2010 SET II #include <iostream.h> struct Game { char Magic[20];int Score; }; void main() { Game M={"Tiger",500}; char *Choice; Choice=M.Magic; Choice[4]='P'; Choice[2]='L'; M.Score+=50; cout<<M.Magic<<M.Score<<endl; Game N=M; N.Magic[0]='A';N.Magic[3]='J'; N.Score-=120; cout<<N.Magic<<N.Score<<endl; } 125 2 Sample Paper Set I 2012 48 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 126 127 Sample Paper Set II 2012 CBSE QP Outside Delhi 2012 49 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj QNO 1 (f) 128 (f) Write a C++ function having two value parameters X and N with result type float to find the sum of series given below. 1998 Delhi Board 2 1+X1/2!+X2/3!+...+ XN/(N + 1)! 129 (f) Write a C++ function that converts a 2-digit octal number into binary number and prints the binary equivalent. 1999 Delhi 2 130 (f) Write a function SEQSUM() in C++ with two arguments, double x and int n. The function should return a value of type double and it should find the sum of the Following series : 2000 Delhi 2 1 + x / 2! + x2 / 4! + x3 / 6! + x4 / 8! + x5 /10! + ... + xn / (2n)! 131 f) Write a function name SUMFUN(), with arguments x and N, which returns the sum of the following series 2001 Delhi 2 1 - x2/2 + x3/3 - x4/4 + x5/5 - x6/6+….+xN/N 132 (d) Raising a number to a power p is the same as multiplying n by itself p times. Write a function called power that takes two arguments, a double value for n and an int value for p, and return the result as double value. Use default argument of 2 for p, so that if this argument is omitted the number will be squared. Write the main function that gets value from the user to test power function 2002 Delhi 2 133 (f) Write definition for a function SumSequence( ) in C++ with two arguments/ parameters — double x and int n. The function should return a value of type double and it should perform sum of the following series : 2004 Delhi 4 1/x — 3!/x2 + 5!/x3 — 7!/x4 + 9!/x5 — ... up to n terms (Note : The symbol ! represents Factorial of a number i.e. 5! = 5 × 4 × 3 × 2 × 1) 134 (f) What are Nested Structures ? Give an example. Delhi 2006 2 135 (f) What is a default constructor ? How does it differ from destructor ? 50 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj OD 2006 2 51 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 136 (f) In the following C++ program what is the expected value of Myscore from Options (i) to (iv) given below. Justify your answer. Delhi 2007 2 #include<stdlib.h> #include<iostream.h> void main( ) { randomize(); int Score[] = {25,20,34,56, 72, 63}, Myscore; Myscore = Score[2 + random(2)]; cout<<Myscore<<endl; } (i) 25 (ii) 34 (iii) 20 (iv) None of the above 137 (f) In the following C++ program what is the expected value of MyMarks from Options (i) to (iv) given below. Justify answer. OD 2007 2 #include<stdlib.h > # include<iostream.h> void main () { randomize (); int Marks [ ]= {99, 92, 94, 96, 93, 95}, MyMarks; MyMarks = Marks [1 + random (2) ]; cout<<MyMarks<<endl; } (i) 99 (ii) 94 (iii) 96 (iv) None of the above 138 (f) In the following program, find the correct possible output(s) from the options: Delhi 2008 #include<stdlib.h> #include<iostream.h> 2 void main ( ) { randomize ( ) ; char City [ ] [10] = {“DEL”, “CHN”, “KOL”, “BOM”, “BNG”}; int Fly; for (int I=0;I<3;I++) { 52 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Fly=random (2)+ 1; cout<<City[Fly]<<”:” ; } } Outputs: (i) DEL:CHN:KOL: (ii) CHN:KOL:CHN: (iii) KOL:BOM:BNG: (iv) KOL:CHN :KOL: 139 (f) In the following program, find the correct possible output(s) from the options: OD 2008 #include<stdlib.h> #include<iostream.h> 2 void main ( ) { randomize() ; char Area [ ] [10] = {‘‘NORTH”, ‘‘SOUTH”, “EAST”, “WEST”} ; int ToGo; for (int I=0; 1<3; 1++) { ToGo = random(2) +1; cout<<Area [ToGo]<<” : “; } } outputs: (i) SOUTH:EAST:SOUTH: (ii) NORTH:SOUTH:EAST: (iii) SOUTH:EAST:WEST: (iv) SOUTH:EAST:EAST: 140 (f) Study the following program and select the possible output from it : Delhi 2009 #include <iostream.h> #include <stdlib.h> const int LIMIT = 4 ; void main ( ) { randomize ( ) ; int Points; Points = 100 + random(LIMIT) ; for (int P=Points ; P>=100 ; P– –) cout<<P<<“#” ; 2 53 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj cout<<endl; } (i) 103#102#101#100# (ii) 100#101#102#103# (iii) 100#101#102#103#104# (iv) 104#103#102#101#100# 54 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 141 (f) Study the following program and select the possible output from it : OD 2009 #include <iostream.h> #include <stdlib.h> const int MAX=3 ; void main ( ) { randomize( ) ; int Number ; Number = 50 + random{MAX) ; for (int P=Number; P>=50; P– –) cout<<p<< “ # ” ; cout<<endl; } 2 (i) 53#52#51#50# (ii) 50#51#52# (iii) 50#51# (iv) 51#50# 142 (f) The following code is from a game, which generates a set of 4 random numbers. Yallav is playing this game, help him to identify the correct option(s) out of the four choices given below as the possible set of such numbers generated from the program code so that he wins the game. Justify your answer. Delhi 2010 2 #include <iostream.h> #include <stdlib.h> const int LOW=15; void main ( ) { randomize( ) ; int POINT=5, Number; for (int 1=1;I<=4;I++) { Number=LOW+random(POINT) ; cout<<Number<<“:” ; POINT--; }} (i) 19:16:15:18: (ii) 14:18:15:16: (iii) 19:16:14:18: (iv) 19:16:15:16: 55 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 143 (f) The following code is from a game, which generates a set of 4 random numbers. Praful is playing this game, help him to identify the correct option(s) out of the four choices given below as the possible set of such numbers generated from the program code so that he wins the game. Justify your answer. OD2010 2 #include <iostream.h> #include <stdlib.h> const int LOW=25; void main () { randomize(); int P01NT=5,Number; for (int I=1;I<=4;I++) { Number=LOW+random(POINT); Cout<<Number<<“:”; P0INT--; } } (i) 29:26:25:28: (ii) 24:28:25:26: (iii) 29:26:24:28: (iv) 29:26:25:26: 144 (f) Go through the C++ code shown below, and find out the possible output or outputs from the suggested Output Options (i) to (iv). Also, write the least value and highest value, which can be assigned to the variable Guess. Delhi 2011 2 #include <iostream.h> #include <stdlib.h> void main ( ) { randomize ( ) ; int Guess, High=4; for{int C=Guess ; C<=55 ; C++) cout<<C<<"#" ; } (i) 50 # 51 # 52 # 53 # 54 # 55 # (ii) 52 # 53 # 54 # 55 56 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) 53 # 54 # (iv) 51 # 52 # 53 # 54 # 55 57 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 145 (f) Go through the C++ code shown below, and find out the possible output or outputs from the suggested Output Options (i) to (iv). Also, write the minimum and maximum values, which can be assigned to the variable MyNum. OD 2011 2 #include<iostream.h> #include <stdlib.h> void main ( ) { randomize ( ) ; int MyNum, Max=5; MyNum = 20 + random (Max) ; for (int N=MyNum; N<=25;N++) cout<N<"*"; } (i) 20*21*22*23*24*25 (ii) 22*23*24*25* (iii) 23*24* (iv) 21*22*23*24*25 146 (f) In the following program, if the value of N given by the user is 15, what maximum and minimum values the program could possibly display? SAMPLE PAPER 2009 SET I 2 #include <iostream.h> #include <stdlib.h> void main() { int N,Guessme; randomize(); cin>>N; Guessme=random(N)+10; cout<<Guessme<<endl; } 147 1(f)In the following program, if the value of N given by the user is 20, what maximum and minimum values the program could possibly display? SAMPLE PAPER 2009 SET II 2 #include <iostream.h> #include <stdlib.h> void main() 58 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { int N,Guessnum; randomize(); cin>>N; Guessnum=random(N-10)+10; cout<<Guessnum<<endl; } 148 (f) In the following program, if the value of Guess entered by the user is 65, what will be the expected output(s) from the following options (i), (ii), (iii) and (iv)? SAMPLE PAPER 2010 SET I 2 #include <iostream.h> #include <stdlib.h> void main() { int Guess; randomize(); cin>>Guess; for (int I=1;I<=4;I++) { New=Guess+random(I); cout<<(char)New; } } (i) ABBC (ii) ACBA (iii) BCDA (iv) CABD 149 (f) In the following program, if the value of N given by the user is 20, what maximum and minimum values the program could possibly display? SAMPLE PAPER 2010 SET II 2 #include <iostream.h> #include <stdlib.h> void main() { int N,Guessnum; randomize(); cin>>N; Guessnum=random(N-10)+10; cout<<Guessnum<<endl; } 59 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 60 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 150 Sample Paper Set I 2012 151 Sample Paper Set II 2012 61 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 152 CBSE Question Paper Outside Delhi 2012 62 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK QNO 2 (A) 01. (a) Differentiate between members, which are present within the private visibility mode with those which are present within the public visibility modes. 2011 02. (a) What is copy constructor? Give an example in C++ to illustrate copy constructor. 2009 03. (a) What is a copy constructor? What do you understand by constructor overloading? 1998 04. (a) What do you understand by visibility modes in class derivations? What are these modes? 1999 05. (a) Why is a destructor function required in classes? Illustrate with the help of an example. 2000 06. (a) Illustrate the use of "self referential structures” with the help of an example 2001 07. (a) What do you understand about a base class and a derived class? If a base class and a derived class each include a member function with the same name and arguments, which member function will be called by the object of the derived class if the scope operator is not used ? 2002 08. (a) Given the following C++ code, answer the questions (i) & (ii). 2 class TestMeOut { public: ~TestMeOut() //Function 1 { cout<<“Leaving the examination hall”<<endl; } TestMeOut() //Function 2 { cout<<“Appearing for examination”<<endl; } 63 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj void MyWork() //Function 3 { cout<<“Attempting Questions//<<endl; } }; (i) In Object Oriented Programming, what is Function 1 referred as and when does it get invoked / called ? (ii) In Object Oriented Programming, what is Function 2 referred as and when does it get invoked / called ? 2004 09. (a) Define the term Data Hiding in the context of Object Oriented Programming. Give asuitable example using a C++ code to illustrate the same. 2005 10. (a) Differentiate between Constructor and Destructor function in context of Classes and Objects using C++ 2 2007 11. (a) What do you understand by Polymorphism ? Also, give an example in C++ to illustrate the same. 2 2010 12. (a) What do you understand by Polymorphism? Give a suitable example of the same. (s.p) 13. (a) What do you understand by Data Encapsulation and Data Hiding? 2(SP) 14. (a) What do you understand by Data Encapsulation and Data Hiding? Also, give a suitable C++ code to illustrate both. 2(SP) QNO 2 (B) 01. (b) Answer the question (i) and (ii) after going through the following class : class WORK { int WorkId; char WorkType; public: WORK( ) //Function 1 { 64 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj cout<<“Un-Allocated”<<endl; } void Status( ) // Function 2 { cout<<WorkId<<“:”<<WorkType<<endl; } WORK( ) // Function 3 { WorkId=10; WorkType=‟T‟; } WORK (WORK &W) // Function 4 { WorkId = W.WorkId+12; WorkType=W.WorkType+1; } }; (i) Which member function out of Function 1, Function 2, Function 3 and Function 4 shown in the above definition of class Work is called automatically, when the scope of an object gets over? Is it known as Constructor OR Destructor OR Overloaded Function OR Copy Constructor? ii) WORK W; //Statement 1 WORK Y(W); // Statement 2 Which member function out of Function 1, Function 2, Function 3 and Function 4 shown in the above definition of class Work will be called on execution of statement written as Statement 2? What is this function specifically known as out of Destructor or Copy Constructor or Default Constructor? 2009 02. (b) Write the output of the following C++ code. Also, write the name of feature of Object Oriented Programming used in the following program jointly illustrated by the functions [I] to [IV]. 2 2011 #include<iostream.h> void Print ( ) // Function [I] { for (int K=1;K<=60; K++) cout<< “-”; cout<<endl; } void Print (int N) //Function[II] { for (int K=1;K<=N; L++) cout<<“*”; cout<<endl; } void Print(int A, int B) //Function[III] 65 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { for(int K=1;K<=B;K++) cout<<A*k; cout<<endl; } void Print(char T, int N) // Function[IV] { for (int K=1;k<=N;K++) cout<<T; cout<<endl; } void main( ) { int U=9,V=4,W=3; char C =‟@‟; Print(C,V); Print(U,W); } 03. (b) Define a class student with the following specification Private members of class student admno integer sname 20 character eng. math, science float total float ctotal() a function to calculate eng + math + science with float return type. Public member function of class student Takedata() Function to accept values for admno, sname, eng, math, science and invoke ctotal() to calculate total. Showdata() Function to display all the data members on the screen 1998 04. (b) Define a class Teacher with the following specifications : Private members : name 20 characters subject 10 characters basic, DA, HRA float salary float 66 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj calculate A function that computes the salary and returns it. Salary is sum of basic, DA and HRA. Public members : Readdata() A function that accepts data values and invokes the Calculate function. Displaydata() A function that prints the data on the screen 1999 67 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 05. b) Define a class WORKER with the following specification : Private members of class WORKER: wno integer wname 25 characters hrwrk, wgrate float (hours worked and wage rate per hour) totwage float (hrwrk * wgrate) calcwg () A function to find hrwrk * wgrate with float return type. Public members of class WORKER in_data () a function to accept values for wno, wname, hrwrk, wgrate and invoke calcwg() function to calculate totpay. out_data () a function to display all the data members on the screen. You should give definitions of functions. 2000 06. b) Define a class BOOK with the following specifications : Private members of the class BOOK are BOOK NO integer type BOOKTITLE 20 characters PRICE float (price per copy) TOTAL_COST() A function to calculate the total cost for N number of copies where N is passed to the function as argument. Public members of the class BOOK are INPUT() function to read BOOK_NO. BOOK TITLE, PRICE PURCHASE() function to ask the user to input the number of copies to be purchased. It invokes TOTAL COST 0 and prints the total cost to be paid by the user. Note : Note : You are also required to give detailed function definitions. 2001 07. (b) Considering the following specifications : Structure name Data Type Size Name first array of character 40 mid array of character 40 last array of character 60 68 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Phone area array of character 4 exch array of character 4 numb array of character 6 Class name Data Type P_rec name Name Phone Phone With member functions constructor and display_rec. Declare a class of P_rec. Define the constructor (outside the class P_rec) that gathers information from the user for the above two structures Name and Phone. Define the display_rec (outside the class P_rec) that shows the current values. 2002 08. (b) Declare a class myfolder with the following specifications : 4 Private members of the class Filenames — an array of strings of size [10] [25] (to represent all the names of files inside myfolder) Availspace — long (to represent total number of bytes available in myfolder) Usedspace — long (to represent total number of bytes used in myfolder) Public members of the class Newfileentry( ) - A function to accept values of Filenames, Availspace and Usedspace from user Retavailspace( ) - a function that returns the value of total Kilobytes available (1 Kilobyte = 1024 bytes) Showfiles( ) - a function that displays the names of all the files in Myfolder 2004 09. (b) Answer the questions (i) and (ii) after going through the following class: 2 class Test { char Paper[20]; int Marks; public: Test () // Function 1 69 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { strcpy (Paper, “Computer”) Marks = 0; } Test (char P [] ) // Function 2 { strcpy(Paper,P); Marks = 0; } Test (int M) // Function 3 { strcpy(Paper,”Computer”); Marks = M; } Test (char P[], int M) // Function 4 { strcpy (Paper, P); Marks = M; } }; (i) Which feature of Object Oriented Programming is demonstrated using Function 1, Function 2, Function 3 and Function 4 in the above class Test? (ii) Write statements in C++ that would execute Function 2 and Function 4 of class Test. 2005 10. (b) Answer the questions (i) and (ii) after going through the following class 2 class Maths { char Chapter [20]; int Marks; public: Maths ( ) //Member Function 1 { strcpy (Chapter, “Geometry”); Marks = 10; cout<<“Chapter Initialised”; { ~Math ( ) //Member Function 2 } cout<<”Chapter Over”; } }; (i) Name the specific features of class shown by Member Function 1 and Member Function 2 in the above example. 70 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (ii) How would Member Function 1 and Member Function 2 get executed? 2007 71 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 11. (b) Answer the questions (i) and (ii) after going through the following class : class TEST { int Regno, Max, Min, Score ; public : TEST( ) //Function 1 { Regno = 101 ; Max=100; Min = 40 ; score = 75 ; } TEST(int Pregno, int Pscore) //Function 2 { Regno = Pregno ; Max = 100 ; Min = 40 ; Score = Pscore ; } TEST( ) //Function 3 { cout << “TEST Over” << endl ; } void Display( ) //Function 4 { cout << Regno << “:” <<Max<< “:” << Min << endl ; cout << “[Score]” << Score << endl; } }; (i) As per Object Oriented Programming, which concept is illustrated by Function 1 and Function 2 together ? (ii) What is Function 3 specifically referred as ? When do you think, Function 3 will be invoked/called? 2010 12. (b) Define a class Flight in C++ with following description: Private Members A data member Flight number of type integer A data member Destination of type string A data member Distance of type float A data member Fuel of type float A member function CALFUEL() to calculate the value of Fuel as per the following criteria 72 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Distance Fuel <=1000 500 more than 1000 and <=2000 1100 more than 2000 2200 Public Members Public Members A function FEEDINFO() to allow user to enter values for Flight Number, Destination, Distance & call function CALFUEL() to calculate the quantity of Fuel A function SHOWINFO() to allow user to view the content of all the data members (S.P) 13. (b) Answer the questions (i) and (ii) after going through the following class: class Seminar { int Time; public: Seminar() //Function 1 { Time=30;cout<<”Seminar starts now”<<end1; } void Lecture() //Function 2 { cout<<”Lectures in the seminar on”<<end1; } Seminar(int Duration) //Function 3 { Time=Duration;cout<<”Seminar starts now”<<end1; } ~Seminar() //Function 4 { cout<<”Vote of thanks”<<end1; } }; i) In Object Oriented Programming, what is Function 4 referred as and when does it get invoked/called? ii) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions. (S.P) 14. 73 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (b) Answer the questions (i) and (ii) after going through the following program: class Match { int Time; public: Match() //Function 1 { Time=0; cout<<”Match commences”<<end1; } void Details() //Function 2 { cout<<”Inter Section Basketball Match”<<end1; } Match(int Duration) //Function 3 { Time=Duration; cout<<”Another Match begins now”<<end1; } Match(Match &M) //Function 4 { Time=M.Duration; cout<<”Like Previous Match “ <<endl; } }; i) Which category of constructor - Function 4 belongs to and what is the purpose of using it? ii) Write statements that would call the member Functions 1 and 3. S.P. QNO 2 (C) 01. (c) Consider the following declaration and answer the questions given below : class PPP { int H: protected : int S; public : void INPUT (int); void OUT(); }; class QQQ : private PPP { 74 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj int T; protected : int U; public : void INDATA(int, int); void OUTDATA(); }; 75 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj class RRR : public QQQ { int M; public : void DISP( void ); }; (i)Name the base class and derived class of the class QQQ. (ii) Name the data member(s) that can be accessed from function DISP(). (iii) Name the member function(s), which can be accessed from the objects of class RRR. (iv)Is the member function OUT() accessible by the object of the class QQQ? 02. (c) Consider the following declarations and answer the question given below : class vehicle { private: int wheels; protected : int passenger: public : void inputdata (int, int); void outputdata(); }; class heavyvehicle : protected vehicle { int diesel_petrol; protected : int load; public: void readdata(int, int); void writedata(); }; class bus : private heavyvehicle { char make[20]; public: void fetchdata(char); void displaydata(); }; 76 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) Name the base class and derived class of the class heavy_vehicle. (ii) Name the data member(s) that can be accessed from function displaydataO. (iii) Name the data member's that can be accessed by an object of bus class. (iv) Is the member fraction outputdata() accessible to the objects of heavy_vehicle class. Delhi Board 1999 03. c) Consider the following and answer the questions given below : class School { int A; protected : int B,C; public: void INPUT (int); void OUTPUT(); }; class Dept protected : School { int X Y; protected : void IN (int, int); public: void OUT(); }; class Teacher : public Dept { int P; void DISPLAY (void); public : void ENTERO; }; i. Name the base class and derived class of the class Dept. ii. Name the data member (s) that can be accessed from function OUT (). iii. Name the private member function(s) of class Teacher. iv. Is the member function OUT() accessible by the objects of Dept? Delhi Board 2000 04. c) Give the output of the following program : 77 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj # include <iostream.h> # include <string.h> class per { char name [20]; float age; public: per (char*s, float a) { Strcpy(name, s); age = a; } per &GR (per &x) { if (x.age >= age) return x; else return *this; } void display() { cout <<”Name :” << name << '\n'; cout<< “Age :” << age << '\n'; } }; void main () { per P1 ("RAMU", 27.5), P2 ("RAJU", 53), P3("KALU", 40); per P ('\0', 0); P = Pl.GR (P3); P.display(); P = P2.GR (P3); P.display(); } Delhi Board 2001 05. c) consider the following class declaration and answer the question below : class SmallObj { private : int some; more; void err_1() {cout<<”error”;} public: void Xdata(int d) {some=d; more=d++;} void Ydata() {cout<<some<<” “<<more;} 78 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj }; (i) Write the name that specifies the above class. (ii) Write the data of the class with their access scope. (iii) Write all member function of the class along with the access scope. (iv) Indicate the member function of the SmallObj that sets data. Delhi Board 2002 06. (c) Given the following class definitions answer the questions that follow : class livingbeing { char specification[20]; int averageage; public: void read(); void show(); }; class ape : private livingbeing { int no_of_organs, no_of_bones; protected: int iq_level; public: void readape(); void showape(); }; class human : public ape { char race[20]; char habitation[30]; public: void readhuman(); void showhuman(); }; (i) Name the members, which can be accessed from the member functions of class human. (ii) Name the members, which can be accessed by an object of class ape. (iii) Name the members, which can be accessed by an object of class human. (iv) What will be the size of an object (in bytes) of class human ? 2004 07. (c) Define a class TravelPlan in C++ with the following descriptions : Private Members: 79 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj PlanCode of type long Place of type character array (string) Number_of_travellers of type integer Number_of_buses of type integer Public Members: A constructor to assign initial values of Plan Code as 1001, Place as “Agra”, Number_of_travellers as 5, Number_of_buses as 1 A function NewPlan( ) which allows user to enter PlanCode, Place and Number_of_travellers. Also, assign the value of Number_of_buses as per the following conditions : Number_of_travellers Number_of_buses Less than 20 1 Equal to or more than 20 and less than 40 2 Equal to 40 or more than 40 3 A function ShowPlan( ) to display the content of all the data members on screen. 2005 08. (c) Define a class Tour in C++ with the description given below : Private Members : TCode of type string NoofAdults of type integer NoofKids of type integer Kilometres of type integer TotalFare of type float Public Members : • A constructor to assign initial values as follows : TCode with the word “NULL” NoofAdults as 0 NoofKids as 0 Kilometres as 0 TotalFare as 0 • A function AssignFare ( ) which calculates and assigns the value of the data member TotalFare as follows For each Adult Fare(Rs) For Kilometres 500 >=1000 300 <1000 &>=500 200 <500 For each Kid the above Fare will be 50% of the Fare mentioned in the above table 80 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj For example : If Kilometres is 850, NoofAdults = 2 and NoofKids = 3 Then TotalFare should be calculated as NumofAdults * 300 + NoofKids * 150 i.e. 2*300 + 3*150=1050 • A function EnterTour( ) to input the values of the data members TCode, NoofAdults, NoofKids and Kilometres; and invoke the Assign Fare( ) function. • A function ShowTour( ) which displays the content of all the data members for a Tour. 2007 09. c) Define a class ITEM in C++ with the following description : Private Members Code of type integer (Item Code) Iname of type string (Item Name) Price of type float (Price of each item) Qty of type integer (Quantity of item in stock) Offer of type float (Offer percentage on the item) A member function GetOffer( ) to calculate Offer percentage as per the following rule : If Qty <= 50 Offer is 0 If 50 < Qty <= 100 Offer is 5 If Qty >100 Offer is 10 Public Members A function GetStock( ) to allow user to enter values for Code, Iname, Price, Qty and call function GetOffer( ) to calculate the offer. A function ShowItem( ) to allow user to view the content of all the data members. 2010 10. (c) Define a class RESORT in C++ with following description: Private Members: Rno // Data member to store Room No Name // Data member to store customer name Charges // Data member to store per day charges Days // Data member to store number of days of stay 81 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj COMPUTE( ) // A function to calculate and return Amount as Days* Charges and if the value of Days * Charges is more than 11000 then as 1.02 * Days * Charges Public Members : Getinfo( ) // A function to enter the content Rno, Name, Charges and Days Dispinfo( ) // A function to display Rno, Name, Charges, Days and Amount (Amount to be displayed by calling function COMPUTE( ) ) 2009 82 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 11. (c) Define a class candidate in C++ with following Description: 4 Private Members A data member RNo (Registration Number) of type long A data member Name of type string A data member Score of type float A data member Remark of type string A member function AssignRem( ) to assign Remarks as per the Score obtained by a candidate. Score range and the respective Remarks are shown as follows: Score Remarks >=50 Selected less than 50 Not selected Public members A function ENTER( ) to allow user to enter values for RNo, Name, Score & call function AssignRem() to assign the remarks. A function DISPLAY( ) to allow user to view the content of all the data members. 2011 12. (c) Answer the questions (i) to (iv) based on the following: class CUSTOMER { int Cust_no; char Cust_Name[20]; protected : void Register(); public : CUSTOMER(); void Status(); }; class SALESMAN { int Salesman_no; char Salesman_Name[20]; protected: float Salary; public: SALESMAN(); void Enter(); void Show(); }; class SHOP private : CUSTOMER ; public : SALESMAN ; { 83 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj char Voucher_No[10]; char Sales_Date[8]; public: SHOP(); void Sales_Entry(); void Sales_Detail(); }; (i) Write the names of data members which are accessible from objects belonging to class CUSTOMER. (ii) Write the names of all the member functions which are accessible from objects belonging to class SALESMAN. (iii) Write the names of all the members which are accessible from member functions of class SHOP. (iv) How many bytes will be required by an object belonging to class SHOP? Sample paper 1 13. (c) Define a class TEST in C++ with following description: 4 Private Members a. TestCode of type integer b. Description of type string c. NoCandidate of type integer d. CenterReqd (number of centers required) of type integer e. A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1) Public Members A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres A function DISPTEST() to allow user to view the content of all the data Members Sample paper 2 14. (c) Define a class TEST in C++ with following description: Private Members 84 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj • TestCode of type integer • Description of type string • NoCandidate of type integer • CenterReqd (number of centers required) of type integer • A member function CALCNTR() to calculate and return the number of centers as (NoCandidates/100+1) 85 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Public Members • A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres • A function DISPTEST() to allow user to view the content of all the data members Sample paper 3 QNO 2 (D) 01. (d) Answer the questions (i) to (iv) based on the following code: class Medicines { char Category[lO]; char Date_of_manufacture[lO]; char Company[20]; public: Medicines(); void entermedicinedetails(); void showmedicinedetails(); }; class Capsules: public Medicines { protected: char capsule_name[30]; char Volume_label[20]; public: float Price; Capsules(); void entercapsuledetails(); void showcapsuledetails(); }; class Antibiotics: public Capsule { int Dosage_units; char Side_effects[20]; int Use_within_days; public: Antibiotics() ; void enterdetails(); void showdetails(); }; (i) How many bytes will be required by an object of class Medicines and an object of class Antibiotics respectively? 86 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (ii) Write names of all the member functions accessible from the object of class Antibiotics. (iii) Write names of all the members accessible from member functions of class Capsules. (iv) Write names of all the data members, which are accessible from objects of class Antibiotics. 2005 02. (d) Answer the questions (i) to (iv) based on the following code : class Trainer { char TNo [5], TName [20], Specialisation [10]; int Days; protected : float Remuneration; void AssignRem (float); public : Trainer ( ) ; void TEntry ( ); void TDisplay ( ); }; class Learner { char Regno [10], LName [20], Program [10]; Protected : int Attendance, Grade; public: Learner ( ); void LEntry ( ); void LDisplay ( ); }; class Institute : public Learner, public Trainer { char ICode[10], IName [20]; public: Institute ( ); void IEntry ( ); void IDisplay ( ); }; (i) Which type of Inheritance is depicted by the above example? 87 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (ii) Identify the member function(s) that cannot be called directly from the objects of class Institute from the following TEntry( ) LDisplay() IEntry() (iii) Write name of all the member(s) accessible from member functions of class Institute. (iv) If class Institute was derived privately from class Learner and privately from class Trainer, then, name the member function(s) that could be accessed through Objects of class Institute. 2007 03. (d) Answer the questions (i) to (iv) based on the following: class FaceToFace { char CenterCode[10]; public: void Input( ); void Output( ); }; class Online { char website[50]; public: void SiteIn( ); void SiteOut( ); }; class Training: public FaceToFace, private online { long Tcode; float charge; int period; public: void Register( ); void show( ); }; (i) Which type of inheritance is shown in the above example? (ii) Write names of all the member functions accessible from Show( ) function of class Training. 88 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) Write name of all the member accessible through an object of class Training. (iv) Is the function Output( ) accessible inside the function SiteOut( )? Justify your answer? 2009 89 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 04. (d) Answer the questions (i) to (iv) based on the following : class Chairperson { long CID ; //Chairperson Identification Number char CName[20] ; protected : char Description[40] ; void Allocate( ) ; public : Chairperson( ) ; void Assign( ) ; void Show( ) ; }; class Director { int DID ; //Director ID char Dname[20] ; protected : char Profile[30] ; public : Director( ) ; void Input( ) ; void output( ) ; }; class Company : private Chairperson, public Director { int CID ; //Company ID char City[20] , Country[20] ; public : Company( ) ; void Enter( ) ; void Display( ) ; }; (i) Which type of Inheritance out of the following is specifically is illustrated in the above C++ code ? (a) Single Level Inheritance (b) Multi Level Inheritance (c) Multiple Inheritance (ii) Write the names of data members, which are accessible by objects of class type Company. 90 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) Write the name of all the member functions, which are accessible by objects of class type Company. (iv) Write the names of all members, which are accessible from member functions of class Director. 2010 05. (d) Answer the question (i) to (iv) based on the following: class Student { int Rno; char Name[20]; float Marks; protected: void result( ); public: Student ( ); void Register ( ); void Display( ); }; class Faculty { long FCode; char FName [20]; protected: float Pay; public: Faculty ( ); void Enter( ); void Show( ); }; class Course: public Student, private Faculty { long CCode [10]; char CourseName [50]; char StartDate [8], EndDate [8]; public: Course( ); void Commence ( ); void CDetail ( ); }; (i) Which type of inheritance is illustrated in the above C++ code? (ii) Write the names of all the data members, which is /are accessible from member function Commence of class Course. 91 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) Write the names of member functions, which are accessible from objects of class Course. (iv) Write the names of all the members, which are accessible from objects of class faculty. 2011 06. (d) Answer the questions (i) to (iv) based on the following: 4 class PUBLISHER { char Pub[12]; double Turnover; protected: void Register(); public: PUBLISHER(); void Enter(); void Display(); }; class BRANCH { char CITY[20]; protected: float Employees; public: BRANCH(); void Haveit(); void Giveit(); }; class AUTHOR:private BRANCH,public PUBLISHER { int Acode; char Aname[20]; float Amount; public: AUTHOR(); void Start(); void Show(); }; (i) Write the names of data members, which are accessible from objects belonging to class AUTHOR. (ii) Write the names of all the member functions which are accessible from objects belonging to class BRANCH. 92 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) Write the names of all the members which are accessible from member functions of class AUTHOR. (iv) How many bytes will be required by an object belonging to class AUTHOR? SP 93 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK QNO 3 (A) 1. 3(a) Suppose an array P containing float is arranged in ascending order. Write a userdefined function in C++ to search for one float from P with the help of Binary search method. The function should return an integer 0 to show absence of the number and integer 1 to show presence of the number in the array. The function should have the parameters as (i) an array P (ii) the number DATA to be searched (iii) number of elements N. Delhi 1998 3 2. 3(a) Suppose a one-dimensional array AR containing integers is arranged in ascending order. Write a user-defined function in C++ to search for an integer from AR with the help of Binary search method, returning an integer 0 to show absence of the number and integer 1 to show presence of the number in the array. Function should have three parameters : (i) array AR (ii) the number to be searched and (iii) the number of elements N in the array. Outside Delhi 1998 3 3 3 (a) Suppose a one-dimensional array AR containing integers is arranged in ascending order. Write a user-defined function in C++ to search for an integer from AR with the help of Binary search method, returning an integer 0 to show absence of the number and integer 1 to show presence of the number in the array. Function should have three parameters : (i) array AR (ii) the number to be searched and (iii) the number of elements N in the array. Delhi 1999 3 4 3 (a) Suppose a one-dimensional array AR containing integers is arranged in ascending order. Write a user-defined function in C++ to search for an integer from AR with the help of Linear search method, returning an integer 0 to show absence of the number and integer 1 to show presence of the number in the array. Function should have three parameters : (i) array AR (ii) the number to be searched and (iii) the number of elements N in the array. 1999 3 5 3 (a) Suppose A, B, C are arrays of integers of size M, N, and M + N respectively. The numbers in array A appear in ascending order while the numbers in array B appear in descending order. Write a user defined function in C++ to produce third array C by merging arrays A and B in ascending order. Use A, B and C as arguments in the function Delhi 2000 3 6 3 (a) Suppose X,Y,Z are arrays of integers of size M, N, and M + N respectively. The numbers in X and Y appear in descending order. Write a user defined function in C++ to produce third array Z by merging arrays X and Y in descending order. Outside Delhi 2000 3 94 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 7 3(a) Write a C++ function to sort an array of integers using insertion sort method. The function should have two parameters name of the array and number of elements in the array Compartment 2000 3 8 3(a) Given two arrays of integers A and B of sizes M and N respectively. Write a function named MIX() with four arguments, which will produce third array named C, such that the following sequence is followed. (i) All even numbers of A from left to right are copied into array C from left to right. (ii) All odd numbers of A from left to right are copied in to array C from right to left. (iii) All even numbers of B from left to right are copied into array C from left to right. (iv) All odd numbers of B from left to right are copied in to array C from right to left. Delhi 2001 3 9 3(a) Given two arrays of integers X and Y of sizes M and N respectively. Write a function named MERGE() with four arguments, which will produce third array named C, such that the following sequence is followed. (v) All even numbers of X from left to right are copied into array Z from left to right. (vi) All odd numbers of X from left to right are copied in to array Z from right to left. (vii) All even numbers of Y from left to right are copied into array Z from left to right. (viii) All odd numbers of Y from left to right are copied in to array Z from right to left. Outside Delhi 2001 3 10 3(a) Define Queue and Stack Delhi Board 2002 2 11 3(a) Define Array and Pointer Outside Delhi Board 2 12 3(a) Assume an array S containing elements of structure student is required to be arranged in descending order of marks. Write a C++ to arrange the same with the help 95 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj of bubble sort. The array and its size is required to be passed as parameters to the function. The definition of the structure student is as follows: struct Student { int Rollno; char Name[25]; float Marks; }; Delhi Board 2003 3 13 3(a) Assume an array E containing elements of structure employee required be arranged in descending order of salary. Write a C++ function to arrange the same with the help of bubble sort, the array and size is required to be passed as parameters to the function. definition of structure employee is as follows: struct employee { int Eno; char Name[25]; float Salary; }; Outside Delhi Board 2003 3 14 3(a) A one dimensional array POINTS is containing long type data arranged in ascending order. Write a user defined function in C++ to search for a number from POINTS with the help of Binary Search Method. The function should return an integer -1 to show absence of the number and integer 1 to show presence of the number in the array. The function should have three parameters as (1) an array POINTS, (2) The number SData to be searched, (3) Number of elements N. Compartment 2003 3 15 3(a) Define a function Reversearray(int[], int) that would accept a one dimensional array NUMBERS and its size N. The function should reverse contents of the array without using any second array. Note: Use the concept of swapping elements, (Example : if the array initially contains {2,15,3,14,7,9,19,6,1,10}, then after reversal the array should contain {10,1,6,19,9,7,14,3,15,2} Delhi Board 2004 3 16 96 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 3(a) Define function SwapArray(int[],int), that would accept a one dimensional array integer array NUMBERS and its size N. The function should rearrange the array in such a way that the values of alternate locations of the array are exchanged (Assume the size of the array is to be even) Example: If the array initially contains { 2,5,9,14,17,8,19,16 } then after the arrangement the array should contain { 5,2,14,9,8,17,16,19 } Outside Delhi 2004 3 17 3(a) (i) Give the number of elements in a circular queue (ii) With the 12 memory locations if Front = 10 and Rear = 3 elements are deleted from above queue, what will be the value of Front and Rear. Compartment 2004 3 18 3(a) Write a function in C++ which accepts an integer array and its size as arguments/ parameters and exchanges the values of first half side elements with the second half side elements of the array. Example : If an array of eight elements has initial content as { 2,4,1,6,7,9,23,10 } the function should rearrange the array as, { 7,9,23,10,2,4,1,6 } DelhiBoard 2005 3 19 3(a) Write a function in C++ which accepts an integer array and its size as arguments/ parameters and exchanges the values of first half side elements with the second half side elements of the array. Example : If an array of eight elements has initial content as { 8,10,1,3,17,90,13,60} the function should rearrange the array as, {17,90,13,60, 8,10,1,3} Outside DelhiBoard 2005 3 20 3(a) Write a function Findsort() to find weather the given integer array arr[10] is sorted in ascending order or descending order or it is not in order. The function should return ‘A’ for ascending, ‘D’ for descending and ‘N’ for no order. Compartment 2005 3 21 3(a) Write a function in C++ which accepts an integer array and its size as arguments / parameters and assign the elements into a two dimensional array of integers in the following format D 2006 3 If the array is 1, 2, 3, 4, 5, 6 The resultant 2 D array is given, 97 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 123456 123450 123400 123000 120000 100000 If the array is 1, 2, 3 The resultant 2 D array is given below 123 120 100 22 3. (a) Write a function in C++ which accepts an integer array and its size as arguments/ parameters and assign the elements into a two dimensional array of integers in the following format : OD 2006 3 If the array is 1, 2, 3, 4, 5, 6 The resultant 2 D array is given below 100000 120000 123000 123400 123450 123456 If the array is 1, 2, 3 The resultant 2 D array is given below 100 120 123 23 3. (a) Write a function in C++ which accepts an integer array and its size as arguments/ parameters and assign the elements into a two dimensional array of integers in the following format : Compartment 2006 3 If the array is 1, 2, 3, 4, 5, 6 The resultant 2 D array is given below 0 0 0 0 01 000021 000321 004321 054321 654321 98 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj If the array is 1, 2, 3 The resultant 2 D array is given below 001 021 321 24 3. (a) Write a function in C++ which accepts an integer array and its size as arguments and replaces elements having odd values with thrice its value and elements having even values with twice its value. Delhi 2007 4 Example : if an array of five elements initially contains the elements as 3, 4, 5, 16, 9 then the function should rearrange the content of the array as 9, 8, 15, 32, 27 25 3. (a) Write a function in C++ which accepts an integer array and its size as arguments and replaces elements having even values with its half and elements having odd values with twice its value. Outside Delhi 2007 4 Example : if an array of five elements initially contains the elements as, 3, 4, 5, 16, 9 then the function should rearrange the content of the array as, 6, 2, 10, 8, 18 26 3. (a) Write a function in C++, which accepts an integer array and its size as parameters and rearranges the array in reverse. Delhi 2008 4 Example: if an array of nine elements initially contains the elements as 4, 2, 5, 1, 6, 7, 8, 12, 10 then the function should rearrange the array as 10, 12, 8, 7, 6, 1, 5, 2, 4 27 99 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 3. (a) Write a function in C++, which accepts an integer array and its size as arguments and swaps the elements of every even location with its following odd location. OUTSIDE DELHI 2008 4 Example: if an array of nine elements initially contains the elements as 2, 4, 1, 6, 5, 7, 9, 23, 10 then the function should rearrange the array as 4, 2, 6, 1, 7, 5, 23, 9, 10 28 3(a) Write a function in C++, which accepts an integer array and size as argument and swaps the elements of every location with its following odd location. COMPARTMENT 2008 4 Example: If an array of nine elements initially contains the elements as 2,4,1,6,5,7,9,223,10 then the function should arrange the array as 4,2,6,1,7,5,23,9,10 29 3. (a) Write a function SORTPOINTS( ) in C++ to sort an array of structure Game in ascending order of Points using Bubble Sort. Delhi 2009 3 Note: Assume the following definition of structure Game struct Game { long PNo; //Player Number char PName [20] ; long Points; }; Sample content of the array (before sorting) PNo 103 104 101 105 PName Ritika Kapur John Philip Razia Abbas Tarun Kumar Points 3001 2819 3451 2971 Sample content of the array (after sorting) PNo PName Points 100 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 101 103 105 104 Razia Abbas Ri tika Kapur Tarun Kumar John Philip 3451 3001 2971 2819 30 3. (a) Write a function SORTPOINTS( ) in C++ to sort an array of structure Game in descending order of Points using Bubble Sort. 3 Delhi 2009 Note: Assume the following definition of structure Game struct Game { long PNo; //Player Number char PName [20] ; long Points; }; Sample content of the array (before sorting) PNo PName Points 103 Ritika Kapur 3001 104 John Philip 2819 101 Razia Abbas 3451 105 Tarun Kumar 2971 Sample content of the array (after sorting) PNo PName Points 101 Razia Abbas 3451 103 Ri tika Kapur 3001 105 Tarun Kumar 2971 104 John Philip 2819 31 3. (a) Write a function SORTSCORE( ) in C++ to sort an array of structure Examinee in descending order of Score using Bubble Sort. 3 Outside Delhi 2009 Note: Assume the following definition of structure Examinee struct Examinee { long RollNo; char Name [20] ; float Score; }; 101 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 32 3.(a) Write a function in C++ to merge the contents of two sorted arrays A & B into third array C. Assuming array A is sorted in ascending order, B is sorted in descending order, the resultant array is required to be in ascending order. Sample paper set I 2009 4 33 3.(a) Write a function in C++ to combine the contents of two equi-sized arrays A and B by computing their corresponding elements with the formula 2*A[i]+3*B[i]; where value i varies from 0 to N-1 and transfer the resultant content in the third same sized array. Sample Paper Set II 2009 4 34 Delhi 2010 102 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 35 36 3(a) Write a functi on in C++ to merg e the cont ents of two sorte d arrays A & B into third array C. Assuming array A and B are sorted in ascending order and the resultant array C is also required to be in ascending order. Sample paper 2010 3 37 3 (a) Write a Get1From2 ( ) function in C++ to transfer the content from two arrays FIRST[ ] and SECOND[ ] to array ALL[ ]. The even places (0, 2, 4,...) of array ALL[ ] should get the content from the array FIRST[ ] and odd places (1, 3, 5, ) of the array ALL[] should get the content from the array SECOND[ ]. Delhi 2011 3 Example: If the FIRST[ ] array contains 30, 60, 90 And the SECOND[ ] array contains 10, 50, 80 The ALL[ ] array should contain 30, 10, 60, 50, 90, 80 38 3. (a) Write a Get2From1() function in C++ to transfer the content from one array ALL[] to two different arrays Odd[] and Even[]. The Odd[] array should contain the values from odd positions (1,3,5,...) of ALL[] and Even [] array should contain the values from even positions (0, 2, 4,…..) of ALL []. Outside Delhi 2011 3 Example If the ALL[] array contains 12, 34, 56, 67, 89, 90 The Odd[] array should contain 34, 67, 90 And the Even [] array should contain 12,56,89 103 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 39 40 Sample Paper 2012 Set I 41 QNO 3 (B) 01. (b) An array T [15] [10] is stored in the memory with each element requiring 2 bytes of storage. If the base address of T is 2000, determine the location of T[7][8] when the array is T stored by (i) row major (ii) column major. 1998 02. (b) An array A[10][20] is stored in the memory with each element requiring 2 bytes of storage. If the base address of the array in the memory is 400, determine the location of A[8][13] when the array is stored as (i) row major (ii) column major. 1999 03. (b) An array VAL ([1..15][1..10] is stored in the memory with each element requiring 4 bytes of storage. If the base address of array VAL is 1500, determine the location of VAL (12] [9], when the array VAL is stored (i) Row wise (ii) Column wise. 2000 04. (b) An array X [7] [20] is stored in memory with each element requiring 2 bytes of storage. If the base address of the array is 2000, calculate the location of X[3)[5] when the array X is stored in Column major order. 104 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Note: X[7][20] means valid row indices are 0 to 6 and valid column indices are 0 to 19. 2001 05. (b) Given the following class : char *msg[ ] = {"overflow” , ”under flow"} class Stack { int top; // the stack pointer stk[5]: //the elements void err_rep(int e_num) { cout << msg[e_enum]; }// report error message public : void init() { top=0; } // initialize the stack pointer void push(int); // put new value in stk void pop(); // get the top value }; Define push outside the Stack. In your definition take care of overflow condition. Function push has to invoke err_rep to report over flow. 2002 06. (b) An array ARR[5][5] is stored in the memory with each element occupying 2 bytes of space. Assuming the base address of ARR to be 1500, compute the address of ARR[2][4], when the array is stored : (i) Row Wise (ii) Column Wise 2004 07. (b) An array Arr[15][35] is stored in the memory along the column with each of its elements occupying 8 bytes. Find out the base address and the address of an element Arr[2][5], if the location Arr[5][10] is stored at the address 4000. 2005 08. (b) An array Array[20][15] is stored in the memory along the column with each element occupying 8 bytes. Find out the Base Address and address of the element Array[2][3] if the element Array [4] [5] is stored at the address 1000. 2007 105 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 09. (b) An array S[40][30] is stored in the memory along the column with each of the element occupying 4 bytes, find out the base address and address of element S[20][15], if an element S[15][10] is stored at the memory location 7200. 2009 10. b) An array p[50][60] is stored in the memory along the column with each of the element occupying 2bytes, find out the memory location for the element p[10][20], if the Base Address the array is 6800. 2010 11. (b) An array P[20] [50] is stored in the memory along the column with each of its Element occupying 4 bytes, find out the location of P[15] [10], if P[0][0] is stored at 5200. 2011 12. 2012 13. (b) An array P[20][30] is stored in the memory along the column with each of the element occupying 4 bytes, find out the memory location for the element P[5][15], if an element P[2][20] is stored at the memory location 5000. S.P 1 14. (b) An array S[40][30] is stored in the memory along the row with each of the element occupying 2 bytes, find out the memory location for the element S[20][10], if an element S[15][5] is stored at the memory location 5500. S.P 2 15. (b) An array S[40][30] is stored in the memory along the row with each of the element occupying 2 bytes, find out the memory location for the element S[20][10], if the Base Address of the array is 5000. S.P 3 106 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Q NO 3 (C) 01. (c) Write a user-defined function in C++ to display the sum of column elements of a two dimensional arrray R[7][7] containing integers. 1998 02. (c) Write a user-defined function in C++ to display the multiplication of row element of two-dimensional array A[4][6] containing integer. 1999 03. c) Write a user-defined function in C++ to find and display the sum of both the diagonal elements of a two-dimensional array MATRIX [6] [6] containing integers. 2000 04. c)An array X [7] [20] is stored in memory with each element requiring 2 bytes of storage. If the base address of the array is 2000, calculate the location of X[3)[5] when the array X is stored in Column major order. Note: X[7][20] means valid row indices are 0 to 6 and valid column indices are 0 to 19. 2001 05. c) Use a stack to evaluate the following postfix expression and show the content of the stack after execution of each operation. Don't write any code. Assume as if you are using push and pop member functions of the stack. 2002 AB - CD + E * + (where A=5, B=3, C=5, D =4, and E=2) 06. (c) Write a function in C++ to find the sum of diagonal elements from a 2 dimensional array of type float. Use the array and its size as parameters with float as its return type. 2004 07. (c) Write a function in C++ to perform a PUSH operation in a dynamically allocated stack considering the following: struct Node { int X, Y; Node *Link; }; class STACK { Node *Top; 107 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj public: STACK() {Top=NULL;} void PUSH(); void POP() ; ~STACK(); }; 2005 08. (c) Write a function in C++ to delete a node containing Book’s information, from a dynamically allocated Stack of Books implemented with the help of the following structure. 4 struct Book } int BNo; char BName[20]; Book *Next; }; 2007 09. (c) Write a function QUEINS( ) in C++ to insert an element in a dynamically allocated Queue containing nodes of the following given structure: 4 struct Node { int PId; // Product Id char Pname[20]; NODE *Next; }; 2009 10. (c) Write a complete program in C++ to implement a dynamically allocated Stack containing names of Countries. 2010 11. (c) Write a function in C++ to perform Insert: operation on a dynamically allocated Queue containing Passenger details as given in the following definition of NODE. 4 struct NODE { long Pno; //passenger Number 108 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj char Pname[20] ; //passenger Name NODE *Link.; }; 2011 12. 2012 13. (c) Write a function in C++ to perform Push operation on a dynamically allocated Stack containing real numbers. SP 1 14. (c) Write a function in C++ to perform Insert operation in a dynamically allocated Queue containing names of students. SP 2 15. (c) Write a function in C++ to perform Insert operation in a dynamically allocated Queue containing names of students. SP 3 Q No 3 (D) 01. (d) Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation : 50,40,+,18, 14,-, *,+ 1998 109 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 02. (d) Evaluate the following postfix expression using a stack and show the contents of the stack after execution of each operation. 5,11, 6, 8, +, 12, *, / 1999 03. d) Evaluate the following postfix expression using a stack. Show the contents of stack after execution of each operation. 20, 8, 4,/, 2,3,+,*,2000 04. d) Convert the expression (True && False) || !(False || True) to postfix expression. Show the contents of the stack at every step. 2001 05. d) The array A[20] [10] is stored in the memory with each element requiring one byte of storage if the base address of A is C0. Determine C0 when the location of A[10] [5] is 2000. 2002 06. (d) Obtain the postfix notation for the following infix notation of expression showing the contents of the stack and postfix expression formed after each step of conversion : 2 A * B + (C — D/F) 2004 07. (d) Write a function in C++ to print the sum of all the values which are either divisible by 2 or are divisible by 3 present in a two-dimensional array passed as the argument to the function. 2005 110 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 08. (d) Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements which lie on diagonals. [Assuming the 2D Array to be a square matrix with odd dimension i.e. 3×3, 5×5, 7×7 etc.] Example, if the array content is 5 4 3 6 7 8 1 2 9 Output through the function should be : Diagonal One : 5 7 9 Diagonal Two : 3 7 1 2007 09. (d) Define a function SWAPCOL( ) in C++ to swap (interchange) the first column elements with the last column elements, for a two dimensional integer array passed as the argument of the function. 2009 Example: If the two dimensional array contains 2149 1377 5863 7212 After swapping of the content of 1st column and last column, it should be: 9142 7371 3865 2217 10. (d) Write a function int SKIPSUM(int A[] [3], int N, int M) in C++ to find and return the sum of elements from all alternate elements of a two-dimensional array starting from A[0][0]. 2010 [Hint: If the following is the content of the array A [0] [0] 4 A [1] [0] 2 A [2] [0] A [0] [1] 5 A [1] [1] 8 A [2] [1] A [0] [2] 1 A [1] [2] 7 A [2] [2] 111 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 9 6 3 The function SKIPSUM( ) should add elements A[0][0],A[0][2], A[1][1], A[2][0] and A[2][2].] 11. (d) Write a COLSUM ( ) function in C++ to find sum of each column of each column of a NxM matrix. 2011 12. 2012 13. (d) Write a function in C++ to find sum of rows from a two dimensional array. SP 1 14. (d) Write a function in C++ to find the sum of both left and right diagonal elements from a two dimensional array (matrix). SP 2 15. (d) Write a function in C++ to find the sum of both left and right diagonal elements from a two dimensional array (matrix). SP 3 Q No. 3(E) 01. (e)Give the necessary declaration of a linked implemented stack containing integer type numbers also write a user-defined function in C++ to pop a number from this stack. 1998 02. (e) Give the necessary declaration of a linked list implemented queue containing float type values. Also write a user-defined function in C++ to delete a float type number from the queue . 1999 03. e) Give necessary declarations for a queue containing float type numbers; also write a user-defined function in C++ to insert a float type number in the queue. You should use linked representation of queue. 2000 04. (e) Each node of a STACK contains the following information, in addition to required pointer field : 112 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj i) Roll number of the student ii) Age of the student 2001 113 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 05. e) Considering the following key set: 42, 29, 74, 11, 65, 58. Use bubble sort to sort the data in ascending order and indicate the sequences of steps required. 2002 06. (e) Define member functions queins( ) to insert nodes and quedel( ) to delete nodes of the linked list implemented class queue, where each node has the following structure : struct node { char name[20]; int age; node *Link; }; class queue { node * rear,* front; public: queue(){rear=NULL;front=NULL}; void queins(); void quedel(); }; 2004 07. (e) Evaluate the following postfix notation of expression: 10 20 + 25 15 - * 30 / 2005 08. (e) Evaluate the following postfix notation of expression : 25 8 3 - / 6 * 10 + 2007 09. (e) Convert the following infix expression to its equivalent postfix expression showing stack contents for the conversion: X - Y / (Z + U) * V 2009 114 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 10. (e) Evaluate the following postfix notation of expression : (Show status of Stack after each operation) False, True, NOT, OR, True, False, AND, OR 2010 11. (e) Evaluate the following postfix notation of expression : 50, 60, +,20, 10, -, * 2011 12. 2012 13. (e) Evaluate the following postfix notation of expression: True, False, AND, True, True, NOT, OR, AND SP 1 14. (e) Evaluate the following postfix notation of expression: 20,30,+,50,40,-,* SP 2 15. (e) Evaluate the following postfix notation of expression: 20, 30, +, 50, 40, - ,* SP 3 115 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK Q.No. 4(A) 01. (a) Observe the program segment given below carefully and fill the blanks marked as Line 1 and Line 2 using fstream functions for performing the required task. #include<fstream.h> class Stock { long Ino; // Item Number char Item[20]; // Item Name int Qty; // Quantity public: void Get(int); Get(int);// Function to enter the content void Show( ); // Function to display the content void Purchase(int Tqty) { Qty+ = Tqty; // Function to increment in Qty } long KnowIno( ) { return Ino; } }; void Purchaseitem(long PINo, int PQty) // PINo -> Info of the item purchased // PQty -> Number of items purchased { fstream file; File.open(“ITEMS.DAT”,ios::binary|ios::in|ios::cut); int Pos=-1; Stock S; while (Pos== -1 && File.read((char*)&S, sizeof(S))) if (S.KnowInc( ) == PINo) { S.Purchase(PQty); // To update the number of items Pos = File.tellg()- sizeof(S); //Line 1 : To place the file pointer to the required position ______________________________________; //Line 2 : To write the objects on the binary file ______________________________________; } if (Pos == -1) cout<<“No updation done as required Ino not found...”; File.close( ); 116 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } 2009 02.(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg( ), seekp( ), tellp( ) and tellg() functions for performing the required task. # include <fstream.h> class PRODUCT { int Pno; char pname [20]; int qty; public : void ModifyQty();// The function is to modify quantity of a PRODUCT }; void PRODUCT :: ModifyQty ( ) { fstream Fil; Fil.open(“PRODUCT.DAT”,ios::binary | ios::in | ios::out); int MPno; cout<<“Product No to modify quantity :”; cin>>MPno; while( Fil.read ((char*) this, sizeof (PRODUCT))) { if (MPno ==Pno) { cout<<“present quantity:” <<Qty<<endl; cout<<“changed quantity:”; cin>>Qty; int position = ________; //Statement 1 ___________________; //Statement 2 Fil.write ((char*) this, sizeof (PRODUCT)); // Re-writing the Record } } Fil.close( ); } 2011 03.(a) Write name of two member functions belonging to fstream class. 1998 04.(a) Differentiate between read() & write() functions. 1999 05.(a) Name two member functions of ofstream class. 2000 06. (a) Distinguish between serial files and sequential files. 2001 07. (a) What is the difference between get() and read() ? 2002 08. (a) Assuming that a text file named FIRST.TXT contains some text written into it, write a function named vowelwords( ), that reads the file FIRST.TXT and creates a new file named SECOND.TXT, to contain only those words from the file FIRST.TXT which start with a lowercase vowel (i.e. with ‘a’, ‘e’, ‘i’, ‘o’, ‘u’). For example if the file FIRST.TXT contains 117 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Carry umbrella and overcoat when it rains Then the file SECOND.TXT shall contain umbrella and overcoat it 2004 09.(a) Observe the program segment given below carefully, and answer the question that follows: class Book { int Book no; char Book_name[20]; public: //function to enter Book details void enterdetails(); // function to display Book details void showdetails(); //function to return Book_no int Rbook_no () { return Book_no; } } ; void Modify(Book NEW) { fstream File; File.open(“BOOK.DAT”,ios::binary|ios::in|ios::out); Book OB; int Recordsread = 0, Found = 0; while (!Found && File.read((char*)&OB, sizeof (OB))) { Recordsread ++ ; if (NEW.RBook_no() = = OB.RBook_no)) { ______________ //Missing Statement File.write((char*)&NEW, sizeof (NEW)); Found = 1; } else File.write((char*)&OB, sizeof(OB)); } if (! Found) cout<<" Record for modification does not exist”; File.close(); } If the function Modify( ) is supposed to modify a record in file BOOK.DAT with the values of Book NEW passed to its argument, write the appropriate statement for Missing Statement using seekp( ) or seekg( ), whichever needed, in the above code that would write the modified record at its proper place. 2005 10. (a) Observe the program segment given below carefully, and answer the question 118 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj that follows: class PracFile { intPracno; char PracName[20]; int TimeTaken; int Marks; public: // function to enter PracFile details void EnterPrac( ); // function to display PracFile details void ShowPrac( ): // function to return TimeTaken int RTime() {return TimeTaken;} // function to assign Marks void Assignmarks (int M) { Marks = M;} }; void AllocateMarks( ) { fstream File; File.open(“MARKS.DAT”,ios::binary|ios::in|ios::out); PracFile P; int Record = 0; while (File.read(( char*) &P, sizeof(P))) { if(P.RTime()>50) P.Assignmarks(0) else P.Assignmarks(10) ______________ //statement 1 ______________ //statement 2 Record + + ; } File.close(); } If the function AllocateMarks () is supposed to Allocate Marks for the records in the file MARKS.DAT based on their value of the member TimeTaken. Write C++ statements for the statement 1 and statement 2, where, statement 1 is required to position the file write pointer to an appropriate place in the file and statement 2 is to perform the write operation with the modified record . 2007 11.(a).Observe the program segment given below carefully and fill in the blanks marked as Statement 1 and Statement 2 using tellg ( ) and skeep ( ) functions for performing the required task. #include <fstream. h> class c1ient 119 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { long Cno ; char Name [20]; Email [30] ; public : //Function to allow user to enter the cno,Nme , Email. void Enter ( ) ; // Function to allow user to enter (modify) Email. void modify ( ) ; long ReturnCno( ) { return Cno ; } } ; void changeEmail ( ) { Client C ; fstream F ; F. open (“INFO.DAT” , ios :: binary |ios :: in|ios :: out); long Cnoc ; //Client’s no. whose Email needs to be changed cin >> Cnoc ; while (F. read (( char*) &C, sizeof (C))) { if (Cnoc = = C.Returncno( )) { C.Modify( ) ; //Statement 1 int Pos = __________//To find the current position of //file pointer //statement 2 _________________ //To move the file pointer to write //the modified record back into the //file for the desired cnoc F.write ((char*) &C, sizeof(C)); } } F.close( ) ; } 2010 12.(a)Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekg() and tellg() functions for performing the required task. #include <fstream.h> class Employee { int Eno; char Ename[20]; 120 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj public: //Function to count the total number of records int Countrec(); }; int Item::Countrec() { fstream File; File.open(“EMP.DAT”,ios::binary|ios::in); ______________________ //Statement 1 int Bytes = ______________________ //Statement 2 int Count = Bytes; sizeof(Item); File.close(); return Count; } (s.o) 13. (a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekp() and seekg() functions for performing the required task. #include <fstream.h> class Item { int Ino; char Item[20]; public: //Function to search and display the content from a particular //record number void Search(int ); //Function to modify the content of a particular record number void Modify(int); }; void Item::Search(int RecNo) { fstream File; File.open(“STOCK.DAT”,ios::binary|ios::in); ______________________ //Statement 1 File.read((char*)this,sizeof(Item)); cout<<Ino<<”==>”<<Item<<endl; File.close(); } void Item::Modify(int RecNo) { fstream File; File.open(“STOCK.DAT”,ios::binary|ios::in|ios::out); cout>>Ino;cin.getline(Item,20); ______________________ //Statement 2 File.write((char*)this,sizeof(Item)); File.close(); 121 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } (s.o) 14.(a) Observe the program segment given below carefully and fill the blanks marked as Statement 1 and Statement 2 using seekp() and seekg() functions for performing the required task. #include <fstream.h> class Item { int Ino; char Item[20]; public: //Function to search and display the content from a particular //record number void Search(int ); //Function to modify the content of a particular record number void Modify(int); }; void Item::Search(int RecNo) { fstream File; File.open(“STOCK.DAT”,ios::binary|ios::in); ______________________ //Statement 1 File.read((char*)this,sizeof(Item)); cout<<Ino<<”==>”<<Item<<endl; File.close(); } void Item::Modify(int RecNo) { fstream File; File.open(“STOCK.DAT”,ios::binary|ios::in|ios::out); cout>>Ino;cin.getline(Item,20); ______________________ //Statement 2 File.write((char*)this,sizeof(Item)); File.close(); (s.p) Q.No. 4(B) 01. (b) Assuming the class FLOPPYBOX. write functions in C++ to perform the following: (i) Write the object of FLOPPYBOX to a binary file. (ii) Read objects of FLOPPYBOX from the binary and display on the screen class FLOPPYBOX 122 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { int size; char name[10]; public : void getdata() { cin >> size; gets (name); } void showdata () { cout << size << " " << name <<endl; } }; 1998 02. (b) Write a function COUNT_DO( ) in C++ to count the presence of a word „do‟ in a text file “MEMO.TXT”. Example : If the content of the file “MEMO.TXT” is as follows: I will do it, if you request me to do it. It would have been done much earlier. The function COUNT_DO( ) will display the following message: Count of -do- in flie: 2009 03. (b) Write a function in C++ to count the no. of “Me” or “My” words present in a text file “DIARY.TXT”. If the file “DIARY.TXT” content is as follows : My first book was Me and My family. It gave me chance to be known to the world. The output of the function should be Count of Me/ My in file : 2011 04. (b) Assuming the class EMPLOYEE given below, write functions in C++ to perform following: (i) Write the objects of EMPLOYEE to a binary file. (ii) Read the objects of EMPLOYEE from binary file and display them on screen. class EMPLOYEE { int ENO; char ENAME[10]; public : void GETIT() { cin >> ENO; gets (ENAME); 123 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } void SHOWIT() { cout <<ENO << ENAME ; cout<<endl; } }; 1998 05. (b) Assuming the class FLOPPYBOX. write functions in C++ to perform the following: (i) Write the object of FLOPPYBOX to a binary file. (ii) Read objects of FLOPPYBOX from the binary and display on the screen. class FLOPPYBOX { int size; char name[10]; public : void getdata() { cin >> size; gets (name); } void showdata () { cout << size << " " << name ; cout<<endl; } }; 1999 06. (b) Assuming the class? DRINKS defined below, write functions in C++ to perform the following: i. Write the objects of DRINKS to a binary files. ii. Read the objects of DRINKS from binary file and display them on the screen when DNAME has value "INDY COLA". class DRINKS { int DCODE; char DNAME[13]; // Name of the drink int DSIZE; // Size in liters float DPRICE; public: void GETDRINKS() 124 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj { cin >> DCODE >> DNAME >> DSIZE >>DPRICE; } void SHOWDRINKS () { cout<< DCODE << DNAME << DSIZE << DPRICE << endl; } char *GETNAME () { return DNAME; } }; 2000 07. b) Consider the class declaration: class BUS { int bus_no; char destination[20]; float distance; public : void Read(); // To read an object from the keyboard void Write (); // To write an object into a file void Show (); // To display the file contents on The monitor }; Complete the member functions definitions. 2001 08. b) Write a C++ program, which reads one line at a time from the disk file TEST.TXT, and displays it to a monitor. Your program has to read all the contents of the file. Assume the length of the line not to exceed 80 characters. You have to include all the header files if required. 2002 09. (b) Assuming the class Computer as follows : class computer { char chiptype[10]; int speed; public: void getdetails() { gets(chiptype); cin>>speed; } void showdetails() { 125 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj cout<<“Chip”<<chiptype<<“ Speed= “<<speed; } }; Write a function readfile( ) to read all the records present in an already existing binary file SHIP.DAT and display them on the screen, also count the number of records present in the file. 2004 10. b) Write a function in C++ to count and display the number of lines starting with alphabet ‘A’ present in a text file “LINES.TXT”. Example: If the file “LINES.TXT” contains the following lines, A boy is playing there. There is a playground. An aeroplane is in the sky. Alphabets and numbers are allowed in the password. The function should display the output as 3. 2005 11. (b) Write afunction in C++ to print the count of the word is as an independent word in at text file DIALOGUE.TXT. 2 For example, if the content of the file DIALOGUE. TXT is This is his book. Is this book good? Then the output of the program should be 2. 2007 12. (b) Write afunction in C++ to print the count of the word is as an independent word in at text file DIALOGUE.TXT. For example, if the content of the file DIALOGUE. TXT is This is his book. Is this book good? Then the output of the program should be 2. 2010 12. (b) Write a function in C++ to read the content of a text file “DELHI.TXT” and diaplay all those lines on screen, which are Either starting with ‘D’ or starting with ‘M’. 2012 126 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 13. (b) Write a function in C++ to count the number of alphabets present in a text file “NOTES.TXT”. SP1 14. (b) Write a function in C++ to count the number of lines present in a text file “STORY.TXT”. SP2 15. (b) void CountLine() { ifstream FIL("STORY.TXT"); int LINES=0; char STR[80]; while (FIL.getline(STR,80)) LINES++; cout<<"No. of Lines:"<<LINES<<endl; f.close(); } (½ Mark for opening STORY.TXT correctly) (½ Mark for initializing a counter variable as 0) (½ Mark for correctly reading a line from the file) (½ Mark for correctly incrementing the counter) SP3 Q.No. 4(C) 127 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 1. (c) Write a function in C++ to search for a laptop from a binary file “LAPTOP.DAT” containing the objects of class LAPTOP (as defined below). The user should enter the Model No and the function should search and display the details of the laptop. class LAPTOP { long ModelNo; float RAM, HDD; char Details[120]; public: void StockEnter ( ) { cin>>Model>>No>>RAM>>HDD; gets(Details); } void StockDisplay( ) {cout<<ModelNo<<RAM<<HDD<<Details<<endl; } long ReturnModelNo ( ) { return ModelNo ; } }; 2011 2. (c) Write a function in C++ to read and display the detail of all the users whose status is „A‟ (i.e. Active) from a binary file “USER.DAT”. Assuming the binary file “USER.DAT” is containing objects of class USER, which is defined as follows: class USER { int Uid; // User Id char Uname[20]; // User Name char Status; // User Type: A Active I Inactive public: void Register( ); // Function to enter the content void show( ); // Function to display all data members char Getstatus( ) { return Status; } }; 2009 3. (c) Given a binary file STUDENT.DAT, containing records of the following class Student type. class Student { char S_Admno[lO]; //Admission number of student char S_Name[30]; //Name of student 128 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj int Percentage; //Marks Percentage of student public: void EnterData() { gets(S_Admno); gets(S_Name); cin>>Percentage; } void DisplayData() { cout<<setw(12)<<S_Admno; cout<<setw(32)<<S_Name; cout<<setw(3)<<Percentage<<endl; } int ReturnPercentage() { return Percentage; } }; Write a function in C++, that would read contents of file STUDENT.DAT and display the details of those Students whose Percentage is above 75. 2005 4.(c) Given a binary file GAME.DAT, containing records of the following structure Type. struct Game { char GameName [20]; char Participant [10] [30]; }; Write a function in C++ that would read contents from the file GAME.DAT and creates a file named BASKET.DAT copying only those records from GAME.DAT where the game name is “Basket Ball” 2007 5.(c) Write a function in C++ to search and display the details of all flights, whose destination is “Mumbai” from “FLIGHT.DAT”. Assuming the binary file is containing objects of class. class FLIGHT { int Fno; //Flight Number char From[20] ; //Flight Starting point char To[20] ; //Flight Destination public : char* GetFrom( ) { return From ; } char* GetTo( ) { return To ; 129 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj } void Enter( ) { cin >> Fno ; gets (From) ; gets(To) ; } void Display( ) { cout << Fno<< “:” << From << “:” << To << endl ; } }; 2010 6.(c) Write a function in C++ to add new objects at the bottom of a binary file “STUDENT.DAT”, assuming the binary file is containing the objects of the following class. class STUD { int Rno; char Name[20]; public: void Enter() { cin>>Rno; gets(Name); } void Display() { cout<<Rno<<Name<<endl; } }; void Addnew() { fstream FIL; FIL.open(“STUDENT.DAT”,ios::binary|ios::app); STUD S; char CH; do { S.Enter(); FIL.write((char*)&S,sizeof(S)); cout<<”More(Y/N)?”; cin>>CH; } while(CH!=’Y’); FIL.close(); } SP1 7.(c) Write a function in C++ to search for a BookNo from a binary file “BOOK.DAT”, assuming the binary file is containing the objects of the following class. class BOOK { 130 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj int Bno; char Title[20]; public: int RBno() { return Bno; } void Enter() { cin>>Bno; gets(Title); } void Display() { cout<<Bno<<Title<<endl; } }; SP2 8.(c) Write a function in C++ to search for a BookNo from a binary file "BOOK.DAT", assuming the binary file is containing the objects of the following class. class { int Bno; char Title[20]; public: int RBno() {return Bno;} void Enter() {cin>>Bno;gets(Title);} void Display() {cout<<Bno<<Title<<endl;} }; SP3 131 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK Q.No. 5(a) 01. (a)What is a relation? What is the difference between a tuple and an attribute? 1998 02. (a) What is the need for normalization ? Define first, second and third normal forms. 1999 & 2000 03.(a) What are DDL and DML ? 2001 04. (a) What is relation ? Define the relational data model. 2002 05.(a) What do you understand by normalization ? What is First Normal Form? 2004 06.(a) What do you understand by the terms Primary Key and Degree of a relation in relational database? 2005 07.(a) Differentiate between primary key and alternate key. 2007 09.(a) What do you understand by Candidate Keys in a table ? Give a suitable example of Candidate keys from a table containing some meaningful data. 2009 & 2010 10.(a) What do you understand by Union & Cartesian Product operations in relational algebra? 2011 11.(a) Giv a suitable example of a tabl with sample data and illustrate Primery and Alternate Keys in it. 2012 12.(a) What do you understand by Degree and Cardinality of a table? S. P. 1 & 2 & 3 13. (a) What are DDL and DML Commands? Give one example of each. 2013 SP1&3 14. (a) What do you understand by the term alternate key and degree of a relation in a relational database? 2013 SP 2 15. (a) What do you understand by the terms Alternate key and Foreign Key of a relation? 2013 SP 4 132 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Q.No. 5 (B) 01. (b) Write SQL commands for (i) to (vii) and write the outputs for (vii) on the basis of table HOSPITAL. 1998 (i) To select all the information of patients of cardiology department. (ii) To list the names of female patients who are in ENT department. (iii) To list names of all patients with their date of admission in ascending order. (iv) To display patient's name, charges, age for only female patients. (v) To count the number of patient with Age < 30. (vi) To insert a new row in the HOSPITAL table with the following data: 11, "Aftab", 24, "Surgery". {25/02/98}, 300, "M" (vii) Give the output of following SQL statements: SELECT COUNT(DISTINCT charges) FROM hospital SELECT MIN(age) FROM hospital WHERE sex = "F" SELECT SUM(charges) FROM hospital WHERE department = "ENT": SELECT AVG(charges) FROM hospital WHERE dateofadm<{12/02/98} 02. (b) Write SQL commands for (i) to (vii) and write the output for (vii) on the basis of teacher relation given below: 1999 133 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) To show all information about the teacher of History department. (ii) To list the name of female teachers who are in Hindi department. (iii) To list the names of all the teachers with their date of joining in ascending order. (iv) To display Teachers Name, Salary, Age for male teachers only. (v) To count the number of teachers with age > 23. (vi) To insert a new row in the Teacher table with the following data. 9, “Raja”, 26, “Computer”, {13/05/95}, 2300, "M" (vii) Give the output of the following SQL statements : SELECT COUNT (DISTINCT department) FROM teacher; SELECT MAX(age) FROM teacher WHERE sex = "F"; SELECT AVG(salary) FROM teacher WHERE sex = "M"; SELECT SUM(salary) FROM teacher WHERE dateofjoin<{12,07/96}; 03. (b) Write SOL commands for (i) to (iv) and write the outputs for (v) on the basis of table CLUB. 2000 134 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) To show all information about the swimming coaches in the club. (ii) To list name of all coaches with their date of appointment (DATEOFAPP) in descending order. (iii) To display a report, showing coachname, pay, age and bonus (15% of pay) for all the coaches. (iv) To insert a new row in the CLUB table with the following data : 11, "PRAKASH", 37, "SQUASH", {25/02/98}, 2500, "M" (v) Give the output of following SQL statements : SELECT COUNT (DISTINCT sports) FROM club; SELECT MIN (age) FROM club WHERE sex = "F"; (iii)SELECT AVG(pay) FROM club WHERE sports ="KARATE"; SELECT SUM(pay) FROM club WHERE dateofapp > {31/01/98}; (vi) Assume that there is one more table COACHES in the database as shown below: What will be the output of the following query : SELECT sportsperson, coachname FROM club, coaches WHERE coach id = coach no; 04. (b) Write SQL commands for (i) to (vii) on the basis of the table STUDENT. 2001 135 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) Display the names of the students who are getting grade 'C' in either Game or SupW. (ii) Display the number of students getting grade 'A' in Cricket. (iii) Display the different games offered in the school. (iv) Display the SUPW taken up by the students, whose name starts with “A‟. (v) Add a new column named 'Marks'. (vi) Assign a value 200 for Marks for all those who are getting Grade 'B' or above in Game. (vii) Arrange the whole table in the alphabetical order of SUPW. 05.(b) Given the following Lab relations : 2002 Write SQL command for questions (i) to (vi). (i) To select the Itemname purchased after 31/10/97. (ii) To list the ItemName, which are within the Warranty period till present date. 136 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) To list the ItemName in ascending order of the date of purchase where quantity is more than 3. (iv) To display ItemName, CostPerltem and Quantity whose Warranty is over. (v) To count the number of items whose cost is more than 10000. (vi) To insert a new record in the Lab table with the following data : I 8. "VCR", 10000. 2. 2 2 2000 . 1, 2 (vii) Give the output of the following SQL command : SELECT MIN (DISTINCT quantity) FROM lab; SELECT MIN(warranty) FROM lab WHERE quantity = 2; SELECT SUM(costperitem) FROM lab WHERE quantity >2; SELECT AVG(csostperitem) FROM lab WHERE dateofpurchase<{l/199}; 06. (b) Given the following tables for a database LIBRARY. 2004 Write SQL command for questions (i) to (vi) (i) To show Book name, Author name and Price of books of EPB publishers (ii) To list the names of books of Fiction Type (iii) To display the names and price of the books in descending order of their price 137 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iv) To increase the price of all books of First Publ. by 50 (v) To display the Book_Id, Book_Name and Quantity_Issued for all books which have been issued. (The query will require contents from both the tables) (vi) To insert a new row in the table Issued having the following data : “F0002”, 4 (vii) Give the output of the following queries based on the above tables : SELECT COUNT(DISTINCT Publishers) FROM Books SELECT SUM(Price) FROM Books WHERE Quantity >5 SELECT Book_Name, Author_Name FROM Books WHERE Price<500 SELECT COUNT (*) FROM Books 07. (b) Consider the following tables EMPLOYEES and EMPSALARY. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). 2005 138 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) To display Firstname, Lastname, Address and City of all employees living in Paris from the table EMPLOYEES. (ii) To display the content of EMPLOYEES table in descending order of FIRSTNAME. (iii) To display the Firstname, Lastname, and Total Salary of all Managers from the tables EMPLOYEES and EMPSALARY, where Total Salary is calculated as Salary + Benefits. (iv) To display the Maximum salary among Managers and Clerks from the table EMPSALARY. (v) SELECT FIRSTNAME, SALARY FROM EMPLOYEES, EMPSALARY WHERE DESIGNATION = ‘Salesman’ AND EMPLOYEES.EMPID = EMPSALARY.EMPID; (vi) SELECT COUNT (DISTINCT DESIGNATION)FROM EMPSALARY; (vii) SELECT DESIGNATION, SUM(SALARY) FROM EMPSALARY GROUP BY DESIGNATION HAVING COUNT (*)>2; (viii) SELECT SUM (BENEFITS) FROM EMPLOYEES WHERE DESIGNATION = ’Clerk’; 139 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 08. (b) Consider the following tables. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii) 2007 (i) To display the names of all Senders from Mumbai. (ii) To display the RecID), SenderName, SenderAddress, RecName, RecAddress for every Recipient. (iii) To display Recipient details in ascending order of RecName. (iv) To display number of Recipients from each city. (v) SELECT DISTINCT SenderCity FROM Sender; (vi) SELECT A. SenderName, B.RecName FROM Sender A, Recipient B WHERE A. SenderlD = B.SenderlD AND B.RecCity = ‘Mumbai’; (vii) SELECT RecName, RecAddress FROM Recipient WHERE RecCity NOT IN (‘Mumbai’, ‘Kolkata’); (viii) SELECT RecID, RecName FROM Recipient WHERE SenderID=’MU02' ORSenderID=’ND50'; 140 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 09.(b) Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to (iv) and give outputs for (v) to (viii). 2009 (i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE (ii) To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and 16-JUN-08 (inclusive of both the dates). (iii) To display the average PRICE of all the GARMENTs, which are made up of FABRIC with FCODE as F03. (iv) To display FABRICwise highest and lowest price of GARMENTs from GARMENT table. (Display FCODE of each GARMENT along with highest and lowest price). (v) SELECT SUM(PRICE) FROM GARMENT WHERE FCODE=‟F01‟; 141 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (vi) SELECT DESCRIPTION, TYPE FROM GARMENT, FABRIC WHERE GARMENT.FCODE =FABRIC.FCODE AND GARMENT.PRICE > = 1260; (vii) SELECT MAX(FCODE) FROM FABRIC; (viii) SELECT COUNT (DISTINCT PRICE) FROM GARMENT; 10.(b) Consider the following tables. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). 2010 Write SQL commands for the following statements : (i) To display details of all the items in the Store table in ascending order of LastBuy. (ii) To display ItemNo and Item name of those items from Store table Whose Rate is more than 15 Rupees. (iii)To display the details of those items whose Suppliers code (Scode) is 22 or Quantity in Store (Qty) is more than 110 from the table Store. (iv) To display Minimum Rate of items for each Supplier individually as per Scode from the table Store. Give the output of the following SQL queries: 142 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) SELECT COUNT (DISTINCT Scode) FROM Store; (ii) SELECT Rate*Qty FROM Store WHERE ItemNO = 2004; (iii)SELECT Item, Sname FROM Store S, Suppliers P WHERE S.Scode = P.Scode AND Item No = 2006 ; (iv) SELECT MAX (LastBuy) FROM Store ; 11.(b)Consider the following tables WORKER and PAYLEVEL and answer the given questions. 2011 Write SQL commands for the following statements: (i) To display the details of all WORKERs, descending order of DOB. (ii) To display NAME and DESIG of those WORKERs whose PLEVEL is either P001 or P002. (iii)To display the content of all the WORKERs table, whose DOB is in between „19-JAN-1984‟ and 18-JAN-1987‟. (iv) To add a new row with the following : 19, „Days Kishore‟, „Operator‟, „P003‟. „19-Jun-2008‟, „11-Jul-1984‟ Give the output of the following SQL queries : (i) SELECT COUNT (PLEVEL), PLEVEL FROM WORKER GROUP BY PLEVEL; (ii) SELECT MAX(DOB), MIN(DOJ) FROM WORKER; (iii) SELECT Name, Pay FROM WORKER W, PAYLEVEL P WHERE W.PLEVEL = S.PLEVEL AND P.ECODE<13; (iv) SELECT PLEVEL, PAY+ALLOWANCE FROM PAYLEVEL WHERE PLEVEL = „P003‟; 143 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 12.(b) Consider the following tables CARDEN and CUSTOMER and answer the questions. 2012 144 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 13. (b) Consider the following tables GAMES and PLAYER. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). S.P. 1 (i) To display the name of all Games with their Gcodes 145 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (ii) To display details of those games which are having PrizeMoney more than 7000. (iii) To display the content of the GAMES table in ascending order of ScheduleDate. (iv) To display sum of PrizeMoney for each of the Number of participation groupings (as shown in column Number 2 or 4) (v) SELECT COUNT(DISTINCT Number) FROM GAMES; (vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM GAMES; (vii) SELECT SUM(PrizeMoney) FROM GAMES; (viii) SELECT DISTINCT Gcode FROM PLAYER; 14. (b) Consider the following tables ACTIVITY and COACH. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii) SP2 (i) To display the name of all activities with their Acodes in descending order. (ii) To display sum of PrizeMoney for each of the Number of participants groupings (as shown in column ParticipantsNum 10,12,16) (iii) To display the coach’s name and ACodes in ascending order of ACode from the table COACH (iv) To display the content of the GAMES table whose ScheduleDate earliar than 01/01/2004 in ascending order of ParticipantNum. (v) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY; (vi)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY; 146 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (vii) SELECT SUM(PrizeMoney) FROM ACTIVITY; (viii) SELECT DISTINCT ParticipantNum FROM COACH; 15. (b) Consider the following tables ACTIVITY and COACH and answer the questions: SP3 Write SQL commands for the flowing statements: (i) To display the names of all activities with their Acodes in descending order. (ii) To display sum of PrizeMoney for the Activities played in each of the Stadium separately. (iii) To display the coach's name and ACodes in ascending order of ACode from the table COACH (iv) To display the content of the Activity table whose ScheduleDate earlier than 01/01/2004 in ascending order of ParticipantsNum. Give the output of the following SQL queries: (i) SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY; (ii) SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY; (iii) SELECT Name,ActivityName FROM ACTIVITY A,COACH C 147 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj WHERE A.Acode=C.Acode AND A.ParticipantsNum=10; (iv) SELECT DISTINCT Acode FROM COACH; 16. (b) Consider the following tables Stationary and Consumer. Write SQL commands for the statement (i) to (iv). 2013 S. P. 1 (i) To display the details of those consumers whose Address is Delhi. (ii) To display the details of Stationary whose Price is in the range of 8 to 15. (Both Value included) (iii) To display the ConsumerName, Address from Table Consumer, and Company and Price from table Stationary, with their corresponding matching S_ID. (iv) To increase the Price of all stationary by 2. Write the output for SQL queries (v) to (viii): (v) SELECT DISTINCT Address FROM Consumer; (vi) SELECT Company, MAX(Price), MIN(Price), COUNT(*) from Stationary GROUP BY Company; 148 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (vii) SELECT Consumer.ConsumerName, Stationary.StationaryName, Stationary.Price FROM Strionary, Consumer WHERE Consumer.S_ID=Stationary.S_ID; (viii) Select StationaryName, Price*3 From Stationary; 17. (b) Consider the following tables EMPLOYEES and EMPSALARY. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). 2013 S.P. 2 (i) To display Firstname, Lastname, address and city of all employees leaving in Paris from the table EMPLOYEES. (ii) To display the content of EMPLOYEES table in descending order of Firstname. (iii) To display the Firstname , Lastname, and total salary of all Managers from the tablesEMPLOYEES and EMPSALARY, where total salary is calculated as SALARY + BENEFITS (iv) To display the maximum salary among Managers and Clerks from the table EMPSALARY. 149 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (v) SELECT FIRTNAME,SALARY FROM EMPLOYEES, EMPSALARY WHERE DESIGNATION ='Salesman' AND EMPLOYEES.EMPID = EMPSALARY.EMPID; (vi) SELECT COUNT(DISTINCT DESIGNATION) FROM EMPSALARY; (vii) SELECT DESIGNATION,SUM(SALARY) FROM EMPSALARY GROUP BY DESIGNATION HAVING COUNT(*)>2; (viii) SELECT SUM(BENEFITS) FROM EMPLOYEES WHERE DESIGNATION = 'Clerk'; 18. (b)Consider the following table Organisation and Grossincome and answer (I) and (II) part of the question: 2013 S.P. 3 (I) Write SQL commands for the following statements: (i) To display the details of all MEMBERS OF ORGANISATION in descending order of DOJ. (ii) To display NAME and POST of those MEMBERS whose SGRADE is either D002 or D003. (iii) To display the content of all the ORGANISATION table, whose DOJ is in between 09-Feb-2006 and 08-Aug-2009. (iv) To add a new row with the following 2007, ‘RUDRA’, ‘SALES INCHARGE’, ‘D002’,’26-Sep-2011’, ’26-Sept-1983’ (II) Give the output of the following SQL queries : (i) SELECT COUNT(SGRADE), SGRADE FROM ORGANISATION GROUP BY SGRADE; 150 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (ii) SELECT MIN(DOB), MAX(DOJ) FROM ORGANISATION; (iii) SELECT NAME,SALARY FROM ORGANISATION O, GROSSINCOME G WHERE O.SGRADE=G.SGRADE AND O.ECODE<2003; (iv) SELECT SGRADE, SALARY+HRA FROM GROSSINCOME WHERE SGRADE=’D002’ 19. (b)Consider the following tables SCHOOL and ADMIN. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii). 2013 S.P. 4 (i) To display TEACHERNAME, PERIODS of all teachers whose periods less than 25. (ii) To display TEACHERNAME, CODE and DESIGNATION from tables SCHOOL and ADMIN whose gender is male. (iii) To display number of teachers in each subject wise. (iv) To display CODE, TEACHERNAME and SUBJECT of all teachers who have joined the school after 01/01/1999. (v) SELECT MAX (EXPERIENCE), SUBJECT FROM SCHOOL GROUP BY SUBJECT; 151 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (vi) SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN WHERE DESIGNATION = ‘COORDINATOR’ AND SCHOOL.CODE=ADMIN.CODE; (vii) SELECT DESIGNATION, COUNT (*) FROM ADMIN GROUP BY DESIGNATION HAVING COUNT (*) <2; (viii) SELECT COUNT (DISTINCT SUBJECT) FROM SCHOOL; 152 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK QNO 6(A) 01.(a)State DeMorgan's Law. Verify one of the Demorgan’s Laws using truth tables. 1998 02.(a)State the distribute law. Verify the law using truth table. 1999 03.(a) State Absorption Laws. Verify one of the Absorption Laws using truth tables. 2000 04.(a) State and verify Involution law. 2001 05.(a) State the associative law and verify the law using truth table. 2002 06.(a) State and prove the absorption law algebraically. 2004 07.(a) State and verify Associative law in Boolean Algebra. 2005 08.(a) State Distributive law and verify the same using truth table. 2007 09.(a) Verify X‟Y + X.Y‟ + X‟.Y‟ = (X‟+Y‟) using truth table. 2009 10.(a) Verify the following algebraically. 2010 (A’+B’).(A+B) = A’.B’+A.B’ 11.(a) Verify the following using Truth Table. 2011 U.(U‟ + V) = (U+V) 12.(a) Verify the following using Truth Table. 2012 (i) X.X’ = 0 (ii) X+1 = 1 153 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 13.(a) State and algebraically verify Absorbtion Laws. SP 1 14.(a) State and verify Demorgan’s Laws. S.P.2 15.(a) State and verify Demorgan's Laws algebraically. S.P.3 16. (a) Verify the following algebraically. 2013 SP 1 (A’+B’).(A+B)=A’.B+A.B’ 17. (a)Verify the law using truth table X+(Y+Z) = (X+Y)+Z 2013 SP 2 18. (a) State and Verify Distributive Law. Verify using Truth Table. 2013 SP 3 19. (a) Verify X’.Y+X.Y’=(X’+Y’).(X+Y) algebraically. 2013 SP 4 QNO 6(B) 01. (b) Prove X'Y + Z = (X' + Y' + Z)(X’ +Y+Z)(X+Y + Z) algebraically. 1998 02. (b) Prove: X + X'Y = X + Y algebraically. 1999 03. (b) Prove: X'.Y+Y’.Z = X'.Y.Z + X'.Y’.Z’ + X.Y’.Z + X'.Y'.Z algebraically. 2000 04. (b) Prove algebraically: X.Y + X‟.Z +Y.Z = X.Y + X‟.Z 2001 05. (b) Prove: XY+ YZ + YZ' = Y 2002 06. (b) Given the following truth table, derive a sum of product (SOP) and Product of Sum (POS) form of Boolean expression from it : 2004 A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F(A,B,C) 1 1 0 1 0 1 1 0 154 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 07. (b) Write the equivalent Boolean expression for the following Logic Circuit : 2005 08. (b) Write the equivalent Canonical Sum of Product expression for the following Product of Sum Expression. 2007 F(X,Y,Z) = (1,3,6,7) 09. (b) Write the equivalent Boolean Expression for the following Logic Circuit: 2009 10. (b) Write the equivalent Boolean Expression for the following Logic circuit : 2010 155 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 11. (b) Write the equivalent Boolean Expression for the following Logic Circuit. 2011 12. (b) Write the equivalent Boolean Expression for the following Logic Circuit. 2012 13. (b) Write the equivalent Boolean Expression for the following Logic Circuit. SP 1 14. (b) Write the equivalent Boolean Expression for the following Logic Circuit. SP 2 156 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 15. (b) Write the equivalent Boolean Expression for the following Logic Circuit. SP 3 16. (b) Draw a logical Circuit Diagram for the following Boolean Expression: A.(B+C’) 2013 SP 1 17. (b)Draw the logic circuit for F=AB' + CD' 2013 SP 2 18. (b) Represent the Boolean expression YZ+XZ with the help of NAND gates only. 2013 SP 3 19. (b) Convert the following Boolean expression into its equivalent Canonical Product of Sum form: 2013 SP 4 X.Y’.Z+X’.Y.Z+X’.Y.Z’ QNO 6(C) 01.(c) Write the dual of the Boolean expression (U+ W) (V'U + W) 1998 02.(c) Write the dual of the Boolean expression (x+y).(x'+y') 1999 03.(c) Obtain simplified form for a Boolean expression using Karnaugh Map. 2000 F (x,y,z,w) = Σ(1,3, 4, 5, 7, 9,11, 12, 13, 15). 04.(c) If F(a, b, c, d) = Σ(0, 2, 4, 5, 7, 8, 10, 12, 13, 15), obtain the simplified form using K-Map. 2001 05.(c) Obtain the simplified form of a Boolean expression using Karnaugh map. 2002 F(x,y,z) = Σ (2, 3, 6, 7) 157 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 06.(c) Obtain a simplified form for the following Boolean Expression using Karnaugh’s Map : 2004 F(a, b, c, d) = Σ (0, 1, 2, 4, 5, 7, 8, 9, 10, 11, 14) 07.(c) Write the SOP form of a Boolean Function F, which is represented by the following truth table: 2005 A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F 1 0 0 1 0 0 1 1 08.(c) Write the equivalent Boolean Expression for the following Logic Circuit. 2007 09.(c) Write the POS form of a Boolean Function H, which represented in a truth table as follows: 2009 A 0 0 0 0 1 B 0 0 1 1 0 C 0 1 0 1 0 H 0 1 1 1 1 158 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 1 1 1 0 1 1 1 0 1 0 0 1 10.(c) Write the POS form of Boolean function H, which is represented in a truth table as follows : 2010 X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1 H 1 0 1 1 1 0 0 1 159 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 11.(c) Write the POS form of a Boolean function F, which is represented in a truth table as follows: 2011 A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F 0 1 1 0 1 0 0 1 12. (c) Write the POS form of a Boolean function F, which is represented in a truth table as follows: 2012 A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F 1 0 1 0 1 0 0 1 13.(c) Write the SOP form of a Boolean function G, which is represented in a truth table as follows: SP 1 P 0 0 0 0 1 1 1 1 Q 0 0 1 1 0 0 1 1 R 0 1 0 1 0 1 0 1 G 0 0 1 0 1 0 1 1 160 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 14.(c) Write the POS form of a Boolean function F, which is represented in a truth table as follows: SP 2 & 3 U 0 0 0 0 1 1 1 1 V 0 0 1 1 0 0 1 1 W 0 1 0 1 0 1 0 1 F 1 0 1 0 1 0 1 1 15. (c) Write the equivalent Canonical Sum of Product for the following Product of Sum Expression: F(X,Y,Z)= (1,3,6,7) 2013 SP 1 16. (c) Derive the POS form of Boolean expression from the given truth table. 2013 SP 2 A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F(A B C) 1 1 0 1 0 1 1 0 17. (c)Obtain simplified form for a Boolean expression F(x,y,z,w) = Σ(1,3,4,5,7,9,11,12,13,15) using K Map 2013 SP 3 161 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 18. (c)Write the equivalent Boolean Expression F for the following: 2013 SP 4 circuit diagram : QNO 6 (D) 1.(d) Obtain a simplified form for a Boolean expression using K-Map. F(u,v,w,z) = Σ(0,1, 3, 5, 7, 9,10,11,12, 13,15) 1998 2.(d) Minimize F(w,x,y,z) Karnaugh map. F(w, x, y, z) =Σ(0, 4, 8, 12) 1999 3. (d) Draw the logic circuit for a half adder. 2000 4. (d) Represent NOT using only NOR gate(s). 2001 5. (d) Draw a logic circuit of full Adder. 2002 6. (d) Draw the logic circuit for a Half Adder using NAND gates only. 2004 7. (d) Reduce the following Boolean expression using K - Map: F(A, B, C, D) = (O, 1, 2, 3, 4, 5, 10, 11, 15) 2005 8. (d) Reduce the following Boolean expression using K-Map: F(U,V,W,Z) = Σ (0, 1, 2, 3, 4, 10, 11) 2007 9. (d) Reduce the following Boolean Expression using K-Map: F(P, Q, R, S) = Σ (1, 2, 3, 5, 6, 7, 9, 11, 12, 13, 15) 2009 162 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 10. (d) Reduce the following Boolean expression using K-map: 2010 F(U,V,W,Z)= (3,5,7,10,11,13,15,) 11. (d) Reduce the following Boolean Expression using K-Map : F(P, Q, R, S) = Σ (0, 1, 2, 4, 5, 6, 8, 12) 2011 12. (d) Reduce the following Boolean Expression using K-Map : F(A,B,C,D)= Σ (2,3,4,5,6,7,8,10,11) 2012 13. (d) Reduce the following Boolean Expression using K-Map: F(U,V,W,Z)= (0,1,2,4,5,6,8,10) SP 1 14.(d) Reduce the following Boolean Expression using K-Map: F(A,B,C,D)= Σ (0,1,2,4,5,6,8,10) SP 2 15.(d) Reduce the following Boolean Expression using K-Map: F(A,B,C,D)= (0,1,2,4,5,6,8,10) SP 3 16. (d) If F (X, Y, Z, W) = Σ (1,3,4,5,7,9,10,11,13,15 ) obtain the simplified form using K-Map. 2013 SP 1 17. (d) Reduce the following Boolean expression using K map F(M,N,O,P)= _(0,1,3,4,5,6,7,9,10,11,13,15) 2013 SP 2 163 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj CBSE PREVIOUS YEAR QUESTION BANK Q.No. 7 (a) 1.(a) What are repeaters? 2.(a) What is a bridge? 1998 1999 3.(a) What are Routers ? 2000 4.(a) What are Routers? 2001 5.(a) Compare coaxial and optical fiber cable. 2002 6.(a) Write two advantages and two disadvantages for STAR topology. 2004 7.(a) What is the difference between Message Switching technique and Packet Switching technique? 2005 8.(a) What is the significance of Cyber law ? 2007 9.(a) What is the difference between STAR topology and BUS topology of network? 2009 10.(a) What was the role of ARPANET in Computer Network ? 2010 11.(a) Differentiate between packet switching and message switching technique in network communication. 2011 12.(a) What out of following , will yu use to have an audio-visual chat with an expert sitting in a far away place to fix-upa technical issue? 2012 (i) VoIP (ii)email (iii)FTP 13.(a) Define the term Bandwidth. Give unit of Bandwidth. 14.(a) What is the significance of ARPANET in the network? 15.(a) Compare any two Switching techniques. SP 1 SP 2 SP 3 Q.No. 7 (b) 164 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (b) What is the difference between LAN and MAN? (b) What is the purpose of using FTP? 1998 1999 (b) What is the purpose of using a MODEM ? 2000 (b) What do you understand by a backbone network? (b) Write the following abbreviations in their full form : (i) LAN, (ii)OSI 2001 2002 (b) Write one difference between coaxial and optical cable. 2004 (b) Expand the following terminologies : (i) TCP/IP (ii) XML (iii) CDMA (iv) WLL 2005 (b) Expand the following terms with respect to Networking : (i) CDMA (ii) FTP (iii) WLL (iv) HTML (b) Expand the following abbreviations: (i) GSM (ii) CDMA 2007 2009 (b) Which of the following is not a unit for data transfer rate ? (i) bps (ii) abps (iii) gbps (iv) kbps 2010 (b) Differentiate between BUS and STAR topology of networks. 2011 b) Expand the following terminologies: (i) HTML (ii) XML SP 1 (b) Expand the following terminologies: (i) CDMA (ii) GSM SP 2 (b) Which of the following is not a Client Side script: (i) VB Script (ii) Java Script (iii) ASP (iv) PHP SP 3 Q.No. 7 (c) 2 Marks Question (c) Describe the following in brief: (i)MOSAIC (ii) Usenet 1998 165 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (c) Give two advantages and two disadvantages of the following network topologiesBus and Tree. 1999 (c) Write the two advantages and two disadvantages of Bus Topology in network. 2000 (c) Name two switching circuits and explain any one. (c) What is the purpose of Telnet? 2001 2002 (c) Explain the following terms in short : (i) FTP (ii) URL (c) Write two application of Cyber Law. 2004 2005 (c) Write one advantage of STAR topology as compared toTBUS topology. 2006 (c) Differentiate between Hackers and Crackers. 2006 1 1 (c) Which of the following unit measures the speed with which data can be transmitted from one node to another node of a network? Also, give the expansion of the suggested unit. 2007 (i) Mbps (ii) KMph (iii) MGps (c) What is protocol? Which protocol is used to search information from Internet using the Internet Browser? 2009 (c) What is the difference between Trojan Horse and Virus in terms of computers? 2010 (c) What is VoIP ? 2011 (c) Define the term firewall. SP 1 (c) Give two major reasons to have network security. SP 2 (c) If someone has hacked your Website, to whom you lodge the Complain? SP 3 Q.No. 7 (d) d) What do you understand by a backbone network? (d) What is the difference between WAN and MAN? 1998 1999 166 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (d) What is the difference between LAN and WAN ? 2000 (d) Mention one difference between Circular and Star Topologies in networking. 2001 (d) Briefly mention two advantages and disadvantages of Ring topology in network. 2002 (d) Define Packet Switching. 2004, D 2005,D 2007 (d) Name two switching techniques used to transfer data between two terminals (computers). 2009 (d) What term we use for a software/hardware device, which is used to block, unauthorized access while permitting authorized communications. This term is also used for a device or set of devices configured to permit, deny, encrypt, or proxy all (in and out)computer traffic between different security domains based upon a set of rules and other criteria. 2010 (d) Out of the following, identify client side script(s) and server side script(s). (a) ASP (b) Javascript (c) VBscript (d) JSP (d) What is the importance of URL in networking? 2011 SP 1 (d) What is the purpose of using a Web Browser? Name any one commonly used Web Browser. SP 2 (d) What do you mean by IP Address? How is it useful in Computer Security? SP 3 167 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Q.No. 7(d or e) 1 (d) The Great Brain Organisation has set up its new Branch at Srinagar for its office and web based activities. It has 4 Wings of buildings as shown in the diagram : 2005 (i) Suggest a most suitable cable layout of connections between the Wings, and topology. 1 (ii) Suggest the most suitable place (i.e. Wing) to house the server of this organisation with a suitable reason, with justification. 1 (iii) Suggest the placement of the following devices with justification: 1 (1) Repeater (2) Hub/Switch (iv) The organization is planning to link its head office situated in Delhi with the offices at Srinagar. Suggest an economic way to connect it; the company is ready to compromise on the speed of connectivity. Justify your answer. 1 168 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7(e) 2006 (d) UNIVERSITY OF CORRESPONDENCE in Allahabad is setting up the network between its different wings. There.are 4 wings named as Science (S), Journalism (J), ARTS (A) and Home Science(H). 169 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (e) 4 Marks 2006 (d) INDIAN PUBLIC SCHOOL in Darjeeling is setting up the network between its different wings. There are 4 wings named as SENIOR(S), JUNIOR(J), ADMIN(A) and HOSTELCH). 170 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (e) 4 Marks 2007 (d) “Hindustan Connecting World Association” is planning to start their offices in four major cities in India to provide regional IT infrastructure support in the field of Education & Culture. The company has planned to set up their head office in New Delhi in three locations and have named their New Delhi offices as “Sales Office”, ”Head Office” and “Tech Office”. The company’s regional offices are located at ”Coimbatore”, “Kolkata” and “Ahmedabad”. A rough layout of the same is as follows (i) Suggest network type (out of LAN, MAN, WAN) for connecting each of the following set of their offices : • Head Office and Tech Office • Head Office and Coimbatore Office (ii) Which device will you suggest to be procured by the company for connecting all the computers within each of, their offices out of the following devices ? • Modem • Telephone • Switch/Hub (iii) Which of the following communication media, will you suggest to be procured by the company for connecting their local offices in New Delhi for very effective and fast communication ? 171 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj • Ethernet Cable • Optical Fiber • Telephone Cable (iv) Suggest a cable/wiring layout for connecting the company’s local offices located in New Delhi. Also,, suggest an effective method/technology for connecting the company’s regional offices at “Kolkata”, “Coimbatore” and “Ahmedabad”. 4 172 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (e) 4 Marks 2007 2 (d) “Bhartiya Connectivity Association” is planning to spread their offices in four major cities in India to provide regional IT infrastructure support in the field of Education & Culture. The company has planned to setup their head office in New Delhi in three locations and have named their New Delhi offices as “Front Office”, “Back Office” and “Work Office”. The company has three more regional offices as “South Office”, “East Office” and “West Office” located in other three major cities of India. A rough layout of the same is as follows : (2006) 4 (i) Suggest network type (out of LAN, MAN, WAN) for connecting each of the following set of their offices : • Back Office and Work Office • Back Office and South Office (ii) Which device you will suggest to be procured by the company for connecting all the computers with in each of their offices out of the following devices? • Switch/Hub • Modem • Telephone 173 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (iii) Which of the following communication medium, you will suggest to be procured by the company for connecting their local offices in New Delhi for very effective and fast communication? • Telephone Cable • Optical Fiber • Ethernet Cable (iv) Suggest a cable/wiring layout for connecting the company’s local offices located in New Delhi. Also, suggest an effective method/technology for connecting the company’s regional offices-”East Office”, “West Office” and “South Office” with offices located in New Delhi. Qno 7 (e) 4 Marks 2008 (d) “Bias Methodologies” is planning to expand their network in India, starting with three cities in India to build infrastructure for research and development of their chemical products. The company has planned to setup their main office in Pondicherry - at three different locations and have named their offices as “Back Office”, “Research Lab” and “Development Unit”. The company has one more Research office namely “Corporate Office” in “Mumbai”. A rough layout of the same is as follows : (i) Suggest the kind of network required (out of LAN, MAN, WAN) for connecting each of the following office units: _ Research _ Research Lab and Back Office Lab and Development Unit (ii) Which one of the following device will you suggest for connecting all the computers with in each of their office units? 174 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj _ Switch/Hub _ Modem _ Telephone (iii) Which of the following communication medium, you will suggest to be procured by the company for connecting their local office units in Pondicherry for very effective (High Speed) communication? _ Telephone Cable _ Optical Fiber _ Ethernet Cable (iv) Suggest a cable/wiring layout for connecting the company’s local office units located in Pondicherry. Also, suggest an effective method/technology for connecting the company’s office unit located in Mumbai. Qno 7 (e) 4 Marks 2008 (d) “China Middleton Fashion’” is planning to expand their network in India, starting with two cities in India to provide infrastructure for distribution of their product. The company has planned to set up their main office units in Chennai at three different locations and have named their offices as “Production Unit”, “Finance Unit” and “Media Unit”. The company has its corporate unit in Delhi. A rough layout of the same is as follows: 175 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) Suggest the kind of network required (out of LAN, MAN, WAN) for connecting each of the following office units: _ Production _ Production Unit and Media Unit Unit and Finance Unit (ii) Which one of the following devices will you suggest for connecting all the computers within each of their office units? _ Switch/Hub _ Modem _ Telephone (iii) Which of the following communication media, will you suggest to be procured by the company for connecting their local office units in Chennai for very effective (High Speed) communication? _ Telephone Cable Fiber _ Ethernet Cable _ Optical (iv) Suggest a cable/wiring layout for connecting the company’s local office units located in Chennai. Also, suggest an effective method/technology for connecting the company’s office unit located in Delhi. 4 Qno 7 (e) 4 Marks 2009 (e) Freshminds University of India is starting its first campus in Ana Nagar of South India with its center admission office in Kolkata. The university has 3 major blocks comprising of Office Block, Science Block and Commerce Block in the 5 KM area Campus. As a network expert, you need to suggest the network plan as per (El) to (E4) to the authorities keeping in mind the distance and other given parameters. 176 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (E1) Suggest the authorities, the cable layout amongst various blocks inside university campus for connecting the blocks. 1 (E2) Suggest the most suitable place (i.e. block) to house the server of this university with a suitable reason. 1 (E3) Suggest an efficient device from the following to be installed in each of the blocks to connect all the computers: 1 (i) MODEM (ii) SWITCH (iii) GATEWAY (E4) Suggest the most suitable. (very high speed) service to provide data connectivity between Admission Office located in Kolkata and the campus located in Ana Nagar from the following options: 1 _ Telephone line Dial-up connection _ Co-axial Cable Network _ GSM _ Leased line _ Satellite Connection _ Fixed-Line Qno 7 (e) 4 Marks 2009 (e) Eduminds University of India .is starting its first campus in a small town Parampur of Central India with its center admission office in Delhi. The university has 3 major buildings comprising of Admin Building, Academic Building and Research Building in the 5 KM area Campus. As a network expert, you need to suggest the network plan as per (E1) to (E4) to the authorities keeping in mind the distances and other given parameters. 177 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (E1) Suggest to the authorities, the cable layout amongst various buildings inside the university campus for connecting the buildings. 1 (E2) Suggest the most suitable place (i.e. building) to house the server of this organisation, with a suitable reason. 1 (E3) Suggest an efficient device from the following to be installed in each of the buildings to connect all the computers : 1 (i) GATEWAY (ii) MODEM (iii) SWITCH (E4) Suggest the most suitable (very high speed) service to provide data connectivity between Admission Building located in Delhi and the campus located in Parampur from the following options: 1 _ Telephone line Dial-up connection _ Co-axial Cable Network _ GSM _ Leased line _ Satellite Connection _ Fixed-Line Qno 7 (e) 4 Marks 2010 (e) “Learn Together” is an educational NGO. It is setting up its new campus at Jabalpur for its webbased activities. The campus has 4 compounds as shown in the diagram below: 178 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (e1) Suggest a cable layout of connections between the compounds. (e2) Suggest the most suitable place (i.e. compound) to house the server for this NGO. Also, provide a suitable reason for your suggestion. (e3) Suggest the placement of the following devices with justification : (i) Repeater (ii) Hub/Switch (e4) The NGO is planning to connect its International office situated in Mumbai, which out of the following wired communication link, you will suggest for a very high speed connectivity? (i) Telephone Analog Line (ii) Optical Fiber (iii) Ethernet Cable 179 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (e) 4 Marks 2010 (e) “Vidya for All” is an educational NGO. It is setting up its new campus at Jaipur for its web-based activities. The campus has four buildings as shown in the diagram below: 4 (el) Suggest a cable layout of connections between the buildings. (e2) Suggest the most suitable place (i.e. building) to house the server for this NGO. Also, provide a suitable reason for your suggestion. (e3) Suggest the placement of the following devices with justification: (i) Repeater (ii) Hub/Switch (e4) The NGO is planning to connect its International office situated in Delhi. Which out of the following wired communication links, will you suggest for a very high speed connectivity ? (i) Telephone Analog Line (ii) Optical Fiber (iii) Ethernet Cable Qno 7 (e) 4 Marks 2011 (e) Quick learn University is setting up its Academic blocks at Prayag Nagar and planning to set up a network. The university has 3 academic blocks and one Human Resource Center as shown in the diagram below. 4 180 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (e1 ) Suggest the most suitable place (i.e. Block/Center) to install the server of this university with a suitable reason. (e2) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity. (e3) Which device you will suggest to be placed/installed in each of these blocks/center to efficiently connect all the computers with in these blocks/center. (e4) The university is planning to connect its admission office in the closest big city, which is more than 250 km from university, which type of network out of LAN, MAN or WAN will be formed? Justify your answer. Qno 7 (e) 4 Marks 2011 (e) Great Studies University is setting up its Academic schools at Sunder Nagar and planning to set up a network. The university has 3 academic schools and one administration center as shown in the diagram below: 4 181 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj (i) Suggest the most suitable place (i.e. School/Center) to install the server of this university with a suitable reason. (ii) Suggest an ideal layout for connecting these schools/ center for a wired connectivity. (iii) Which device will you suggest to be placed/installed in each of these schools / center to efficiently connect all the computers within these schools / center? (iv) The university is planning to connect its admission office in the closest big city, which is more than 350 km from the university. Which type of network out of LAN, MAN or WAN will be formed? Justify your answer. 182 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (e) 4 Marks 2012 Qno 7 (e) 4 Marks Sample Paper 1 183 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj 184 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (e) 4 Marks Sample Paper 2 185 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 (f) 1 Mark (f) Give suitable example of URL and Domain Name 2012 1 (g) Name proprietary software along with their application 2012 1 (f) Compare freeware and Shareware SP 1 (g) How Trojan Horses are different from Worms? Mention any one difference. SP 1 f) What do you mean by Spam Mails? How can you protect your mailbox from Spams? SP2 1 g) Mention any two advantages of Open Source Software over Proprietary Software. SP2 1 (f) Compare Open Source Software and Proprietary Software. 2011 (g) What are cookies? 2011 1 1 (f) Which of the following will come under Cyber Crime? 2010 1 (i) Theft of a brand new sealed pack Laptop (ii) Access to a bank account for getting unauthorized Money Transaction (iii) Modification in a company data with unauthorized access (iv) Photocopying a printed report Ans. (ii) and (iii) (g) Compare open source software and proprietary software. 2010 1 (f) Write the full forms of the following: 2009 (f1) FTP (f2) FSF 1 (g) Name any two common Web browsers. 2009 (f) Write the full forms of the following: 2009 (f1) GNU (f2) XML Ans (f1) GNU’s not Unix 1 1 (f2) eXtensible Markup Language (g) Write one advantage of each for Open Source Software and Proprietary Software. 2009 1 186 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 2013 Paper 187 Collected By Praveen M Jigajinni & Manish Kumar Sainik School Gopalganj Qno 7 2013 Paper 188