Sie sind auf Seite 1von 37

Computer Science, Class XII, 2010-11 Chapter No.

1 (C++ Revision Tour)


1. Why main function is so special in C++. Give at least two reasons? /* CBSE 1999 */ 2. Differentiate between call by value & call by reference with a suitable example in C++. /*CBSE 2005, 2009, 2010 */ 3. What do you mean by actual parameter and formal parameter? Explain with an example?
/*CBSE 2009 */ 4. Differentiate between global & local variable with a suitable example in C++. /* CBSE 2003 */

5. 6. 7. 8.

Illustrate the use of #define in C++ to define a macro. /* CBSE 2006 */ What do you mean by compile time and run time error? Give one example of each? Difference between syntax and semantic error? Explain with an example? What do you understand by syntax error, logical error & run time error? Explain with example. /*CBSE 2007 */ 9. Differentiate between break and continue statements. 10. How is entry controlled loop different from exit controlled loop? Explain with one example of each? 11. What do you mean by scope and lifetime of a variable? 12. What is the purpose of using a typedef command in C++. Explain with suitable example. /* CBSE 2008 */ 13. What is the difference between a typedef name and a reference name in C++? Explain with suitable example. 14. Difference between i) structure & array ii) structure & class. 15. What is variable scope? What is the difference between Local and Global scope? Explain with an example. 16. What are Nested Structures? Give an example. /* CBSE 2006 */ 17. What is the difference between #define & const? Explain through example. /* CBSE 2008 */ 18. Name the Header file(s) that shall be needed for successful compilation of the following C++ code? i) void main() { char st[20]; gets(st); if(isaplha(st[0]) cout<<Starts with alphabet; else cout<<strlen(st); } ii) void main( ) /*CBSE 2008 */ { char String[ ] = Peace; cout << setw(2)<<String; } iii) void main( ) { char String[20]; gets(String); strcat(String,CBSE); puts(String); } /*CBSE 2007 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


19. Write the names of the header files to which the following functions belong. random( ), fabs( ), strcpy( ), gets( ), isupper(), tolower( ), isalnum( ), strcat( ), setw( ), abs( ), get( ), ceil( ), exit( ), floor( ), read( ), exp( ), open( ), puts( ), setprecision ( ), randomize( ), free( ), calloc( ), malloc( ), realloc( ), clrscr( ), strcmp( ), getc( ), scanf( ), getchar( ), printf( ), cos( ), gotoxy( ), getch( ), poly( ), sqrt( ), fseek( ), fopen( ), endl( ). 20. Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. i) #include<iostream.h> /* CBSE 2008 */ void main( ) { First = 10, Second = 20; Jumpto(First;Second); Jumpto(Second); } void Jumpto(int N1, int N2 = 20) { N1=N1+N2; count<<N1>>N2; } ii) #include<iostream.h> const int Max 10; void main() { int Numbers[Max]; Numbers = {20,50,10,30,40}; for(Loc=Max-1;Loc>=10;Loc--) cout>>Numbers[Loc]; } /* CBSE 2007 */

iii) #include<iostream.h> /* CBSE 2005 */ const int Multiple 3; void main( ) { Value = 15; for(int Counter = 1;Counter = <5;Counter ++, Value -= 2) if(Value%Multiple = = 0) cout<<Value * Multiple; cout<<end1; else cout<<Value + Multiple <<endl; } iv) #include<iostream.h> void main( ) { int P[ ]={90,10,24,15};Q,Number=4; Q=9; for[int I=Number-1;I>=0,I--] switch(I) /* CBSE 2003 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


{ case 0; case 3:cout>>P[I]*Q<<endl;break; case 1: case 2: cout<<P[I]+Q; } } v) #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); } vi) #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); } 21. Find the output of the following program: i) #include<iostream.h> #include<ctype.h> void main( ) { char Text[ ] = Mind@Work!; for(int I=0; Text[I]!=\0;I++) { if(!isalpha(Text[I])) Text[I]=*; else if(isupper(Text[I])) Text[I]=Text[I]+1; else Text[I] = Text[I+1]; } /* CBSE 2006 */

/* CBSE 2008 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


cout<<Text; } ii) #include<iostream.h> /* CBSE 2008 */ void main( ) { int U=10,V=20; for(int I=1;I<=2;I++) { cout<<[1]<<U++<<&<<V - 5 <<endl; cout<<[2]<<++V<<&<<U + 2 <<endl; } } iii) #include<iostream.h> /* CBSE 2007 */ void Withdef(int HisNum=30) { for(int I=20;I<=HisNum;I+=5) cout<<I<<,; cout<<endl; } void Control(int &MyNum) { MyNum+=10; Withdef(MyNum); } void main() { int YourNum=20; Control(YourNum); Withdef(); cout<<Number=<<YourNum<<endl; } iv) #include<iostream.h> /* CBSE 2005 */ #include<string.h> #include<ctype.h> void Convert(char Str[ ],int Len) { for(int Count=0;Count<Len;Count++) { if(isupper(Str[Count])) Str[Count]=tolower(Str[Count]); else if (islower(Str[Count])) Str[Count]=toupper(Str[Count]); else if(isdigit(Str[Count])) Str[Count]=Str[Count]+1; else Str[Count]=*; } } void main( ) { char Text[ ]=CBSE Exam 2005; int Size = strlen(Text); 4

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


Convert(Text,Size); cout<<Text<<endl; for(int C=0,R=Size - 1;C<=Size/2;C++,R--) { char Temp=Text[C]; Text[C]=Text[R]; Text[R]=Temp; } cout<<Text<<endl; } v) #include<iostream.h> void main( ) { int var1=5,var2=10; for(int i=1;i<=2;i++) { cout<<var1++<<\t<< -- var2<<endl; cout<<var2--<<\t<<++ var1<<endl; } } vi) #include<iostream.h> int Execute(int M) { if(M%3==0) return M*3; else return M+10; } void Output(int B=2) { for(int T=0;T<B;T++) cout<<Execute(T)<<*; cout<<endl; } void main( ) { Output(4); Output( ); Output(3); } vii) #include<iostream.h> #include<conio.h> int g=20; void func(int &x,int y) { x=x-y; y=x*10; cout<<x<<,<<y<<\n; } /* CBSE 2004 */

/* CBSE 2003 */

/* CBSE 2001 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


void main( ) { int g=7; func(g,::g); cout<<g<<,<<::g<<\n; func(::g,g); cout<<g<<,<<::g<<\n; } viii) #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; } ix) #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; } x) #include<iostream.h> struct MyBox { int Length,Breadth,Height; }; void Dimension(MyBox M) { cout<<M.Length<<x<<M.Breadth<<x; cout<<M.Height<<endl; } void main( ) { MyBox B1={10,15,5},B2,B3; ++B1.Height; Dimension(B1); B3=B1;

/* CBSE 2000 */

