You are on page 1of 9

# define is preprocessor directiveand can be used to declare a macro const can not define a macro #define can not

be used to declare an array const can be used to declare an array b. iostream.h iomanip.h c class SCHOOL { int School_id; Char *n; SCHOOL() { School_id =1;strcpy(n,\0);} public: void getd() { cin>>school_id; gets(n); } void show() { cout<<school_id<<\t<<n<<\n; } }; void main() { SCHOOL s; s.show(); } d. 1 7 1 7 e. 55 56 57 f. 14 18 22 14 18 22 26 2a Data Abstraction refers to the activity of representing essential features of real world object without including the background details. This activity of representing essential features of an object in the form of public interface is known as data abstraction. E.g. In a switch board , We know switches are to be pressed to switch on the light without knowing wiring inside the switch board b i) function1 is default constructor function2 is a parameterized constructor void main() { book b; char bn[20]; int b;float p; gets(bn); cin>>p>>b;

1a

book b1(b,bn,p); } ii) Book details1-100 class tour { int tour-id; char place[20]; int number_of_tourists int number_of_buses double charges_per-bus double cal_cost() { double total_charges; if(number_of_tourists<20) number_of_buses=1; else if(number_of_tourists<40) number_of_buses=2; else number_of_buses=3; total_charges=number_of buses*charges_per_bus; return(total_charges); } public: void newdata() { cin>>tour-id; gets(place); cin>>number_of_tourists; cin>>number_of_buses; cin>>charges_per-bus; } void showdata() { cout<<tour-id; puts(place); cout<<number_of_tourists; cout<<number_of_buses; cout<<charges_per-bus; cout<<the total cost<<cal_cost(); } i) Multiple inheritance.96 bytes will be required by object of class exam. ii) exam_data(),show(),getp(),showp(); iii) showp(); iv) Yes function getp() is accessible inside the exam_data() because in public inheritance public member functions remain public. void sortscore( sports s[], int size) {
int pos ,i,j; sports small,temp;

3a

for(i=0;i<size;i++) { for(j=0;j<(size-1)-i;j++) { if(s[j].retp() < s[j+1].retp()) { temp=s[j]; s[j]=s[j+1]; s[j+1]=temp; } } } }

=B+W((I-lb)+M(J-lb)) M=30 N=30 W=4 lb=0 7200=B+4((15-0)+40(10-0)) B+4*415=7200 B=5540 A[20][15]=5540+4((15-0)*40+(20-0)) =5540+5480 =8020 void alternate(a[][30],n,m) { int k=0; for(int i=0,;i<n;i++) for(int j=0;j<m;j++,) { if(k%2==0) a[i][j]=2*a[i][j]; k++; } for(int i=0,;i<n;i++) { { for(int j=0;j<m;j++,) cout<<a[i][j]; } cout<<endl; }

d # include <iostream.h> # include <conio.h> # include <string.h> # include <stdio.h> struct emp

{ int emp_no; char name[20]; }; class employee { emp s1; public: employee*next; void getdata() { cout<<"enter the data"<<"\n"; cin>>s1.emp_no; gets(s1.name); newptr->next=NULL; } void showdata() { cout<<"the employee no is"<<s1.emp_no<<"\n"; cout<<" the employee name is"<<s1.name<<"\n"; } void push(); void pop(); void traverse(); }; employee * top=NULL; employee* newptr; employee* ptr; void employee ::push() { if(top==NULL) { newptr=new employee; newptr->getdata(); top=newptr; } else { newptr=new employee; ` newptr->getdata(); newptr->next=top; top=newptr; } } void employee::pop() { if(top==NULL)

cout<<"stack not existing"<<"\n"; else { ptr=top; top=top->next; delete ptr; cout<<" one node deleted"<<"\n"; } } void employee ::traverse() { ptr=top; while(ptr!=NULL) { ptr->showdata(); ptr=ptr->next; } } void main() { clrscr(); employee s1; char ch,ch1; do { cout<<"enter the choice"<<"\n"; cin>>ch; switch(ch) { case 'a': s1.push(); break; case 'b' : s1.pop(); break; case 'c' : s1.traverse(); } cout<<"do yu wish to continue"<<"\n"; cin>>ch1; } while(ch1=='y'|| ch1=='Y'); getche(); } 6.a. (X+Y)(X+Y) = XX+XY+XY+YY = XY+XY b. U+V)VW c xyz+xyz+xyz d

XX=0

f 7a

Quad(5,7,13,15) = BD Quad(0,2,8,10) = BD Pair(0,1)=ABC Simplified expression = BD+BD+ABC 011+110++000+111 (0,3,6,7) (1,2,4,5) (001,010,100,101) (A+B+C).(A+B+C)(A+B+C)(A+B+C) A.A+B.B Html stands for hyper text markup language and is used to create webpages PPP stands for point to point protocol . PPP is the protocol in the Internet Standard used to connect telephone dial-up lines to internet. The communication takes place through a high speed modem. This protocol allows a temporary IP address to be assigned by internet to the computer and the communication takes place Hub is a hardware device used to connect several computers together. In data communications, a hub is a place where data arrives from one or more directions and is redirected to different destinations. A Hacker is a person who has enough knowledge to break into a computer system, although he or she does not cause any harm to the system. A hacker can help an organization by informing that there are some security lapses. The Crackers are the malicious programmers who break into secure systems with wrong intentions.Crackers are considered as criminals as they break into secured system to cause damage. a The bus topology should be used and the cable layout is C E A B D Wing distance (km) C-E 50 E-A 75 A-B 100 B-D 50 b In Wing C the server should be installed. c i) Repeater is not required ii)Hub/Switch should be installed in all the blocks. d Broadband communication with a proxy server in wing C should be used for economically viable internet accessibility. e false true not or true false and or

Step 1 2 3 4

Input false true not or

5 6 7

true false and

or

Action Push Push pop true Not true pop false pop false false or false push false push push pop false pop true false and true push false pop false pop false false or false push false

Stack status false false true false false false false empty false false true false true false false true false false false false false empty false

The answer is false 4 a file.tellp(-1*sizeof(i1),ios::cur) file.write((char*)&i1,sizeof(i1)) b void count() { clrscr(); char s[80];int sp=0; char ans='y'; ifstream infile("special"); char ch; while (!infile.eof()) { ch=infile.get(); if (!isalnum(ch)) //check for word sp++; } infile.close(); cout<<"\nno ofspecial character- "<<sp; } c class item { int it_no; char n[20],category[10]; float price; public: void getdata(); void chargeprice(); void refit_no();

char * ret_cat( ) { return category; } void showdata() { cout<<it_no; puts(n); puts(category); cout<<price; }; void display() { fstream f; item i,c=0; f.open(item.dat;ios::binary|ios::in); while(f.read((char*)&i sizeof(i))) { if(strcmp(i.ret_cat, oil)==0) { c++; i.showdata(); } } cout<<the total number of oil category items<<c; f.close(); } RDMS stands for relational database management system.It is a software used for the creation, manipulation and management of relational databases. Primary key is the attribute of the table which uniquely identifies each row in the table. We can have only one primary key in a table.Candidate key are the all possible attributes which are capable of being the primary key in a table. i) Select empid,name,salary from employee employee order by name desc ii) select count(*) from employee where salary>10000 iii)select max(salary) from employee group by dept_id iv)select empid,name,dept_name from employee,department where employee.dept_id=department.dept_id v) 4 vi) manager 4000 vii) 1700 8000 viii) 15666.6 XX+XY+XY (U+V).VW

5a b

6a b

You might also like