Académique Documents
Professionnel Documents
Culture Documents
Max. Marks
70
Note
1. All question are Compulsory
2. Programming Language C++
1 Answer the following
A Name the header file of c++ which following function belongs
i) clrscr()
ii gets()
iii toupper()
iv isdigit()
B What is the difference between local and global variables ? Give the Examples
of both
C Rewrite the following program after removing all syntax errors if any
#include(iostream.h)
Void main();
{
int X[]=60,50,30,40},Y=0;count=4;
cin>>Y;
for(i=count-1;i>=0,i--)
switch(i)
{
case 0 :
case 2: cout<<Y*X[i]<<endl;
break;
case 1 :
case 3 : cout>> Y+X[i];
}
}
D Write the output of the following program
void main()
{
int x=5;int y=5;
cout<<x--;
cout<<,;
cout<< --x;
cout<<,;
cout<<y--<<,<< --y;
}
E. Explain Nested Structure with Example
F. Will the syntax error if any (Give the reason for error)
Class ABC
{
int x=10;
float y;
abc()
{ y=5;}
~( )
{}
2
2
2
2
void main()
{
ABC a1,a2;
}
2 Answer the following
A Explain Protected, Private and public members of a class in context of inhertence
B Answer the following question i and ii after going through the following class
2
class Exam
{
int marks;
char subject[20];
public :
Exam()
//Function 1
{ marks=0;strcpy(subject,Computer);}
Exam(char s[])
//Function 2
{ marks=0;strcpy(subject,s);}
Exam(int m)
//Function 3
{ marks=m;strcpy(subject,Computer);}
Exam(int m, char s[])
//Function 4
{ marks=m;strcpy(subject,s);}
}
i Write a statement in C++ that would execute functions 3 and function 4 of class Exam
ii Which features ogf object oriented programming is demonstrated using function 1 function 2
function 3 and function 4 in the above class.
C Define a class travel in c++ with the following descriptions
4
Private members
Travel code
of type long
Place
of type character array
No_of_travellers
of type integer
No_of_buses
of type integer
Public members
Aconstructor to assign initial values of travel code as 201, place as Nanital ,no_of_travellers as
10 no_of buses as 1A function newtravel() which allow user to enter travel code place and no_of
travelers also assign a value of no_of_buses as per the following condition
No of traveler
no of buses
Less than 20
1
Equal to 20 or less than 40
2
Equal to 40 o more than 40
3
A function show_travel() to display the content from all the data members on screen.
D. Explain polymorphism with suitable example?
4
Write a Function in C++ to print the sum of all four corners of a two
dimensional array.
[Assuming the 2D Array to be a square matrix with odd dimension
3
i.e. 33, 55, 77 etc...]
Example, if the array content is
3
5
4
7
6
9
2
1
8
Output through the function should be :
The sum of corner is 3+4+2+8= 17
A
B An Array MAT[30][10] is to stored in memory column wise with each elements occupying 8
bytes of memory. Find out the base address and the address of element MAT[20][5], if the
location of MAT[5][7] is stored at address 1000.
4
C Write a Function in UPPER HALF() which takes a two dimensional array A with size N rows
and N columns as argument and point the upper half of the array.
2
The Array is
3 4 2 5 5
2 1 2 3 4
2 1 2 3 3
4 2 1 2 1
1 2 4 7 1
The output is
3 4 2 5
1 2 3
2 3
2
5
4
3
1
1
D Write a function to perform a PUSH Operation on a dynamically allocated stack containing real
number?
3
E Evaluate the expression 562+*124/- in tabular form showing stack after every step
2
4 Answer the following
A Assuming that a text file named First.TXT contains some text written into it, write a function
named vowel words(), that reads the first.txt and create a new file named second.txt to contain
only those words from the file First.txt which start with a lowercase vowel(i.e. a,e,I,o,u) For
example
3
Carry umbrella and overcoat when it rains
Then the file second.txt contains
Umbrella and overcoat it
B Write a function to open a files in read and write mode
1
C Write a c++ function copies all the lowercase letters in text file called mytext.txt into file called
lower.txt
2
Book_name
Fast cook
Author_name
Lata kapoor
Publishers
EPB
Price
365
Type
Cookery
Qty
5
F0001
The Tears
T0001
My First C+
+
C++
Brainworks
Thunderbolts Anna Roberts
T0002
F0002
William
Hopkins
Brain
&Brooke
A.W.Rossaine
First Pub
650
Fiction
20
EPB
350
Text
10
TDH
350
Text
15
First Pub
750
Fiction
50
Table ISSUED
Book_ID
T0001
C0001
F0001
Quantity_Issued
4
5
2
Build 1 to build 2
Build 2 to build 3
Build 3 to build 4
Build 1 to build 4
Build 2 to build 4
Build 1 to build 3
50 m
150 m
25 m
170m
125 m
90 m
25
50
125
10
Build1
Build2
Build 3
Build 4
1
1
Max. Marks
70
Note
2
1
#include<iostream.h>
#include<conio.h>
#include<string.h>
void strfunc(Char *str)
{
Int I,j,len:
len=strlen(str);
for (i=0;i<len;i++)
{
for (j=0;j<=I;j++)
{
cout<<str[j];
cout<<endl;
}
}
}
void main()
{
Strufunc(Delhi);
}
E Write a program to accept an integer number print the reverse of the number on
Screen (Note if number enter by user Iis 3456 the result is 6543)
F Given that
for( k=10;k<15;k++)
{
if (k<=12)
cout<<twice k=<<2*k<<endl<<endl;
else
cout<<k=<<k<<endl;
}
>=1000
<1000&>=500
<500
For each Kid the above Fare will be 50% of the Fare mentioned in the
above table
For example :
If Kilometres is 850, NoofAdults = 2 and No.of Kids = 3
Then TotalFare should be calculated as
NumofAdults * 300 + NoofKids * 150
i.e. 2*300 + 3*150=1050
A function EnterTour( ) to input the values of the data members
TCode, No. ofAdults, No.of Kids and Kilometres; and invoke the
Assign Fare( ) function.
2, -, 1, 14, -, 1, 2, *, +, -, )
the Following
B Write a C++ program which reads one line at a time from the disk file Test.txt, and display it to
a monitor. Your program has to read al the contents of the file . assume the length of the line not
to exceed 80 characters. You have to include all the header file if required.
2
C Assuming a binary file FUN.DAT is containing objects belonging to class Laughter. Write a user
defined function in C++ to add more objects belonging to class Laughter at the
bottom of it
Class Laughter
{
int idno;
char type[5];
char desc[255];
public :
void Newentry()
{
cin>>idno;
gets(type);
gets(desc);
}
Void showonscreen()
{
cout<<idno<<,<<type<<endl;
cout<<desc<<endl;
}
};
Q 5 Answer
the Following
. A. Explain primary key and Candidate key?
2
Write SQL commands for b to e and write the output for f on the basis of the given
table.
Supp#
S1
S2
S3
S4
S5
SuppName
Britannia
Mother
Dairy
Nirulas
Haldiram
Bikaner
Table: Supplier
Status
City
C
Delhi
C
Mumbai
L
L
L
Delhi
Bangalore
Jaipur
Qtysupp
10
20
Item#
12
13
20
40
30
16
14
14
2
3
1
4
Approximate distances between these offices as per network survey team
is
as follows:
Place From
Place To
Distance
BackOffice
Front Office
10KM
Back Office
Work Office
70 Meter
Back Office
East Office
1291 KM
BackOffice
West Office
790 KM
Back Office
South Office
1952 KM
100
20
50
50
50
50
(i) Suggest network type (out of LAN, MAN, WAN) for connecting each
1
of the following set of their offices :
Back Office and Work Office
Back Office and South Office
(ii) Which device you will suggest to be procured by the company for
1
connecting all the computers with in each of their offices out of the
following devices?
Switch/Hub
Modem
Telephone
(iii) Which of the following communication medium, you will suggest to
be
procured by the company for connecting their local offices in New
Delhi for very effective and fast communication?
1
Telephone Cable
Optical Fiber
Ethernet Cable
(iv) Suggest a cable/wiring layout for connecting the companys 1
local offices located in New Delhi. Also, suggest an effective method/
technology for connecting the companys regional offices-East Office,
West Office and South Office with offices located in New Delhi.