/* CBSE 1998 */

/* CBSE 2005 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


++B3.Length; B3.Breadth++; Dimension(B3); B2=B3; B2.Height+=5; B2.Length--; Dimension(B2); } xi) #include<iostream.h> /* CBSE 2003 */ struct Pixel { int C,R; }; void Display(Pixel P) { cout<<col<<P.C<<Row<<P.R<<endl; } void main( ) { Pixel X={40,50},Y,Z; Z=X; X.C+=10; Y=X; Y.R+=20; Z.C-=15; Display(X); Display(Y); Display(Z); } (xii) #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; } 22. In the following program, find the correct possible output(s) from the options: i) #include<stdlib.h> /* CBSE 2008 */ #include<iostream.h> void main( ) { randomize( ); char City[ ][10]={DEL,CHN,KOL,BOM,BNG}; int Fly; for(int I=0; I<3;I++)
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


{ Fly=random(2) + 1; cout<<City[Fly]<<:; } } Outputs: (i) DEL : CHN : KOL: (ii) CHN: KOL : CHN: (iii) KOL : BOM : BNG: (iv) KOL : CHN : KOL: ii) #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. iii) #include<stdlib.h> #include<iostream.h> void main( ) { randomize( ); int Score[ ] = {25,20,34,56,72,63},Myscore; Myscore = Marks [1+random(2)]; cout<<Myscore<<endl; } (i) 25 (ii) 34 (iii) 20 (iv) None of the above. iv) #include<stdlib.h> #include<iostream.h> void main( ) { randomize( ); int Num,Rndnum; cin>>Num; Rndnum = random(Num) + 5; for(int N = 1;N<=Rndnum;N++) cout<<N<<. .; } Output Options: (i) 1 2 3 4 (ii) 1 2 (iii) 1 2 3 4 5 6 7 8 9 (iv) 1 2 3 v) void main () { char serial[] = {'A', 'B', 'C', 'D'}; int number[] = { 2, 6, 7, 3}; clrscr(); randomize(); /* CBSE 2007 */

/* CBSE 2007 */

/* CBSE 2005 */

//If Num=5

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


cout << " The winner is : "; cout << serial [random(3)]; for (int i = 0; i < 4; i++) cout << number[sizeof(int) + random(2) - 1 ]; getch(); } Outputs: (i) The winner is : A2776 (ii) The winner is : D6766 (iii) The winner is : B6767 (iv) The winner is : C3672 23. 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? #include <iostream.h> #include <stdlib.h> void main() { int N,Guessme; randomize(); cin>>N; Guessme=random(N-3)+10; cout<<Guessme<<endl; }

Chapter No.2 (Object Oriented Programming)


1. Explain all the features or five basic concepts of OOPs (i.e. Data Abstraction, Encapsulation, Modularity, Inheritance and Polymorphism) with example. 2. While implementing encapsulation, abstraction is also implemented. Comment. 3. Encapsulation is one of the major properties of OOP? How is it implemented in C++? 4. Reusability of classes is one of the major properties of OOP. How is it implemented in C++? /* CBSE 2001 */ 5. Define the following terms: (i) Inheritance (ii) Encapsulation. /* CBSE 1998 */

Chapter No.3 (Function Overloading)


1. Illustrate the concept of function overloading with the help of an example. /*CBSE 2003, 2000*/

2. What do you understand Polymorphism? Give an example illustrating its use in a C++ program. /* CBSE 2004 */ 3. How does function overloading implement polymorphism?

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11 Chapter No.4 (Classes and Objects)
1. How does a class enforce data hiding, abstraction and encapsulation? 2. What is the significance of private, protected and public access specifiers in a class? 3. Differentiate between public and private visibility modes in context of Object Oriented Programming using a suitable example illustrating each. /* CBSE 2008*/ 4. Illustrate the use of inline function in C++ with help of an example. /* CBSE 2006 */ 5. What is the global class and local class? Explain with suitable example. 6. What is static data member and static member function? Give suitable example using C++ code to illustrate them. 7. What do you mean by static data members of a class? Explain the characteristics of a static data member. /* CBSE 2002 */ 8. Define the term Data Hiding in the context of Object Oriented Programming. Give a suitable example using a C++ code to illustrate the same. /*CBSE 2005,2010 */ 9. Define the term Data Encapsulation in the context of Object Oriented Programming. Give a suitable example using a C++ code to illustrate the same. /*CBSE 2005,2010 */ 10. Rewrite the following program after removing the syntactical errors (if any). Underline each correction. i) #include [iostream.h] class PAYITNOW { int Charge; PUBLIC: void Raise(){cin>>Charge;} void Show{cout<<Charge;} }; void main() { PAYITNOW P; P.Raise(); Show(); } ii) #include <iostream.h> /* CBSE 2010*/ 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(); }
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

10

Computer Science, Class XII, 2010-11


11. Define a class named ADMISSION in C++ with the following descriptions: Private Members: /* CBSE 2006 */ AD_NO integer(Ranges 10 to 2000) NAME Array of characters (String) CLASS Character FEES Float Public Members: Function Read_Data( ) to read an object of ADMISSION type. Function Display( ) to display the details of an object. Function Draw-Nos.( ) to choose 2 students randomly from an array of 100 objects of type ADMISSION passes as an argument to the function and display the details. Use random function to generate admission nos. to match with AD_NO from the array. 12. Define a class Teacher with the following class specification. /*CBSE1999*/ Private members: Name 20 characters Subject 10 characters Basic, DA, HRA, Salary float Calculate( ) function computes the salary and returns it. Salary is sum of Basic, DA and HRA Public members: ReadData( ): Function accepts the data values and invoke the calculate function. DisplayData( ):Function prints the data on the screen. 13. Define a class TEST in C++ with following description: 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. 14. 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 Distance Fuel <=1000 500 more than 1000 and <=2000 1100 more than 2000 2200
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

11

Computer Science, Class XII, 2010-11


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 15. Define a class BALANCED_MEAL in C++ with following description: Private Members: Access number Integer Name of Food String of 25 characters Calories Integer Food type String Cost Float AssignAccess( ) Generates random numbers between 0 to 99 and return it. Public Members A function INTAKE( ) to allow the user to enter the values of Name of Food, Calories, Food type, cost and call function AssignAccess() to assign Access number. A function OUTPUT( ) to allow user to view the content of all the data members, if the Food type is fruit.

