Write Instructions Here. Write The Question Here Mark S 1 - A - 2 B 1 C 2
Write Instructions Here. Write The Question Here Mark S 1 - A - 2 B 1 C 2
Write Instructions Here. Write The Question Here Mark S 1 - A - 2 B 1 C 2
TIME : 03.00
CLASS – XII – COMP.SC M.M.: 70
HRS
Write Instructions here.
d )#include<iostream.h> 2
int recs(int);
void main(0
{
clrscr();
int r;
for(int i=0;i<5;i++)
{
r=recs(i);
cout<<”\n”<<i<<”\t”<<r;
}
}
int recs(int num)
{
if(num==0)
return(0);
else
return(num+recs(num-1));
}
e )#include<iostream.h> 3
#include<ctype.h>
f In the following program, if the value of N given by the user is 30, what 2
maximum and
minimum value the program could possibly display ()?
#include<iostream.h>
#include<stdlib.h>
void main( )
{
int N, Guessme;
randomize( );
cin >> N;
Guessme = random(N-10) + 10 ;
cout<<Guessme<<endl;
}
Public Members:
A constructor to assign initial values of TravelCode as 201, Place as ‘Nainital”,
No_of _travellers as 10, No_of_buses as 1.
class Learner
{
char Regno [10], LName [20], Program [10];
Protected :
int Attendance, Grade;
public:
Learner ( );
void LEntry ( );
void LDisplay ( );
};
b An array Arr[15][20] is stored in the memory along the row with each 4
element occupying 4 bytes. Find out the Base Address and address of the
element Arr[3][2], if the element Arr[5][2] is stored at the address 1500.
c write a function in c++ to perform Insert operation in a Dynamic Queue 4
containing DVD’s information( represented with the help of an array of
structure DVD)
struct DVD
{
long no;
char title[20];
DVD *link;
};
4 a Observe the program segment carefully and answer the question that follows - 1
class item
{
int item_no;
char item_name[20];
public:
void enterDetail( );
void showDetail( );
int getItem_no( ){ return item_no ;}
};
void modify(item x, int y )
{
fstream File;
File.open( “item.dat”, ios::binary | ios::in | ios::out) ;
item i;
int recordsRead = 0, found = 0;
while(!found && File.read((char*) &i , sizeof (i)))
{
recordsRead++;
if (i . getItem_no( ) = = y )
{
_________________________//Missing statement
File.write((char*) &x , sizeof (x));
found = 1;
}
}
if (! found)
cout << ”Record for modification does not exist”;
File.close() ;
}
If the function modify( ) is supposed to modify a record in the file “ item.dat “, in
which item_no is y, with the values of item x passed as argument, write the
appropriate statement for the missing statement using seekp( ) or seekg( ),
whichever is needed, in the above code that would write the modified record at
its proper place.
5 a What do you understand by Primary Key & Candidate Keys? Give example 2
b Consider the following tables Employees and EmpSalary. Write SQL commands 6
for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii)
(i) To show firstname,lastname,address and city of all employees living
in Paris
(ii) To display the content of Employees table in descending order of
Firstname.
(iii) To display the firstname, lastname and total salary of all managers
from the tables
Employee and empsalary , where total salary is calculated as
salary+benefits.
(iv) To display the maximum salary among managers and clerks from the
table Empsalary.
Give the Output of following SQL commands:
(v) (Select firstname, salary from employees , empsalary where
designation = ‘Salesman’
and Employees.empid=Empsalary.empid;
(vi) Select count(distinct designation) from empsalary;
(vii) Select designation, sum(salary) from empsalary group by
designation having count(*)
>2;
(viii) Select sum(benefits) from empsalary where designation =’Clerk’;