Professional Documents
Culture Documents
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 2
i) clrscr() ii gets() iii toupper() iv isdigit()
B What is the difference between local and global variables ? Give the Examples
of both 2
C Rewrite the following program after removing all syntax errors if any 2
#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 2
void main()
{
int x=5;int y=5;
cout<<x--;
cout<<”,”;
cout<< --x;
cout<<”,”;
cout<<y--<<”,”<< --y;
}
E. Explain Nested Structure with Example 2
F. Will the syntax error if any (Give the reason for error) 2
Class ABC
{
int x=10;
float y;
abc()
{ y=5;}
~( )
{}
void main()
{
ABC a1,a2;
}
2 Answer the following
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
The output is
3 4 2 5 5
1 2 3 4
2 3 3
2 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
Table ISSUED
Book_ID Quantity_Issued
T0001 4
C0001 5
F0001 2
Write Sql Queries from i to vi
i. to show book name,author name and price of books of first pub publisher 1
ii to list the names from books of text type. 1
iii to display the names and price from books in asending order of their prices 1
iv to increase the price of all books of EPB publisher by 50
v to display book_id,book_name and quantity_issued for all books which have been
issued(the query will require contents from both tables)
vi to insert new row in the table issued having the following data “F0003, 1 1
vii Give the output of the following
a) Select count(*) from books;
b) Selectmax(price) from books where quantity >=15;
c) Select count(distinct publishers) from books;
Build 1 to build 2 50 m
Build 2 to build 3 150 m
Build 3 to build 4 25 m
Build 1 to build 4 170m
Build 2 to build 4 125 m
Build 1 to build 3 90 m
Build1 25
Build 2 50
Build 3 125
Build 4 10
Build1 Build 4
Build 3 Build2