Chapter No.5 (Constructors and Destructors)


1. What is the use of a constructor function in a class? Give a suitable example for a constructor function in a class. 2. Why is a destructor function required in classes? Illustrate with the help of an example. /*CBSE 2000*/ 3. What is a default constructor? How does it differ from destructor? /*CBSE 2006*/ 4. Differentiate between a Constructor and Destructor in context of class and object. Give suitable example in C++. /*CBSE 2007*/ 5. Differentiate between a constructor and destructor function.
6. Differentiate between default & copy constructor with a suitable example. /*CBSE 2005*/

7. Differentiate between default & parameterized constructor with suitable example. 8. What is a copy constructor? What do you understand by constructer overloading? /*CBSE 1998*/ 9. Explain the concept constructor overloading with a suitable example. 10. Answer the questions (i) and (ii) after going through the following class: class player {int health; int age; public: player() { health=6; age=18 } player(int s, int a) {health =s; age = a ; } player( player &p) { } ~player() { cout<<Memory Deallocate; } };

//Constructor1 //Constructor2 //Constructor3 //Destructor 12

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

Computer Science, Class XII, 2010-11


void main() { player p1(7,24); //Statement1 player p3 = p1; //Statement2 } (i) When p3 object created specify which constructor invoked and why? (ii) Write complete definition for Constructor3? 11. 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 <<end1; } }; 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. 12. 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; } }; iii) In Object Oriented Programming, what is Function 4 referred as and when does it get invoked/called? iv) In Object Oriented Programming, which concept is illustrated by Function 1 and Function 3 together? Write an example illustrating the calls for these functions.
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

13

Computer Science, Class XII, 2010-11


13. Answer the questions (i) and (ii) after going through the following program: /*CBSE 2008*/ #include <iostream.h> #include<string.h> class bazaar { char Type[20] ; char product [20]; int qty ; float price ; bazaar() //function 1 { strcpy (type , Electronic) ; strcpy (product , calculator); qty=10; price=225;} public : void Disp() //function 2 { cout<< type <<-<<product<<: <<qty<< @ << price << endl ;} }; void main () { Bazaar B ; //statement 1 B. disp() ; //statement 2 } (i)Will statement 1 initialize all the data members for object B with the values given in the function 1? (YES OR NO). Justify your answer suggesting the correction(s) to be made in the above code. (ii) What shall be the possible output when the program gets executed? (Assuming, if required _ the suggested correction(s) are made in the program).

14. Define a class Society with the following specifications. Data members : Private Members : society_name char (30) house_no integer no_of_members integer flat char(10) income float Member Functions: Public members: A constructer to assign initial values of society_name as Mahavir Nagar, flat as A Type, house_no as 56, no_of_members as 6, income as 50000. input( ) to read data members. alloc_flat( ) To allocate flat according to income income >=50000 - Flat A Type income >=25000 and income <50000 - Flat B Type income <25000 - Flat C Type show( ) to display all details. 15. Define a class Play in C++ with the following specifications: /*CBSE 2003*/ Private members of class Play ?? Playcode integer ?? Playtitle 25 character ? Duration float ? ?v?v Noofscenes integer
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

14

Computer Science, Class XII, 2010-11


Public member function of class Play ? A constructer function to initialize Duration as 45 and Noofscenes as 10. ? ?q?q Newplay() function to take values for Playcode and Playtitle. ?? Moreinfo() to assign the values of Duration and Noofscenes with the help of corresponding values passed as parameters to this function. ?= Showplay() function to display all the data members on the screen. ?=

16. Defne a class WEAR in C++ with following description : /*CBSE 2008*/ Private members : code string Type string Size integer material string Price real number A function calprice( ) that calculates and assign the value of price as follows : For the value of material as WOOLEN Type Price(Rs.) ------------------Coat 2400 Sweater 1600 For material other than WOOLEN the above mentioned price gets reduced by 30%. Public members : A constructor to get initial values for code, Type & material as EMPTY & size and price with 0. A function INWEAR( ) to input the values for all the data members except price which will be initialized by function calprice( ). Function DISPWEAR( ) that shows all the contents of data members
17. Define a class Employee in C++ with the following specification: Private Members: ename an array of char of size[50] ( represent employee name) deptname an array of char of size[20] ( represent department name) salary integer ( represent total salary of an employee) bonus float CalBonus() This function calculate the total bonus given to an employee according to following conditions Deptname Bonus Accounts 4 % of salary HR 5% of salary IT 2% of salary Sales 3% of salary Marketing 4% of salary Public Members: Constructor to initialise ename and deptname to NULL and salary and bonus to 0. A function read_info to allow user to enter values for ename, deptname,salary & Call function CalBonus() to calculate the bonus of an employee. A Function disp_info() to allow user to view the content of all the data members.

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

15

Computer Science, Class XII, 2010-11 Chapter No.6 (Inheritance)


1. Illustrate the concept of Inheritance with the help of an example. /* CBSE 2002 */ 2. What are the different types of inheritance (Single, Multiple, Hierarchical, Multilevel, Hybrid)? Explain all with an example in C++ code? 3. What do you understand by visibility modes in class derivations? What are these modes? ./* CBSE 1999 */ 4. Define Multilevel and Multiple Inheritance in context of Object Oriented Programming. Give suitable example to illustrate the same. /* CBSE 2006 */ 5. Differentiate between Private and Protected members of class in context of inheritance using C++. /* CBSE 2008, 2007 */ 6. How does inheritance influence the working of constructors and destructors? 7. Answer the questions (i) to(iv) based on the following code : /* CBSE 2008 */ class Dolls { char Dcode[5]; protected: float Price; void CalcPrice(float); public: Dolls(); void DInput(); void DShow(); }; class SoftDolls:public Dolls { char SDName[20]; float Weight; public: SoftDolls(); void SDInput(); void SDShow(); }; class ElectronicDolls:public Dolls { char EDName[20]; char BatteryType[10]; int Batteries; public: ElecronicDolls(); void EDInput(); void EDShow(); }; (i)Which type of Inheritance is shown in the above example? (ii)How many bytes will be required by an object of the class ElectronicDolls? iii)Write name of all data members accessible from member function of the class SoftDolls. (iv)Write name of member functions accessible an object of the class ElectronicDolls?

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

16

Computer Science, Class XII, 2010-11


