kvioc@rediffmail.com +91-6243-242730, 274247 +91-6243-242730
केन्द्रीय विद्यालय, आई ओ सी, बरौनी
Kendriya Vidyalaya, IOC, Barauni
(An Autonomous body under MHRD) Government Of India
सी बी एस ई संबध संख्या : 300014 विद्यालय संख्या : 08002 के वी संख्या : 08002
Current Events / Notices
HOME-WORK
Sunday, May 13th 2018

SUMMER VACATION HOMEWORK—2018

CLASS 1

CLASS -2

 

Class---XII        Sub---Computer Science

Week-1

1.  Find the output of the following program;

#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]; } cout<<Text; }

 

2. Find the output of the following program:

#include<iostream.h>

#include<ctype.h> void main( )

{ charMystring[ ] = "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; }

 

3. Find the output of the following program.

#include<iostream.h>

voidWithdef(intHisNum=30)

{ for(int I=20;I<=HisNum;I+=5) cout<<I<<”,”;

cout<<endl;   }

void Control(int&MyNum)

{ MyNum+=10; Withdef(MyNum); }

void main()

{ intYourNum=20; Control(YourNum);

 

Withdef(); cout<<.Number=.<<YourNum<<endl; }

 

    4.   Find the output of the following program:

 

#include<iostream.h> void Indirect(int Temp=20)

 

{for(int I=10;I<=Temp;I+=5)

cout<<I<<”,”;cout<<endl; }

void Direct(int&Num)

 

{Num+=10;

Indirect(Num); } void main( )

{           int Number=20;

Direct(Number);

Indirect( );

cout<<”Number =”<<Number<<endl;        }

 

5  Find the output of the following program:

#include<iostream.h>

#include<ctype.h>

void Secret(char Msg[],int N);

void main( )

{           char SMS=” rEPorTmE”;

Secret(SMS,2);

cout<<SMS<<endl;    }

void Secret(char Msg[],int N)

{ for(int c=10;Msg[]1=’\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;

}

 

6  Find the output of the following program:

 

#include<iostream.>

 

 

structthree_d

 

 

 

{

intx,y,z;

};

 

 

void movein(three_d&t, int step=1)

 

 

{

t.x+=step;

 

 

 

t.y+=step;

 

t.z+=step;       }

voidmoveout(three_d&t, int step=1) {

t.x-=step; t.y+=step;

t.z-=step;        }

void main()

{ three_d t1={10,20,5},t2={30,10,40}; movein(t1);

moveout(t2,5);

cout<<t1.x<<","<<t1.y<<","<<t1.z<<endl;

cout<<t2.x<<","<<t2.y<<","<<t2.z<<endl;

movein(t2,10); cout<<t2.x<<","<<t2.y<<","<<t2.z<<endl; }

7.  Write the output of the following program:

#include<iostream.h>intfunc(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;               }

8. Find the output of the following program.                                      

#include<iostream.h>

#include<ctype.h>

voidMycode(char Msg[],char ch)

{for(intcnt=0;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-1];}}

void main()

 

{ charMyText[]="ApEACeDriVE"; Mycode(MyText,'@');

cout<<"NEW TEXT: "<<MyText<<" "<<endl;         }

 

  1.  Find the output of the following program :           

#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;

}

  1.  Find the output of the following program :                                               

#include <iostream.h>

struct POINT

{int X, Y, Z;};

voidStepIn(POINT & P, int Step=1)

{

P.X+=Step;

P.Y -=Step;

P.Z+=Step;

}

voidStepOut(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;

}

 

 

 

 

 

Week-2

 

  1.   Find the output of the following program:                                               

#include <iostream.h>

struct THREE_D

{int X,Y,Z;};

voidMoveIn(THREE_D &T, int Step=l)

}

T.X+=Step;

T.Y-=Step;

T.Z+=Step

}

voidMoveOut(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;

}

 

  1.   Find the output of the following program:                                   

#include<iostream.h>

voidChangeArray(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) ;

}

 

  1.  Find the output of the following program:                        

#include <iostream.h>

voidSwitchOver(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);

}

  1.  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;

}

 

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;

}

 

 

 

