Documente Academic
Documente Profesional
Documente Cultură
void output()
{ cout<<admno<<marks;
}
}; // error – semi-colon is missing
void main()
{
STUDENT S;
S.Input(); //error – object missing for calling function
}
ANSWER-2
(a) A static data member is known as class variable or global variable for its class. This
data member value is shared by all objects of that class. When a data member is
declared as static, only one copy of the data is maintained for all objects of the class.
Characteristics: 2
Declared inside but defined outside the class
Can be access without object
Example:
class x
{
static int count;
};
int x ::count=10;
class Travel 4
{
long plancode;
char place[30];
int no_of_travellers;
int no_of_buses;
public:
Travel();
void show();
void newplan();
};
Travel::Travel()
{
plancode=1001;
strcpy(place,"Kolkata");
no_of_travellers=5;
void Travel::show()
{
cout<<"\n Plan Code :"<<plancode;
cout<<"\n Place :"<<place;
cout<<"\n No. of Travellers :"<<no_of_travellers;
cout<<"\n No. of Buses :"<<no_of_buses;
}
void Travel::newplan()
{
cin>>plancode;
gets(place);
cin>>no_of_travellers;
if(no_of_travellers>=40)
no_of_buses=4;
else if(no_of_travellers>=20)
no_of_buses=3;
else
no_of_buses=2;
}
½ mark for header files
½ mark for class declaration
1½ mark for newplan() function
½ mark for show() function
1 mark for constructor
(d) (i) Object of HealthClub will require 116 bytes
Object of MohanClub will require 94 bytes
(ii) Data members accessed by the HealthClub 4
Player_Name[30] , Player_Address[20], fees
Facility, F_Name[20]
(iii) Members accessed by the MohanClub
Data Members:
Player_Name[30] , Player_Address[20], fees
Member functions:
EnterClubDetails( ), ShowClubDetails( )
EnterDetails( ), ShowDetails ( )
(iv) Members which are accessible by object of HealthClub
EnterHClubDetails( )
showHClubDetails( )
EnterClubDetails( ), ShowClubDetails( )
EnterDetails( ), ShowDetails ( )
Result: 40
ANSWER-4
(a) No, *p++ and ++*p are not same statements
*p++ means first use its value of (*p) and then increment p i.e. p =p+1
++*p means first increment value of (*p) and then use its value 1
Example:
int x[]={ 10, 20};
int y= *p++;
int z =++*p;
Value of y will be 10
Value of z will be 21
for(int i=0;i<N;i++)
sumcol +=A[M/2][i];
for(int j=0;j<M;j++)
sumcol +=A[j][N/2];
}
1 mark for correct function prototype
1 mark for computing middle row sum
1 mark for computing middle column sum
ANSWER-5
(a) Overloading: The methods with the same name but it differ by types of
guments and number of arguments.
Overriding: The methods with the same name and same number of arguments and
types but one is in base class and second is in derived class.
OR
2
In overloading, there is a relation ship between methods available in the same class
where as in Over-ridding; there is relationship between a Base class method and
Derived class method.
Overloading doesn't block inheritance from the Base class where as overridding
blocks inheritance.
In overloading, multipe methods share the same name where as in overridding, Base
class methods are redefined in the Derived class.
Overloading must have different method signatures where as overriding must have
same signature.
(b) Suppose you have two derived classes B and C that have a common base class A,
and you also have another class D that inherits from B and C. You can declare the
base class A as virtual to ensure that B and C share the same subobject of A.
2
In the following example, an object of class D has two distinct subobjects of class L,
For example:
void Queue::DELETE()
{
if(front==NULL)
{
cout<<"\n Queue underflows";
return;
DPS/Ruby Park/Computer Science Page 8 of 10 Block
Test/September/2010
}
Node *ptr=front;
cout<<"\n value removed"
<<ptr->Tno <<"\t"<<ptr->Tname<<endl;
front=front->Link;
delete ptr;
}
2 mark for each function
ANSWER-6
(a) In Packet switching the packetss are stored and forwarded from primary storage
(RAM) while in Message switching the message are stored and relayed from
seconadary storage (disk). 1
In Packet switched network data are transmitted in discrete units of potentially
variable length blocks called packets, while in Message switching mecahnism a
node recives a message stores it untill the apporiarate route is free, then sends it
along.
Message switching sends data units that can be of any length. Packet switching
has a maximum packet size. Any message longer than that is split up into
multiple packets.
(b) Bandwidth: It is the range of frequencies that is available for the transmission of
data. For analog signal, bandwidth is expressed in Hertz (Hz) KHz, MHz, GHz
etc. For digital signals, bandwidth is expressed in terms of bits per second (bps). 1
It is the difference between the lowest and the highest frequencies transmitted.
For e.g. Cellular phones operate within the range 800-900 megahertz i.e. their
bandwidth is 100 MHz.
(c) Cookies:
A data file written to a hard drive by some Web sites, contains information
the site can use to track such things as passwords, login, registration or
identification, user preferences, online shopping cart information, and lists 2
of pages visited.
Trojan Horse:
Program that appears legitimate, but performs some illicit activity when it is
run. It may be used to locate password information or make the system
more vulnerable to future entry or simply destroy programs or data on the
hard disk. A Trojan is similar to a virus, except that it does not replicate
itself. It stays in the computer doing its damage or allowing somebody from
a remote site to take control of the computer. Trojans often sneak in attached
to a free game or other utility
(d) Advantages:
Ease of service: easy to configure and extend network because of centralized 2
network One device per connection: failure of individual node does not affect
the other nodes Centralized Control/Problem diagnosis: failure of Network
means failure of centralized hub or node. Simple access protocol: connection
DPS/Ruby Park/Computer Science Page 9 of 10 Block
Test/September/2010
between the central node/Hub and node.
Disadvantages:
Long cable length: each node is directly connected to the center Difficult to
expand: fixed number of connections/nodes per hub can be supported. Central
node dependency: if the central node fails, the entire network is rendered
inoperable.
ANSWER-7
(a) Firewall
A system designed to prevent unauthorized access to or from a private network.
Firewalls can be implemented in both hardware and software, or a combination of
both. Firewalls are frequently used to prevent unauthorized Internet users from 2
accessing private networks connected to the Internet, especially intranets. All
messages entering or leaving the intranet pass through the firewall, which examines
each message and blocks those that do not meet the specified security criteria.
Gateway
A network layer device Connects multiple networks/LANs of different protocol
Used as Proxy Server, Firewall It is the entrance node that connects a network to
other networks