8. Answer the questions (i) to(iv) based on the following code: /* CBSE 2007 */ class Trainer { char TNo[5],Tname[20],specialization[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 above example ? (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 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. 9. Answer the questions (i) to(iv) based on the following code: /* CBSE 2005 */ class Medicine { char Category[10]; char Date_of_manufacture[10]; char Company[20]; public: Medicine(); void entermedicinedetails(); void showmedicinedetails(); }; class capsule:public Medicine { protected: char capsule_name[30]; char volume_lable[20]; public:
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

17

Computer Science, Class XII, 2010-11


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? (ii)Write the names of all the member functions accessible from the object of class Antibiotics. (iii)Write the 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. 10. Consider the following and answer the questions given below: /* CBSE 1999 */ class vehicle { int wheels; protected: int passenger; void inputdata(int,int); void outputdata(); }; class heavy_vehicle:protected vehicle { int diesel_petrol; protected: int load: public: void readdata(int,int); void writedata(); }; class bus:private heavy_vehicle { char make[20]; public: void fetchdata(char); void displaydata(); }; (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 displaydata( ). (iii)Name the data member(s) that can be accessed by an object of bus class. (iv)Is the member function outputdata( ) accessible to the objects of heavy_vehicle class?
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

18

Computer Science, Class XII, 2010-11 Chapter No.7 (Data File Handling)
1. What do you mean by ios::trunc, ios::nocreate, ios::noreplace and ios::binary file mode? 2. Distinguish between ios:: ate and ios :: app? 3. Differentiate between functions read() and write(). /* CBSE 1999 */ 4. Write name of two member functions belonging to fstream class./* CBSE 1998 */ 5. Distinguish between ios::out and ios::app. /* CBSE 2001*/ 6. Name two member functions of ofstream class. /* CBSE 2000*/ 7. Write a function in C++ to count the number of uppercase alphabets present in a text file ARTICLE.TXT. /* CBSE 2008 */ 8. Write a function in C++ to print the count of the word is as an independent word in a text file DIALOGUE.TXT. /* CBSE 2007 */ 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. 9. Given a binary file GAME.DAT, containing records of the following structure type. struct Game /* CBSE 2007 */ { char GameName[20] ; char Participate[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. 10. Observe the program segment given below carefully,and answer the question that follows: class Labrecord /* CBSE 2007 */ { int Expno ; char Experiment[20] ; char Checked ; int Marks ; public : void EnterExp( ) ; //function to enter Experiment details viod ShowExp( ) ; //function to display Experiment details char RChecked( ) //function to return Expno {return Checked ;} void Assignmarks (int M) //function to assign Marks { Marks = M ; } }; void ModifyMarks( ) { fstream File ; File.open (Marks.Dat, ios :: binary || ios :: in || ios :: out) ; Labrecord L ; int Rec=0 ; while (File.read ( (char*) &L,sizeof (L) ) ) { if (L.RChecked( )= =N) L.Assignmarks (0) else L.Assignmarks (10) //Statement 1
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

19

Computer Science, Class XII, 2010-11


. //Statement 2 Rec++ ; } File.close( ) ; } If the function ModifyMarks ( ) is supposed to modify marks for the records in the file MARKS.DAT based on their status of the member Checked (containg value either Y or N).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. 11. void main( ) /* CBSE 2006 */ { char ch = A ; fstream fileout(data.dat, ios::out) ; fileout<<ch ; int p = fileout.tellg( ) cout<<p ; } What is the output if the file content before the execution of the program is the string ABC. 12. Write a function to count the number of words present in a text file named PARA.TXT. Assume that each word is separated by a single blank/space character and no blanks/spaces in the beginning and end of the file. /* CBSE 2006 */ 13. Following is the structure of each record in a data file named COLONY.DAT. struct COLONY /* CBSE 2006 */ { char Colony_Code[10] ; char Colony_Name[10] int No_of_People ; }; Write a function in C++ to update the file with a new value of No_of_People. The value of Colony_Code and No_of_People are read during the execution of the program. 14. void main( ) /* CBSE 2006 */ { char ch = A ; fstream fileout(data.dat, ios :: app) ; fileout<<ch ; int p = fileout.tellg( ) ; cout << p ;} What is the output if the file content before the execution of the program is the string ABC. 15. Write a function to count the number of blank spaces present in a text file named PARA.TXT. /* CBSE 2006 */ 16. Write a function in C++ to count and display the number of lines starting with alphabet A present in a text file LINES.TXT. /* CBSE 2005 */ 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. 17. Given a binary file APPLY.DAT, containing records of the following class Applicant. class Applicant /* CBSE 2005 */ { char A_Rno[10] ; //Roll number of applicant char A_Name[30] ; //Name of applicant Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919 20

Computer Science, Class XII, 2010-11


int A_Score ; //Score of applicant public : void Enrol( ) { gets(A_Rno) ; gets(A_Name) ; cin >> A_Score ; } void Status( ) { cout << setw(12) << A_Admno ; cout << setw(32) << A_Name ; cout << setw(3) << A_Score << endl ; } int ReturnScore( ) {return A_Score ;} }; Write a function in C++, that would read contents of file APPLY.DAT and display the details of those Students whose A_Score is above 70. 18. Write a function to count the number of VOWELS present in a text file named PARA.TXT. /* CBSE 1998 */ 19. 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 { int Bno; char Title[20]; public: int RBno(){return Bno;} void Enter(){cin>>Bno;gets(Title);} void Display(){cout<<Bno<<Title<<endl;} }; 20. Write a function in C++ to count the words to and the present in a text file POEM.TXT. /* CBSE 2010 */ 21. Write a function in C++ to count the number of words starting with capital alphabet present in a text
file DATA.TXT. 22. Observe the program segment given below carefully and fill in the blanks marked by the

statement1 and statement 2 using Seekg() and tellg() functions for performing the required task #include <fstream.h> class Car { char No_Plate[15],Car_type[20]; public : /* function to count the total no. of records in a file */ int Countrec(); }; int Car::Countrec() { fstream file ; file.open( Veh.dat,ios::binary| ios::in); _______________________________ //statememt1 int bytes = ________________________ //statement 2 int Count = bytes/sizeof(Car); Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919 21

Computer Science, Class XII, 2010-11


file.close(); return Count; }
23. Write a function in C++ to search & display the details of all trains, whose destination is

Delhi from a binary file TRAIN.DAT, assuming the binary file is containing the objects of the following class. /* CBSE 2010 */ class TRAIN { int Tno; char From[20]; char To[20]; public: char* GetFrom( ){return From;} char* GetTo( ){return To;} void Input(){cin>>Tno;gets(From);gets(To);} void Show(){cout<<Tno<<From<<To<<endl;} }; 24. Write a function in C++ to add new object at the bottom of the binary file Train.Dat. Assuming that binary file is containing the objects of the following class: class Train { int Tno; char Tname[20]; char start_place[20]; public: void enter( ) { cin>>Tno ; gets(Tname) ; gets(start_place);} void display( ) { cout<<Tno << Tname << start_place; } char *ret_place( ) { return start_place; } };

Chapter No.8 (Pointers)


1. Differentiate between static and dynamic memory allocation. 2. What is role of new and delete operator in memory allocation? 3. What do you mean by memory leaks? What are possible reasons for it? How can memory leaks be avoided? 4. What is this pointer? What is its significance? Give an example to illustrate the use of it in C++. /* CBSE 2006 */ 5. Distinguish between /* CBSE 2001 */ int *ptr=new int(5); int *ptr=new int[5];
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

22

Computer Science, Class XII, 2010-11


6. Find the output of the following program: #include<iostream.h> int a=10; void main() { void demo(int &,int,int*); int a=20,b=5; demo(::a,a,&b); cout<<::a<<a<<b<<endl; } void demo(int &x,int y,int *z) { a+=x; y*=a; *z=a+y; cout<<x<<y<<*z<<endl; } 7. Find the output of the following program: #include<iostream.h> #include<string.h> class student { char *name; int l ; public: student( ) {l=0; name=new char I1+1]; } student (char *s) { I =strlen(s); name=new char[I+1]; strcpy (name,s); } void display( ) {cout<<name<<endl;} void manipulate(student & a, student & b) { I = a. I + b.I; delete name; name=new char[I+1]; 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 (SI, name3); S1.display ( ); S2.display ( ); } /* CBSE 2006 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

23

Computer Science, Class XII, 2010-11


8. Find the output of the following program: #include < iostream.h> void main( ) { int *Pointer Array [10]; int marks [ = {75, 68, 90, 34, 0, 10, 90, 65}; for (int I = 0; marks [ I]!=0; I++) { PointerArray [I]=&marks[I]; * (PointerArray [I] ) += 5; } int index = 0; while(index < I ) { int p=*(PointerArray[index] ); if(p >=60) cout <<p<<,; index ++; } } 9. What will be the output of the following program : #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; } 10. 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; /* CBSE 2006 C */

/* CBSE 2004 */

/* CBSE 2007 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

24

Computer Science, Class XII, 2010-11


for(C = 0; C<4; C++) { (*ptr)*=2; --ptr; } for(C = 0; C<4; C++) cout<< Numbers [C]<< #; cout<<endl; }

Chapter No.9 (Arrays)


1. An array MAT [20] [10] is stored in the memory along the row with each element occupying 4 bytes of memory. Find out the base address and the address of element MAT[10][5] if the location of MAT [3][7] is stored at the address 1000. /* CBSE 2006 */ 2. An array MAT [15] [7] is stored in the memory along the column with each element occupying 2 bytes of memory. Find out the base address and the address of element MAT [2] [5], if the location of MAT [5] [4] is stored at the address 100. /* CBSE 2006 C */ 3. X is 2D array [10 X 5]. Each element of array is stored in 2 memory locations. If X [1,1] begins at address 150, find the location of X[3,4]. Use row major formula. 4. 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 /* CBSE 2004 */ 5. If an array B[11][8] is stored as column wise and B[2][2] is stored at 1024 and B[3][3] at 1084. Find the address of B[5][3]. 6. A 2-d array defined as A[4..7, -1..3] requires 2 words of storage space for each element. calculate the address of A[6,2], given the base address as 100, also calculate the address of A[7,0] If the array is stored in row major order. 7. Assume an array S containing elements of structure student is required to be arranged in descending order of marks. Write a C++ function to arrange the same with the help of bubble sort. The array and its size is required to be passed as parameters to the function. struct student { int rollno; char name[25]; float marks; }; 8. A one-dimensional array SCORE is containing long data type arranged in ascending order. Write a user defined function in C++ to search for a number from SCORE 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 SCORE, (2) the number SDATA to be searched, (3) number of elements N. 9. 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. /*CBSE 2008, 2004*/ 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
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

25

Computer Science, Class XII, 2010-11


10. 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. Example : if an array of five elements initially contains the elements as /* CBSE 2007 */ 3, 4, 5, 16, 9 then the function should rearrange the content of the array as 6, 2, 10, 8, 18 11. 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. /* CBSE 2004 */ 12. 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. /* CBSE 2005*/

13. Write a function in C++ to merge the contents of two sorted 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. 14. 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. 15. 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. 16. Write a function in C++ to find the sum of both left and right diagonal elements from a two dimensional array (matrix). 17. 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: /*CBSE 2005*/ 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 18. Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle row and the elements of middle column. /* CBSE 2007 */ [Assuming the 2D Array to be a square matrix with odd dimension i.e. 33, 55, 77 etc...] Example, if the array content is 354 769 218 Output through the function should be : Middle Row : 7 6 9 Middle Column : 5 6 1 19. 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: If the array is 1, 2, 3,4,5,6 if the array is 1, 2, 3 The resultant 2 D array is given below The resultant 2 D array is given below /* CBSE 2006 */ If the array is 1, 2, 3 If the array is 1, 2, 3, 4, 5, 6 The resultant 2 D array is given The resultant 2 D array is given below below 1 0 0 0 0 0 1 0 0 1 2 0 0 0 0 1 2 0 1 2 3 0 0 0 1 2 3 Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919 26

Computer Science, Class XII, 2010-11


1 1 1 2 2 2 3 3 3 4 4 4 0 5 5 0 0 6

20. Write a function in C++ to print the product of each row of a two dimensional integer array passed as the argument of the function. /* CBSE 2008 */ Example: if the two dimensional array contains 20 40 60 40 Then the output should appear as : Product of Row 1= 8000 Product of Row 2= 60000 Product of Row 3= 36000 Product of Row 4= 24000 21. Write a function in C++ to find sum of rows from a two dimensional array. 22. Write a function UpperHalf ( ) which takes a two dimensional array A, with size N rows and N columns as argument and point the upper half of the array. Eg: If A is 2 3 1 5 0 The output will be 2 3 1 5 0 7 1 5 3 1 1 5 3 1 2 5 7 8 1 7 8 1 0 1 5 0 1 0 1 3 4 9 1 5 5 23. Write a function LowerHalf ( ) which takes a two dimensional array A, with size N rows and N columns as argument and point the lowerr half of the array. Eg: If A is 2 3 1 5 0 The output will be 2 7 1 5 3 1 7 1 2 5 7 8 1 2 5 7 0 1 5 0 1 0 1 5 0 3 4 9 1 5 3 4 9 1 5 24. Write a user defined function in C++ which accepts a squared integer matrix with odd dimensions
(3*3, 5*5 ) & display the square of the elements which lie on both diagonals. For eg. :

40 50 30 20

10 30 20 30

2 5 7 3 7 2 5 6 9 The output should be: Diagonal one : 4, 49, 81 Diagonal two : 49, 49, 25

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

27

Computer Science, Class XII, 2010-11 Chapter No.11 (Database Concepts)


1. What is a Candidate Key, Primary Key and Alternate key? /* CBSE 2006, 2007, 2008 */ 2. What do you understand by the terms Primary Key and Degree & Cardinality of a relation in relational database? /* CBSE 2005 */ 3. Define domain, keys and foreign key? 4. What is the purpose of a key in a table? Give an example of a key in a table. /*CBSE 2009 */ 5. What is the importance of a primary key in a table? Give suitable example of primary key from a table
containing some meaningful data.

6. Explain Cartesian product of two relations. /* CBSE 2001 */ 7. What is a relation? What is the difference between a tuple and an attribute? /* CBSE 1998 */

/* CBSE 2007, 2010 */

Chapter No.12 (Structured Query Language)


1. What are DDL and DML? Give two examples of each. /* CBSE 2002, 2006 */ 2. Study the following tables FLIGHTS and FARES and write SQL commands for the questions (i) to (iv) and give outputs for SQL queries (v) to (vi). /* CBSE 2006 */
TABLE: FLIGHTS FL_NO IC301 IC799 MC101 IC302 AM812 IC899 AM501 MU499 IC701 STARTING MUMBAI BANGALORE INDORE DELHI KANPUR MUMBAI DELHI MUMBAI DELHI ENDING DELHI DELHI MUMBAI MUMBAI BANGALORE KOCHI TRIVANDRUM MADRAS AHMEDABAD TABLE: FARES FL_NO 1C701 MU499 AM501 IC899 1C302 1C799 MC101 AIRLINES Indian Airlines Sahara Jet Airways Indian Airlines Indian Airlines Indian Airlines Deccan Airlines FARE 6500 9400 13450 8300 4300 10500 3500 TAX% 10 5 8 4 10 10 4 NO_FLIGHTS 8 2 3 8 3 1 1 3 4 NO STOPS 0 1 0 0 1 4 5 3 0

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

28

Computer Science, Class XII, 2010-11


i. ii. iii. Display FL_NO and NO_FLIGHTS from KANPUR to BANGALORE from the table FLIGHTS. Display the contents of the table FLIGHTS in the ascending order of FL_NO. Display the FL_NO and fare to be paid for the flights from DELHI to MUMBAI using the tables FLIGHTS and FARES, where the fare to be paid = FARE + FARE * TAX%/100. Display the minimum fare Indian Airlines is offering from the table FARES. SELECT FL_NO, NO_FLIGHTS, AIRLINES from FLIGHTS, FARES where STARTING=DELHI and FLIGHTS.FL_NO=FARES.FL_NO; SELECT count (distinct ENDING) from FLIGHTS;

iv. v. vi.

3. Consider the following tables ACTIVITY and COACH. Write SQL commands for the statements (i) to (vi) and give outputs for SQL queries (vii) to (xii) Table: ACTIVITY ACode ActivityName ParticipantsNum PrizeMoney ScheduleDate 1001 Relay 100x4 16 10000 23-Jan-2004 1002 High jump 10 12000 12-Dec-2003 1003 Shot Put 12 8000 14-Feb-2004 1005 Long Jump 12 9000 01-Jan-2004 1008 Discuss Throw 10 15000 19-Mar-2004 Table: COACH PCode Name ACode 1 Gulam Nabi 1001 2 Roma Khanna 1008 3 Amit Bohra 1001 4 Bhupendra 1003 (i) To display the name of all activities with their Acode 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 coachs name and ACode in ascending order of ACode from the table COACH. (iv) To display the content of the ACTIVITY table whose ScheduleDate earliar than 01-JAN-2004 in ascending order of ParticipantNum. (v) To display details of those activities which are having PrizeMoney more than 7000 (vi) To display the content of the ACTIVITY table in ascending order of ScheduleDate (vii). SELECT COUNT(DISTINCT ParticipantsNum) FROM ACTIVITY; (viii)SELECT MAX(ScheduleDate),MIN(ScheduleDate) FROM ACTIVITY; (ix) SELECT SUM(PrizeMoney) FROM ACTIVITY; (x) SELECT SUM(PrizeMoney) FROM ACTIVITY Group By ParticipantNum; (xi) SELECT DISTINCT ACode FROM COACH; (xii) SELECT AVG(PrizeMoney) FROM ACTIVITY; 4. Write SQL commands (a) to (m) and outputs (n) to (s) on the basis of Teacher relation given below: No Name Age Department DateofJoin Salary Sex 1 Jugal 34 Computer 10-JAN-97 12000 M 2 Sharmila 31 History 24-MAR-98 20000 F 3 Sandeep 32 Maths 12-DEC-96 30000 M 4 Sangeeta 35 History 01-JUL-99 40000 F
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

29

Computer Science, Class XII, 2010-11


5 Rakesh 42 Maths 05-SEP-97 25000 M 6 Shyam 50 History 27-JUN-98 30000 M 7 Manoj 44 Computer 35-FEB-97 21000 M 8 Rina 33 Maths 31-JUL-97 19500 F a) To show all information about the teachers of History department. b) To increment the salary by 20% of those teachers who is getting salary more than 21000. c) To display teacher name, age, department for male teachers from Teachers table. d) To list name of female teachers who are in History department. e) To list name and department of those teachers in which date of joining is before 24-MAR-98 from teacher table in descending order of their name. f) To insert a new row in teacher table with following data: 9, Rahul, 27, Computer, 10-SEP-98, 22500, M. g) To list name of all teachers with their join date in descending order. h) To show the name of those teachers who have first alphabet as S and third alphabet as n from teacher table. i) To display the second largest salary from teacher table. j) To count the numbers of those teachers who join before 12-JUL-97. k) To decrease the salary of all teachers of Maths department by 500. l) To find the total salary of those teachers who are working in Maths department. m) To delete the records of those teachers whose age is greater than equal to 40. n) select sum (Salary) from teacher where Department= History; o) select count (distinct Department) from Teachers; p) select avg (Salary) from Teacher where DateofJoin > 31-JUL-97; q) select max (Age) from Teacher where Sex= F; r) select count (*) from Teachers where DateofJoin < 12-JUL-97; s) select name, age, department from teacher where Sex= M ; 5. Consider following tables STOCK and DEALERS and write SQL commands for the questions (i) to (iv) and give outputs for SQL queries (v) to (viii). /* CBSE 2010 */ Tables: STOCK ItemNo Item Dcode Qty UnitPrice StockDate 5005 Ball Pen 0.5 102 100 16 31-Mar-10 5003 Ball Pen 0.25 102 150 20 01-Jan-10 5002 Gel Pen Premium 101 125 14 14-Feb-10 5006 Gel Pen Classic 101 200 22 01-Jan-09 5001 Eraser Small 102 210 5 19-Mar-09 5004 Eraser Big 102 60 10 12-Dec-09 5009 Sharpener Classic 103 160 8 23-Jan-09 Tables: DEALERS Dcode Dname 101 Reliable Stationers 103 Classis Plastic 102 Clear Deals i) To display details of all items in the STOCK table in ascending order of StockDate. ii). To display Item No and Item name of those items from STOCK table whose UnitPrice is more than Rupees 10. iii). To display details of those items whose dealer code is 102 or quantity in stock is more than 100 from STOCK table.
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

