![Important Questions](../../../../../images/headings/important_question.gif)
CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Naveen Gupta
CBSE CLASS XII
![](../../../../../images/index.gif)
a. Write a function to update the file with a new value of No_of_people. The value of colony_code and no_of_people are read during the execution of the program.
b. Write a function in c++ to copy all the lines from file text1.text into text2.txt which is starting from ‘A’ letter. Assuming that each and every line does not exceed from 50 characters.
c. Differentiate between read() and write() function.
d. Following program intends to display a text file with each word in new line.
#include<fstream.h>
void main()
{
ifstream fin(“abc.txt”);
char word[20];
while( !fin.eof() )
{
_______________ //statement 1
cout<<word<<endl;
}
_______________ //statement 2
}
Complete the above program by providing missing functionality.
e. Observe the program segment given below carefully and fill in the blanks marked as statment1 and statement2 using write() and remove() functions for performing the required task.
#include<fstream.h>
class Emp
{
int Eno;
char name[20];
public :
//function which will delete the data of a specific employee
void deleteRec(int Eid);
};
void Emp::deleteRec(int Eid)
{
fstream file;
file.open(“Emp.dat”,ios::in|ios::out|ios::binary);
ofstream ofile(“temp.dat”);
while(file)
{
file.read((char *)this,sizeof(eobj));
if(this->Eno !=Eid)
_________________//statement1
}
________________//statement 2
rename(“temp.dat”,”emp.dat”);
}
Q. 6. a. What is a relation? What is the difference between a tuple and an attribute?
(b) Consider the following tables EMPLOYEE and DESIG. Write SQL commands for the statements (i) to (vi) and give outputs for SQL queries (vii) to (x)
EMPLOYEE
W_ID |
FIRSTNAME |
LASTNAME |
CITY |
102 |
AAM |
TONES |
PARIS |
105 |
SARAH |
ACKERMAN |
NEW YORK |
144 |
MANILA |
SENGUPTA |
NEW DELHI |
210 |
GEORGE |
SMITH |
HOWARD |
255 |
MARY |
JONES |
HUSTON |
300 |
ROBERT |
SAMUEL |
WASHINGTON |
335 |
HENRY |
WILLIAMS |
BOSTON |
400 |
RONNY |
LEE |
NEW YORK |
451 |
PAT |
THOMPSON |
PARIS |
DESIG
W_ID |
SALARY |
BENEFITS |
DESIGNATION |
102 |
75000 |
15000 |
MANAGER |
105 |
85000 |
25000 |
DIRECTOR |
144 |
70000 |
15000 |
MANAGER |
210 |
75000 |
12500 |
MANAGER |
255 |
50000 |
12000 |
CLERK |
300 |
45000 |
10000 |
CLERK |
335 |
40000 |
10000 |
CLERK |
400 |
32000 |
7500 |
SALESMAN |
451 |
28000 |
7500 |
SALESMAN |
- Display FirstName and City of Employee having salary between 50,000 and 90,000
- Display details of Employees who are from “PARIS” city.
- Increase the benefits of employee having W_ID = 210 by 500.
- Count number of employees whose name starts from character ‘S’ or ‘M’.
- List all the employee names who are earning more than 50000 as salary.
- Display the salary and benefits designation wise.
- Select MAX(salary) from desig;
- Select FirstName from employee, desig where designation = ‘MANAGER’ AND employee.W_ID = desig.W_ID;
- Select COUNT (DISTINCT designation) from desig;
- Select designation, SUM(salary) from desig Group by designation Having count (*) > 2;
![](../../../../../images/index.gif)
Paper By Mr. Naveen Gupta
Email Id : [email protected] |