Following C++ Code: (1) (Compartment-2008)
Following C++ Code: (1) (Compartment-2008)
Q.3. (a) Write a function in C++, Which accepts an integer array and its size as
arguments/parameters and then assigns the elements into a two dimensional array of integers
in the following format: (3) [Delhi Board-2006]
If the array is 1,2,3,4,5,6 if the array is 1,2,3
The resultant 2D array is given below The resultant 2D array is given below
1 2 3 4 5 6 1 2 3
1 2 3 4 5 0 1 2 0
1 2 3 4 0 0 1 0 0
1 2 3 0 0 0
1 2 0 0 0 0
1 0 0 0 0 0
(b) Write a function in C++ to which accepts a 2D array of integers and its size as
arguments and displays the elements of middle row and elements of middle column.
[Assuming the 2D array to be square matrix with odd dimension i.e. 3x3, 5x5, 7x7 etc....]
Example :- If the array content is (2)
3 5 4
7 6 9
2 1 8
Output through the function should be :
Middle Row : 7 6 9
Middle Column : 5 6 1 [Out Side Delhi-2007]
(c) An array X[20][10] is stored in the memory with each of the elements requiring 8 bytes
of storage. if the base address of X is 6000, determine memory location of X[16][16] and
X[10][2] , if the array is stored along the Column. (3) [Compartment-2003]
(d) Write a function QUEDEL( ) in C++ to display and delete an element from dynamically
allocated Queue containing nodes of the following given structure: (4)
struct NODE
{
int Itemno ;
char Itemname [20] ;
NODE *Link;
} ; [Out Side Delhi-2009]
(e) Evaluate the following postfix expression showing status of stack after execution of each
step : (2) [Compartment-2000]
10, 40, +, 8, 2, +, *, 10 , -
Q.4. (a) Polina Raj has used a text editing software to type some text in an article. After
saving the article as MYNOTES.TXT, she realised that she has wrongly typed alphabet K
in place of alphabet C everywhere in the article. Write a function definition for
PURETEXT() in C++ that would display the corrected version of the entire article of the
file MYNOTES.TXT with all the alphabets “K” to be displayed as an alphabet “C” on screen
Note: Assuming that MYNOTES.TXT does not contain any C alphabet otherwise.
Example:
If Polina has stored the following content in the file MYNOTES.TXT: (3)
I OWN A KUTE LITTLE KAR. I KARE FOR IT AS MY KHILD.
The function PURETEXT() should display the following content:
I OWN A CUTE LITTLE CAR. I CARE FOR IT AS MY CHILD.
[Out Side Delhi-2017]
(b) Write a definition for function COUNTPICS ( ) in C++ to read each object of a binary
file PHOTOS.DAT, find and display the total number of PHOTOS of type PORTRAIT.
Assume that the file PHOTOS.DAT is created with the help of objects of class PHOTOS,
which is defined below: 2 [Out Side Delhi-2017]
class PHOTOS
{
int PCODE;
char PTYPE[20]; // Photo Type as “PORTRAIT”,”NATURE”
public:
void ENTER()
{
cin>>PCODE;gets(PTYPE);
}
void SHOWCASE()
{
cout<<PCODE<<":"<<PTYPE<<endl;
}
char *GETPTYPE(){return PTYPE;}
};
(c) Fill in the blanks marked as Statement 1 and Statement 2, in the program
segment given below with appropriate functions for the required task. 1
class Medical
{
int RNo; //Representative Code
char Name [20]; //Representative Name
char Mobile [12]; //RepresentativeMobile
public:
void Input(); //Function to enter all details
void Show(); //Function to display all details
int RRno(){return RNo;}
void ChangeMobile() //Function to change Mobile
{
cout<< "Changed Mobile:";
gets(Mobile); .
}
} ;
void RepUpdate ()
{
fstream F;
F.open("REP.DAT",ios::binary|ios::in|ios::out};
int Change=0;
int URno;
cout<<"Rno(Rep No-to update Mobile):";
cin>>URno;
Medical M;
while(!Change && F.read((char*)&M,sizeof(M)))
{ if(M.Rrno()==URno)
{
//Statement l:To call the function to change Mobile No.
_________________________________ ;
//Statement 2:To reposition file pointer to re-write
//the updated object back in the file
_________________________________ ;
F.write((char*)&M,sizeof(M));
Change++ ;
}
}
if (Change)
cout<<"Mobile Changed for Rep "<<URno«endl;
else .
cout<<"Rep not in the Medical"<<endl;
F.close () ;
} [Delhi Board-2014]
Q.5. (a) Observe the following table CANDIDATE carefully and write the name of the
RDBMS operation out of
(i) SELECTION (ii) PROJECTION (iii) UNION (iv) CARTESIAN PRODUCT,
which has been used to produce the output as shown in RESULT ? Also, find the Degree
and Cardinality of the RESULT.
TABLE: CANDIDATE (2) [Delhi Board-2017]
NO NAME STREAM
C1 AJAY LAW
C2 ADITI MEDICAL
C3 ROHAN EDUCATION
C4 RISHAB ENGINEERING
TABLE RESULT
NO NAME
C3 ROHAN
(b) Consider following tables FLIGHTS and FARES and Write SQL commands for
statements (i) to (iv) and give output for SQL queires (v) to (vi) : (6)
Table :STAFF
FL_NO STARTING ENDING NO_FLIGHT NO_STOPS
IC301 MUMBAI DELHI 8 0
IC799 BANGLORE DELHI 2 1
MC101 INDORE MUMBAI 3 0
IC302 DELHI MUMBAI 8 0
AM812 KANPUR BANGLORE 3 1
IC899 MUMBAI KOCHI 1 4
AM501 DELHI TRIVENDURUM 1 5
MU499 MUMBAI MADRAS 3 3
IC701 DELHI AHMEDABAD 4 0
Table:FARE
FL_NO AIRLINES FARE TAX
IC701 Indian Airlines 6500 10
MU499 sahara 9400 5
AM501 Jet Airways 13450 8
IC899 Indian Airlines 8300 4
IC302 Indian Airlines 4300 10
IC799 Indian Airlines 10500 10
MC101 Deccan Airlines 3500 4
(i) Display FL_NO AND NO_FLIGHTS from “KANPUR” to ”BANGLORE” from the
table FLIGHTS.
(ii) Arrange the contents of the table FK=LIGHT in the ascending
(iii) Display the FL_NO and Fare to be paid for the flight from DELHI to MUMBAI using
the table FLIGHTS and FARE, where the fare to be paid = FARE + FARE * TAX%/100
(iv) Display the minimum fare “Indian Airlines” is offering from the table FARE.
(v) SELECT FL_NO,NO_FLIGHTS,AIRLINES from FLIGHTS, FARE where
STARTING =”DELHI” and FLIGHT.FL_NO=FARE.FL_NO;
(vi) SELECT count(Distinct ENDING) from FLIGHTS; [Out Side Delhi-2006]
Q.6. (a) State De Morgan's law. Verify one of the De Morgan's Law using truth table. (2)
[Out Side Delhi-2000]
(b) Write the equivalent Boolean expression for the following Logic Circuit: (2)
Q.7. (a) Damodar Mohan has been informed that there had been a backdoor entry to his
company, which has provided access to his system through a malicious user/programs,
allowing confidential and personal information to be subjected to theft, it happened
because he clicked a link provided in one of the pop-ups frm a website announcing him to
be winner of price worth 1 Million Dollers. Which of the following has caused this out of
the following? 2
i) Virus ii) Worm iii) Trojan Hourse
Also, mention , what he should do to prevent this infection. [Out Side Delhi-2019]
(c) Select two server side scripting languages out of the following ? 1[Compartment-2019]
(i) ASP (ii) VBScript (iii) JavaScript (iv) PHP
(d) Write the expanded names for the following abbreviated terms used in Networkingand
Communications: 2 [Question Bank-2018]
(i) FOSS (ii)GPRS (iii)GSM (iv) WLL
(e) Indian School, in Mumbai is starting up the network between its different wings. There
are Four Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below.: [4]
[Question Bank-2015]