30

Computer Science, Class XII, 2010-11


iv) To display maximum UnitPrice of items for each dealer individually as per Dcode from STOCK table. v) select count(distint dcode) from stock; vi) select Qty*UnitPrice from stock where itemno=5006; vii) select item, dname from stock S, dealer D where S.dcode=D.dcode and itemno=5004; viii) select min(stockdate) from stock;

Chapter No.13 (Boolean Algebra)


1. State and verify Associative Law? /* CBSE 2006, 2005 */ 2. State and verify De Morgans theorem. /* CBSE 2006 Comp., 2007 */ 3. State and verify Distributive Law. /* CBSE 2006 */ 4. State and verify Absorption law in Boolean- Algebra algebrically./*CBSE 2008, 2004, 2009*/ 5. State and verify second Distributive law by algebraic method in Boolean Algebra. 6. State and verify IdempotenceLaw. 7. State and verify ComplementarityLaw. 8. State and verify Commutative Law. 9. State and verify third distributive Law. 10. State Involution Law and verify the same using truth table. 11. Verify the following algebraically: /* CBSE 2010 */ X.Y + X.Y = (X+Y)(X+Y) 12.Write the equivalent expression for the following logical circuit: /* CBSE 2006 */

13. Write the equivalent expression for the following logical circuit: /* CBSE 2006 Comp. */