15.   Find the output of the following program: 

#include <iostream.h>

voidChangethecontent(intArr[ ], 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] <<'#';

}

16. In the following program, find the correct possible output(s) from the options:

                                                                                               

#include<stdlib.h>

#include<iostream.h>

 

void main ( )

{

randomize ( ) ;

 

char City [ ] [10] = {“DEL”, “CHN”, “KOL”, “BOM”, “BNG”};

int Fly;

for (int I=0;I<3;I++)

{

Fly=random (2)+ 1;

cout<<City[Fly]<<”:” ;

}   

}

Outputs:

(i) DEL:CHN:KOL:

(ii) CHN:KOL:CHN:

(iii) KOL:BOM:BNG:

(iv) KOL:CHN :KOL:

 

17.  In the following program, find the correct possible output(s) from the options:

                                                                                               

#include<iostream.h>

void main ( )

{

randomize() ;

char Area [ ] [10] = {‘‘NORTH”, ‘‘SOUTH”, “EAST”, “WEST”} ;

intToGo;

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:

 

18.  Study the following program and select the possible output from it :

                                                                                                                       

#include <iostream.h>

#include <stdlib.h>

constint LIMIT = 4 ;

void main ( )

{

randomize ( ) ;

int Points;

Points = 100 + random(LIMIT) ;

for (int P=Points ; P>=100 ; P– –)

cout<<P<<“#” ;

cout<<endl;

}

(i) 103#102#101#100#

(ii) 100#101#102#103#

(iii) 100#101#102#103#104#

(iv) 104#103#102#101#100#

19. Study the following program and select the possible output from it :

                                                                                   

#include <iostream.h>

#include <stdlib.h>

constint MAX=3 ;

void main ( )

{

randomize( ) ;

int Number ;

Number = 50 + random{MAX) ;

for (int P=Number; P>=50; P– –)

cout<<p<< “ # ” ;

cout<<endl;

}

 

(i) 53#52#51#50#

(ii) 50#51#52#

(iii) 50#51#

(iv) 51#50#

 

20.   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.

#include <iostream.h>

#include <stdlib.h>

constint 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:

 

 

 

 

 

 

Week-3

  1.  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.

                        #include <iostream.h>

#include <stdlib.h>

constint 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:

 

22.  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.                                                                                    

#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

(iii) 53 # 54 #

(iv) 51 # 52 # 53 # 54 # 55

  1.  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.                                                                      

#include<iostream.h>

#include <stdlib.h>

 

void main ( )

{

randomize ( ) ;

intMyNum, 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

 

 

  1.    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()

{

intN,Guessme;

randomize();

  cin>>N;

  Guessme=random(N)+10;

cout<<Guessme<<endl;

}

 

  1. 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?

 

#include <iostream.h>

#include <stdlib.h>

 

void main()

{

intN,Guessnum;

randomize();

  cin>>N;

  Guessnum=random(N-10)+10;

cout<<Guessnum<<endl;}

  1.  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)?                              

 

#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

 

  1.   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?

 

 

#include <iostream.h>

#include <stdlib.h>

void main()

{

int N,Guessnum;

randomize();

cin>>N;

Guessnum=random(N-10)+10;

cout<<Guessnum<<endl;

}

28. Find out the errors, if any, in the following C++ statement:

 (i) cout<<"="a;

(ii) m=5, n=12; o=15

 (iii) cout<<"x";<<x;

 (iv) cin>>y;>>j;

 (v) cin>>"\n">>y;

 (vi) cout>>"\n "abc";

 (vii)a = b + c

 (viii) break = x*y;

 

29.is the difference between fundamental data types and derived data types? Explain with examples.

 

30.What is the function of increment/decrement operators? How many varieties do they come in? How are these two varieties different from one another?

 

Week-4

31.Rewrite the following program after removing all the syntactical error(s), if any. Underline each correction. #include<iostream.h>

void main()

{ Present=25,Past=35; Assign(Present;Past);

Assign(Past); }

void Assign(int Default1,Default2=30)

{ Default1=Default1+Default2;

 cout<<Default1>>Default2;

}

 

32. Given the following code fragment:

 if(a==0) cout<<"Zero";

 if(a==1) cout<<"One";

if(a==2) cout<<"Two";

if(a==3) cout<<"Three";

Write an alternative code (using if) that saves on number on compressions.

 

 33. Write the names of the header files, which is/are essentially required to run/execute the following C++ code:

 #include<iostream.h>

void main()

{ char CH,Text[]="+ve Attitude";

for(int I=0;Text[I]!='\0';I++)

if(Text[I]=='')

cout<<endl;

 else

{ CH=toupper(Text[I]); cout<<CH;

 } }

 

34 Rewrite the following program after removing all the syntactical error(s), if any. Underline each correction. #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; }

 

35 Rewrite the following program after removing all the syntactical error(s), if any. Underline each correction. #include<iostream.h> typedef char[80]; void main(){ String S="Peace"; int L=strlen(S); cout<<S<<'has'<<L <<'characters'<<endl; }

 

36 Find the output of the following program: #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(it A[],int N) { for(int K=0;K<N;K++) (K%2==0)?cout<<A[K] <<"%":cout<<A[K]<<endl; } void main(){ int H[]={30,40,50,20,10,5}; SwitchOver(H,6,3); Display(H,6); }

 

 37. 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.#include<iostream.h> #include<stdlib.h> const int LOW=25; void main(){ randomize(); int POINT=5,Number; for(int I=1;I<=4;I--) { Number=LOW+random(POINT); cout<<Number<<":"; POINT--; } } (i) 29:26:25:28: (ii) 24:28:25:26: (iii) 29:26:24:28: (iv) 29:26:25:26:

 

38.When a compiler can automatically generate a constructor if it is not defined then why is it considered that writing constructor for a class is a good practice?

 

39. ‘Accessibility of a constructor or a destructor greatly affects the scope and visibility of their class’. Elaborate this statement.

40. Explain the role of a default constructor? When is it considered equivalent to a parameterized constructor? Support your answer with examples.

 

Week-5

41.What is a parameterized constructor? How is it useful?

 

42. What is a copy constructor? What is its significance? Which situation is it invoked in? Support your answer with examples.

 

43. Differentiate between a default constructor and copy constructor, giving suitable examples of each.

 

 

44. Describe the importance of destructor.

 

45.Answer the question (i) and (ii) after going through the following program:

#include<iostream.h>

#include<string.h>

class Bazar

{ char Type[20];

char Product[20];

int Qty;

float Price;

Bazar() //Fuction 1

{

strcpy(Type,"Electronic");

strcpy(Product,"Calculator");

Qty=10;

Price=225;

}

public:

voif Disp() //Function 2

{ cout<<Type<<"-"<<Product<<":"<<Qty<<"@"<<Price<<endl;

}

};

void main()

{

Bazar 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)

 

Week-6

 

46.Define class and object.

 

47.Define data hiding and encapsulation.

 

48. what do you mean by polymorphism?

 

49.What is function overloading?

 

50. What is the difference between class and structure?

 

 

 

 

---------------------*********************---------------------------

 

Physics

 

Coulomb’s law, Superposition principal & Continuous charge distribution

Q.N.1- Two equal balls having equal positive charge q coulombs are suspended by strings of equal length experience a force of 8N in air. What would be the effect on the force when they are held in water?                                                                                                                                                                

Q.N.2- Is the force acting between two point electric charges q1 and q2 kept at some distance apart in air, attractive  or  repulsive when (i) q1 q2> 0 (ii) q1 q2< 0 ?                                               

Q.N.3- Two insulated charged copper spheres A and B of identical size have charges respectively. A Third sphere C of the same size but uncharged is brought in contact with the first and then in contact with second and finally removed. What are the new charges on A and B?                                                                 

Q.N.4- Calculate the Coulomb force between two  - particles separated by a distance of 3.2 X 10-15m in air.                                                                                                                                                       

Q.N.5- A point charge +Q is placed at the centre O of an uncharged hollow spherical conductor of inner radius ‘a’ and outer radius ‘b’. Find the magnitude and sign of the charge induced on the inner and outer surface of the conducting shell.

 

Q.N.6- Two similarly and equally charged identical metal spheres A and B repel each other with a force of