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

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

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

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;

}

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

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

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?

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.

Physics

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