14. Write the equivalent expression for the following Logical Circuit:

/* CBSE 2006 */

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

31

Computer Science, Class XII, 2010-11


15. Write the equivalent expression for the following Logical Circuit: /* CBSE 2010 */

16. Express P+Q R in canonical POS form. /* CBSE 2006 */ 17. Reduce the following Boolean expression using K-Map: /* CBSE 2006 Comp. */ F(P,Q,R,S)=?(l,3,5,8,11,12,15 ) 18. Reduce the following Boolean expression using K-Map: /* CBSE 2006 */ F(P, Q, R, S) = p (0,3,5,6,7, 11, 12, 15) 19. Express P+QR in canonical SOP form. /* CBSE 2006 */ 20. Reduce the following Boolean expression using K-Map. /* CBSE 2006 */ F(P, Q ,R, S) = ?(0,3,5,6,7,11,12,15) 21. Reduce the following Boolean expression using K-Map. /* CBSE 2010 */ F(A,B,C,D) = ?Y (3,4,5,6,7,13,15) 22. Reduce the following Boolean expression using K - Map: /* CBSE 2009 */ H(U,V,W,Z) = (0,1,4,5,6,7,11,12,13,14,15) 23. Draw a Logical Circuit Diagram for the following Boolean Expression: /* CBSE 2008 */ A . (B + C') 24. Convert the following Boolean expression, into its equivalent Canonical Product of Sum Form(POS) : A. B' .C + A'. B. C + A'. B. C' /* CBSE 2008 */ 25. Reduce the following Boolean expression using K - Map: /* CBSE 2008 */ F(A,B,C,D) = (0,1,2,4,5,8,9,10,11) 26. Obtain a simplified form for the following Boolean Expression using Karnaughs Map : F(a, b, c, d) = ? (0, 1, 2, 4, 5, 7, 8, 9, 10, 11, 14) ? /* CBSE 2004 */ 27. Reduce the following Boolean expression using K - Map: /* CBSE 2005 */ F (A, B, C, D) = p+ (0, 1, 2, 3, 4, 5, 10, 11, 15) ?+ 28. Write the equivalent Canonical Product of Sum Expression for the following Sum of Product Expression F(X, Y, Z) = ?} (0, 2, 4, 5) ?} /* CBSE 2007 */ 29. Reduce the following Boolean expression using K-Map: /* CBSE 2007 */ F(A, B, C, D) = p(5,6,7,8,9,12,13,14,15) 30. Convert the following Boolean expression into its equivalent Canonical Sum of Product Form(SOP): (X+Y+Z).(X+Y+Z).(X+Y+Z).(X+Y+Z). 31. Draw logical circuit diagram for the following Boolean expression. F= AB + BC + CA 32. Write the equivalent canonical POS expression for the following SOP expression: F(x,y,z)=S< (0,2,5,6). 33. Prove that XY+YZ+YZ=Y algebraically. 34. If F(w,x,y,z) = (1,3,5,7,,8,9,10,11,12,13,14,15) , obtain the simplified form using K-Map. 35. State Duality principle. Give the dual of the expression: ft+ty 36. Draw the circuit diagram for the following Boolean expression : (A+B)(A+B)(A+B) 37. Reduce the following Boolean expressions using K-Map: i) F(A,B,C,D)= ? (0,1,2,4,5,8,9,10,11) ii) F (A, B, C, D) =?(0,2,3,4,6,7,8,10,12) iii) F(A,B,C,D)= p_ (0,1,2,4,5,6,8,10)
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

32

Computer Science, Class XII, 2010-11


iv) F(a,b,c,d)=?< ?< 0,2,4,5,7,8,10,12,13,15) ?< v) F(a,b,c,d) = ? (0,1,3,4,5,7,8,9,11,12,13,15) vi) F(U,V,W,Z)= pe(0,1,3,5,6,7,10,14,15) vii) F(A,B,C,D) = p (5,6,7,8,9,12,13,14,15) 38. Write the POS form of a Boolean function F, which is represented in a truth table as follows: /* CBSE 2009*/ U V W F 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1 39. Write the SOP form of a Boolean function G, which is represented in a truth table as follows: /* CBSE 2010 */ P Q R G 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 1

