. 1. Differentiate
between dynamic and static allocation. Which are the operators used in dynamic
allocation. Give example
2.
Write
a program to swap two numbers by passing pointers.
3.
Predict
the output:
#include<iostream.h>
int main( )
{
int
x[]={10,25,30,55,110}
int *p=x;
while(*p<110)
{
if(*p%3!=0)
*p=*p+2
else
*p=*p+1;
p++;
}
for(int
i=4;i>=1;i--)
{
cout<<x[i]<<”*”;
if(i%3==0) cout<<endl;
}
cout<<x[0]*3<<endl;
return 0;
}
4.
What
is the difference between constant pointer and pointer to a constant. Also spot
errors in the following code and give reasons for errors.
void main( )
{
const int i=20;
const int * const
ptr=&i;
*ptr++;
int j=15;
ptr=&j;
}
DATE OF SUBMISSION: 05/08/2017
1.
Write
a function colsum( ) in C++ to find the
sum of each column of a 2D array with r rows and c columns.
2.
Write
a function in C++ to perform binary search on an array. Assume the array is
sorted in ascending order and passed as an argument to the function.
3.
Write
a function in C++ that performs bubble sort on an array of elements that is
passed as an argument to the function.
DATE OF SUBMISSION: 25/07/2017
1 a. What do you understand about a member function? How does a member function differ from an ordinary function. Explain with example ?
1 b. Define a class Student for the following specifications.
Private members of the Student are:
roll_no integer
name array of characters of size 20
class_st array of characters of size 8
marks array of integers of size 5,
Percentage float
Calculate( ) that calculates overall percentage marks and returns the percentage
Public Members of the Student are:
Readmarks reads mark and invoke thecalculate function
Displaymarks prints the data.
2.a) Differentiate between Constructor and Destructor function in context of Classes
and Objects Using C++? Explain with example
2.b) Answer the questions (i) and (ii) after going through the following program:
#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 thecorrection(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).
2.c) Define a class Tour in C++ with the description given below.
Private Members:
TCode of type string
No of Adults of type integer
No of Kids of type integer
Kilometers of type integer
TotalFare of type float
Public Members:
• A constructor to assign initial values as follows:
TCode with the word “NULL”
No of Adults as 0
No of Kids as 0
Kilometers as 0
TotalFare as 0
• A function AssignFare() whichcalculates and assigns the value of the data member Totalfare as follows For each Adult
Fare(Rs) For Kilometers
500 >=1000
300 <1000 & >=500
200 <500
For each Kid the above Fare will be 50% of the Fare mentioned in the above table
For Example: If Kilometers is 850, Noofadults =2 and NoofKids =3 Then TotalFare should be calculated as Numof Adults *300+ NoofKids *150 i.e., 2*300+ 3 *150 =1050
• A function EnterTour() to input the values of the data members TCode, NoofAdults, NoofKids and Kilometers ; and invoke the AssignFare() function.
• A function ShowTour() which displays the content of all the data members for a Tour.
DATE OF SUBMISSION: 15/07/2017
1. Answer the following questions (i) and (ii) after going through the following class.
class Interview
{
int Month;
public:
interview(int y) {Month=y;}
//constructor 1
interview(Interview&t);
//constructor 2
};
(i) create an object, such that it invokes Constructor 1 .
(ii) create an object, such that it invokes Constructor 2 .
(iii) write complete definition for Constructer 1
(iv) write complete definition for constructor 2.
2 . What is member initialisation. Explain with example. 2
3 . What happens when copy constructor is called by value 2
4 . What is constructor overloading ? Explain with example? 3
DATE OF SUBMISSION: 05/07/2017
Students who scored below 25 please answer the question paper and submit by 5.07.2017
The question paper is given below:
1. a) Expand the following terminologies :
i) PHP
ii) SMSC
b) What is infrared technology?
c) What is proprietary software?.
d) What is Web Hosting?
e)
Difference
between cracker and hacker.
f) Indian Industries has the
following four buildings in Chennai.
Distance between various
wings are given below:
Wing II1 to Wing II 3
|
70m
|
Wing II1 to Wing II 2
|
20m
|
Wing II 1 to Wing II 4
|
115m
|
Wing II 3 to Wing II 4
|
30m
|
Wing II 2 to Wing II3
|
25m
|
Number of Computers
Wing II 1
|
35
|
Wing II 2
|
25
|
Wing II 3
|
80
|
Wing II 4
|
60
|
i.
Suggest suitable CABLE LAYOUTS
FOR THESE BUILDINGS.
ii. Name the wing where the Server is to be installed. Justify your
answer.
iii. Suggest the placement of Hub/Switch in the network.
iv. Mention an economic technology to provide Internet accessibility to
all wings.
2. a) What is the significance of Cyber Law
b) Explain Intellectual Property
c) Expand the following terms with respect
to Networking.
i).
CDMA
ii).
GSM
iii).
SLIP
iv).
IMAP
d)
What is W3C ?
e) Compare Open Source Software & Proprietary
Software f) Difference between hub and
switch
g) PNC Private Ltd. Has four branches in
Udaipur city named as “Head Office” , “Marketing
Office” , “Clearance Office” and “Service
Office”. PNC Company wants to
establish the networking between all
the four offices.
Approximate
distances between these offices as per network survey team are as follows:
Place From
|
Place To
|
Distance
|
Head Office
|
Marketing Office
|
20 m
|
Marketing Office
|
Clearance Office
|
200 m
|
Clearance Office
|
Service Office
|
40 m
|
Head Office
|
Service Office
|
270 m
|
Marketing Office
|
Service Office
|
80 m
|
Head Office
|
Clearance Office
|
90 m
|
In
continuation of the above, the company experts have planned to install the
following
number
of computers in each of their offices:
Head Office
|
20
|
Marketing
Office
|
100
|
Clearance
Office
|
40
|
Service
Office
|
60
|
i).
Suggest cable layout(s) for connecting
the offices.
ii).
Marketing office is used for many
critical operations. It is tried that each PC
gets maximum possible bandwidth. Which network
device should be used for this?
iii).
Where would you suggest the placement of
server?
iv).
The company also has another office out
of city but at a distant location about
50-55
km away. How can link be established with this office ( i.e. suggest the
transmission medium)?
3. Write individual C++ program to do the
following Check for Prime number:
(a)
Reverse a number
and check whether the reversed number is prime or not.
(b)
Reverse a 1 D
integer Array and find the sum of all elements.
(c)
Swapping the first
half with the second half in a 1D integer array and sort it in ascending order.
DATE OF SUBMISSION: 28/06/2017
1.Which are the different types of OS
2. Differentiate application software and system software
3. List out few input output devices.
4. Give examples for language processors
____________________________________________________________________
DATE OF SUBMISSION: 18/06/2017
Write a paragraph on Computers in our daily life