Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Time: 3Hrs
Max Marks: 70
GENERAL INSTRUCTIONS:
1. All questions are compulsory
2. Programming Language : C++
1. (a) Differentiate between call by value and call by reference with suitable example.
(2)
(b) Which C++ header files are required for the following program code to execute?
(Note: do not include any header file which are not required)
(1)
void main()
{
cout<<Square root of 625 is: <<sqrt(625);
}
(c) Rewrite the following program after removing the syntax errors. Underline each
correction.
(2)
#include<iostream.h>
#include<conio.h>
class Exam
{
char NameOfExam[20];
int Year;
public
void getexamdetails( )
{
cout<<"Enter name of the exam: ";
gets(NameOfExam);
cout<<"Enter year of exam: ";
cin>>Year ;
}
void showexamdetails( )
{
cout<<NameOfExam<<"\n<<Year;
1
}
}
void main( )
{
Exam E1;
getexamdetails( );
showexamdetails( );
}
(d) Observe the following C++ code carefully and write output.
(2)
#include<iostream.h>
#include<string.h>
int main( )
{
char *STR="AeroDynamics";
int A=1;
STR+=3;
while(A<9)
{
cout<<*STR<<strlen(STR)<<"\n";
STR++;
A=A+2;
}
return 0;
}
(e) Write output for the following program.
(3)
#include<iostream.h>
#include<conio.h>
struct ITEM
{
Int ICode,Qty;
};
void assigndetail( ITEM & I, int Q=5)
{
I.ICode++;
I.Qty*=Q;
}
void main()
{
clrscr();
2
ITEM T={200,25};
assigndetail(T,10);
cout<<T.ICode<<":"<<T.Qty<<"\n";
assigndetail(T);
cout<<T.ICode<<":"<<T.Qty<<"\n";
assigndetail(T,6);
cout<<T.ICode<<":"<<T.Qty<<"\n";
getch();
}
(f) Study the following program carefully and select the option which is NOT a possible
output.
(2)
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
const int VALUE=15;
int main( )
{
clrscr();
int INCR=5;
randomize();
for(int i=1;i<5;i++)
{
int bid=VALUE+random(INCR);
cout<<bid<<":";
INCR+=2;
}
getch();
return 0;
}
(i)
(ii)
(iii)
(iv)
16:19:22:25:
19:16:15:24:
15:18:20:16:
18:22:23:19:
(2)
int Hrs,Min,Sec;
public:
TIME(){Hrs=Min=Sec=0;}
TIME(int H,int M,int S)
{
Hrs=H;
Min=M;
Sec=S;
}
TIME(TIME & T);
//Function 1
//Function 2
//Function 3
~TIME(){ }
};
(i)
(ii)
//Function 4
(1)
(1)
(4)
Public members:
(d) Answer the questions (i) to (iv) based on the following code.
class COMPANY
{
char Location[20];
double Budget, Income;
protected:
void Accounts();
4
(4)
public:
COMPANY();
void Register();
void Show();
};
class FACTORY: public COMPANY
{
char Location[20];
int Workers;
protected:
double salary;
void Compute();
public:
FACTORY();
void Enter( );
void Show( );
};
class SHOP: private COMPANY
{
char Location[20];
float Area;
double Sale;
public:
SHOP( );
void Input( );
void Output( );
};
(i)
(ii)
(iii)
(iv)
class FACTORY
Write the names of all the members , which are accessible from the objects of
class SHOP.
3. (a) Write a function voidmodifylist( int A[], int Size) in C++ , which modifies the
elements present in an array in such a way that the elements, which are multiples of
7 swap with the value present in the very next position in the array.
(3)
For example:
If the content of the array A is
42, 12, 57, 63, 25, 78
The content of the array should become
12, 42, 57, 25, 63, 78
(b) An array S[30][20] is stored in the memory along the row with each of the element
occupying 2 bytes .find out the memory location for the element S[15][10] , if the base
address of the array is 3200.
(3)
(c) Write a function void showabove(int A[4][4], int R, int C)to display all the elements
above the Right Diagonal in a 2D array.
(2)
(d) Evaluate the following postfix stack notation of expression:
6,7,+,4,*,32,-,5,/
(e) Write a function in C++ to perform insertion operation in a circular queue.
(2)
(4)
4. (a) Observe the program code given below and fill in the blanks marked as
Statement1 and Statement2 using seekg() and tellg() functions for performing the
required task:
(1)
#include<fstream.h>
class Movie
{
char moviename[25];
char actorname[25];
public:
int count(); // A function to count no.of records
};
int Movie:: count()
{
fstream file;
file.open(Movie.DAT,ios::binary| ios::in);
.. //Statement1
intTotalbytes= .. //Statement2
int number_of_records=Totalbytes / sizeof(Movie);
file.close();
6
return number_of_records;
}
(b) Write a function in C++ to count the number of lowercase alphabets present in a text
file BOOK.TXT.
(2)
(c) Assume the class STUDENT as declared below
class STUDENT
{
char name[20];
int std;
char schoolname[20];
int age;
public:
void register();
void show();
int get_std();//returns std;
};
Write a function BACKUP() in C++, that would copy only those records having std
as12 from STUDENT.DAT to STUDENTBACK.DAT.
(3)
5. (a) What do you understand by degree and cardinality of a table?
(2)
(b) Consider the following tables WORKER and PAYLEVEL and answer questions (1) and
(2)
Table: WORKER
ECODE
11
12
13
14
15
NAME
VinayKatiyar
Ritesh
Abhinav
Dharaneedhar
Manoj
DESIGNATION
Supervisor
Operator
Operator
Mechanic
Clerk
PLEVEL
P001
P003
P003
P002
P002
DOJ
13-Sep-2004
22-Feb-2006
14-May-2009
21-Apr-2008
22-Dec-2009
DOB
23-Aug-1981
12-July-1987
14-Oct-1983
21-Nov-1985
24-Jun-1984
Table: PAYLEVEL
PLEVEL
P001
P002
P003
1)
PAY
26000
24000
18000
ALLOWANCE
12000
10000
6000
(ii) To display NAME and DESIGNATION of those Workers whose PLEVEL is either
P001 or P002.
(iii) To display details of all Workers whose DOB is between 10-Mar-1984 and 31Dec-1986.
(iv) To add a new row with following values:
16, Ketan, Clerk, P002, 14-Feb-2007, 25-Jan-1984
2)
Q
0
0
1
1
0
0
1
1
R
0
1
0
1
0
1
0
1
G
0
0
1
0
1
0
1
0
7. (a) Differentiate between Bus and Star topology with a neat diagram.
(b)
Expand the following:
(2)
(i) GSM
(ii) CDMA
(iii) WLL
(iv) SMTP
(2)
(c)
Knowledge Supplement Organization has set up its new centre at Mangalore
for its office and web based activities. It has four buildings Alpha, Beta, Gamma,
Lambda. Answers questions
(i)to (iv) based on data given.
Center to center distance between various buildings
Number of Computers
Alpha to Beta
50m
Alpha
25
Beta to Gamma
150m
Beta
50
Gamma to Lambda
25m
Gamma
125
Alpha to Lambda
170m
Lambda
10
Beta to Lambda
125m
Alpha to Gamma
90m
(d)
(e)
i)
ii)
Suggest the most suitable place (i.e. building) to house the server of this
organization with a suitable reason.
(1)
iii)
iv)
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?
(1)
Give any two examples for Open Source Software.
(1)
What is cloud computing?
(1)
9
(1)
**************
10