Chapter No.14 (Networking Concepts)


1. 2. 3. 4. 5. What is the significance/role of ARPANET in the computer network? /* CBSE 2010 */ Name two transmission media for networking. /* CBSE 2006 */ Differentiate between Hackers and Crackers. /* CBSE 2006, 2008 */ Explain function of Modem and Switch. /* CBSE 2006 */ Write one advantage & disadvantage of BUS topology as compared to STAR topology. /* CBSE 2006 */ 6. Differentiate between Internet and Intranet. /* CBSE 2006 */ 7. Write one difference between coaxial and optical cable. /* CBSE 2004 */ 8. Define Packet Switching and message switching. /* CBSE 2004, 2005 */ 9. Name two switching techniques used to transfer data between two terminals (computers). /*CBSE 2009*/ 10. Write two application of Cyber Law. /* CBSE 2005 */ 11. What do you understand by the terms Cookies and Firewall? /* CBSE 2005 */ 12. 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. /* CBSE 2007 */

(i) Mbps

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

(ii) KMph

(iii) MGps

33

Computer Science, Class XII, 2010-11


13. Which of the following is not a unit for data transfer rate? /* CBSE 2010 */ (i) mbps (ii) kbps (iii) sbps (iv) gbps 14. What are router, gateway, bridge, switch and repeater? 15. Differentiate between uploading & downloading 16. What is a topology? Write short note on Bus topology, Star topology and Ring topology. 17. Differentiate between Telnet & FTP .? 18. What is a switch? How is it different from hub? 19. What is the difference between CDMA and GSM technologies 20. What are spam mails? How can you protect your mailbox from spams? 21. What do you understand by network security? Give any two techniques. 22. Expand the following terminologies: /* CBSE */ CDMA, GSM, HTML, XML, SMS, MAN, WAN, LAN, FTP, WWW, URL, HTTP, PPP, SLIP, TCP/IP, WLL, RJ-45, ARPANET, ISP, DHTML, SIM, GPRS, ISDN, W3C, TDMA, FSF, OSI, GNU, FLOSS, OSS. 23. How is free software different from OSS? 24. What is the purpose of using a Web Browser? Name any two commonly used Web Browser. /* CBSE 2010 */ 25. Give difference between LAN, MAN and WAN. /* CBSE 2009 */ 26. What is protocol? Define working of TCP and IP protocol? 27. What is protocol? Which protocol is used to copy a file from/to a remotely located server? /* CBSE 2009 */ 28. Define OSS, Free software, Freeware, Shareware, FLOSS, GNU, FSF, OSI, W3C, Proprietary software. 29. How Trojan Horse and Worms spread? 30. What is the difference between Virus and Worms in the computers? /* CBSE 2010 */ 31. What term do we use for a software/hardware device, which is used to block unauthorized access while permitting authorized communication? This term is also used for a device or set of devices configured to permit, deny, encrypt, decrypt, or proxy all (in and out) computer traffic between different security domains based upon a set of rules and other criteria. /* CBSE 2010 */ 32. If someone has hacked your website, to whom you lodge the complain? 33. What do you mean by IP address? How is it useful in computer security? 34. Which of the following is not a client side script. (i) VB script (ii) Java scripts (iii) ASP (iv) PHP 35. Knowledge Supplement Organization has set up its new center at Mangalore for its office and web based activities. It has 4 blocks of buildings as shown in the diagram below: /* CBSE 2010 */ Block A Block C

Block B

Block D

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

34

Computer Science, Class XII, 2010-11


Center to center distances between various blocks Black A to Block B 50 m Block B to Block C 150 m Block C to Block D 25 m Block A to Block D 170 m Block B to Block D 125 m Block A to Block C 90 m Number of Computers Black A 25 Block B 50 Block C 125 Block D 10 e1) Suggest a cable layout of connections between the blocks. e2) Suggest the most suitable place (i.e. block) to house the server of this organization with a suitable reason. e3) Suggest the placement of the following devices with justification (i) Repeater (ii) Hub/Switch e4) The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed? e5) The organization is planning to connect its International Office situated in Mumbai. Which out of the following wired communication links, will you suggest for a very high speed connectivity? Telephone Analog Lines Optical Fiber Ethernet Cable 36. Ravya Industries has set up its new center at Kaka Nagar for its office and web based activities. The company compound has 4 buildings as shown in the diagram below:

Raj Building

Fazz Building

Harsh Building

Jazz Building

Center to center distances between various buildings is as follows: Harsh Building to Raj Building 50 m Raz Building to Fazz Building 60 m Fazz Building to Jazz Building 25 m Jazz Building to Harsh Building 170 m Harsh Building to Fazz Building 125 m Raj Building to Jazz Building 90 m
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

35

Computer Science, Class XII, 2010-11


Number of Computers in each of the buildings is follows: Harsh Building 15 Raj Building 150 Fazz Building 15 Jazz Bulding 25 e1) Suggest a cable layout of connections between the buildings. e2) Suggest the most suitable place (i.e. building) to house the server of this organisation with a suitable reason. e3) Suggest the placement of the following devices with justification: (i) Internet Connecting Device/Modem (ii) Switch e4) The organisation is planning to link its sale counter situated in various parts of the same city, which type of network out of LAN, MAN or WAN will be formed? Justify your answer. 37. 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 HOSTEL(H). Distance between various wings are given below: Wing A to Wing S Wing A to Wing J Wing A to Wing H Wing S to Wing J Wing S to Wing H Wing J to Wing H 100m 200m 400m 300m 100m 450m

Number of Computers Wing A Wing S Wing J Wing H i. ii. iii. iv. 10 200 100 50

Suggest a suitable Topology for networking the computer of all wings. Name the wing where the Server is to be installed. Justify your answer. Suggest the placement of Hub/Switch in the network. Mention an economic technology to provide internet accessibility to all wings. 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.
Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

36

Computer Science, Class XII, 2010-11


38. "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. Approximate distances between these Units is as follows: From Production Unit Production Unit Production Unit To Finance Unit Media Unit Corporate Unit Distance 70 Mtr 15 KM 2112 KM

Finance Unit Media Unit 15 KM In continuation of the above, the company experts have planned to install the following number of computers in each of their office units: Production Unit 150 Finance Unit Media Unit i. 35 10

ii.

iii.

iv.

Corporate Unit 30 Suggest the kind of network required (out of LAN, MAN, WAN) for connecting each of the following office units: Production Unit and Media Unit Production Unit and Finance Unit Which one of the following devices will you suggest for connecting all the computers within each of their office units? Switch/Hub, Modem, Telephone 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, Optical Fiber, Ethernet Cable 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.

Mohd. Hashim, PGT (Computer Sc.), E-mail: hashim_mbd@yahoo.co.in, 9950589919

37

Das könnte Ihnen auch gefallen