Anda di halaman 1dari 32

1

KENDRIYA VIDYALAYA

LAB MANUAL

COMPUTER SCIENCE

Index

S . No Content Page no
1 string is Palindrome or not 3
2 Matrices Multiplication 4
3 Class implementation 5
4 calculate employee salary using class implementation 7
5 Function Overloading to calculate A ^B. 13
6 Count alphabet in text file 15
7 Count blank space in text file 16
8 Append data in Binary file 17
9 Read from Binary File 18
10 Linear search 20
11 Binary Search 21
12 Bubble Sort 23
13 Selection Sort 26
14 Insertion in Beginning of Linked List 29
15 Deletion in Linked List 30
16 Static Implementation of Stack 32
17 Dynamic Implementation of Stack 34
18 Static Implementation of Queue 37
19 Dynamic Implementation of Queue 39
20 SQL query 40
21 SQL query 40
22 SQL query 40
23 SQL query 40
24 SQL query 40
25 K map 41

Computer Science Manual Class XII


2

Program 1.C++ program to find a string is Palindrome or not.

#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
char string[80], c;
cout<<"\n Enter a string(max.79 character):";
cin.getline(string,80);
for(int len=0;string[len]!='\0';++len);
int i,j,flag=1;
for(i=0,j=len-1;i<len/2;++i,--j)
{
if(string[i]!=string[j])
{
flag=0;
break;
}
}
if(flag)
cout<<"It Is Palindrome\n";
else
cout<<"It Is Not A Palindrome\n";
getch();
return 0;
}

Computer Science Manual Class XII


3

______________________
Program 2 . C++ program of Matrices Multiplication
#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{clrscr();
int a[10][10],b[10][10],c[10][10],m,n,i,j,p,q;
cout<<"\nEnter the row and column of matrix-A:";
cin>>m>>n;
cout<<"\nEnter the row and column of matrix-B:";
cin>>p>>q;
if(n==p)
cout<<"Matrices can be multiplied\n";
else
{ cout<<"Matrices cannot be multiplied\n";
getch();
exit(0);
}
cout<<"\nInput matrix-A:\n";
for(i=0;i<m;i++)
{ for(j=0;j<n;j++)
cin>>a[i][j];
}
cout<<"\nInput matrix-B:\n";
for(i=0;i<p;i++)
{ for(j=0;j<q;j++)
cin>>b[i][j];
}
for(i=0;i<m;i++)

Computer Science Manual Class XII


4

for(j=0;j<q;j++)
{ c[i][j]=0;
for(int ip=0;ip<n;++ip)
c[i][j]+=(a[i][ip]*b[ip][j]);
}
cout<<"\nThe product of matrices is:\n";
for(i=0;i<m;i++)
{ cout<<"\n";
for(j=0;j<q;j++)
cout<<" "<<c[i][j];
}
getch();
}

3. Program in C++ to implement class.


#include<iostream.h>
#include<conio.h>
class num
{
int x;
float y;
public:
void init()
{
x=y=0;
}
void read(int i,int j)
{ x=i;
y=j;
}
void display()

Computer Science Manual Class XII


5

{
cout<<"x="<<x<<"\n"<<"y="<<y<<"\n";
}
};
void main()
{
clrscr();
num obj1,obj2;
obj1.init();
obj2.init();
obj1.read(15,11);
obj1.display();
obj2.display();
getch();
}

_______________________________

Program 4. C++ program to calculate employee salary using class implementation


#include<iostream.h>
#include<conio.h>
class emp
{
private:
float pay,total;
char name[50];
public:
void getdata()
{ cout<<"enter name:";
cin>>name;
cout<<"enter monthly payement:";
cin>>pay;
}

Computer Science Manual Class XII


6

void display()
{ total=pay*12;
cout<<"\nEntered date is:\nname="<<name<<"\nmonthly payement="<<pay<<"\nannual
income="<<total;
}
};
void main()
{ clrscr();
emp t1;
t1.getdata();
t1.display();
getch();
}

__________________________________________
Program 5 C++ Program to add two matrices
#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{clrscr();
int a[10][10],b[10][10],c[10][10],m,n,i,j,p,q;
cout<<"\nEnter the row and column of matrix-A:";
cin>>m>>n;
cout<<"\nEnter the row and column of matrix-B:";
cin>>p>>q;
if((m==p)&&(n==q))
cout<<"Matrices can be added\n";
else
{ cout<<"Matrices cannot be added\n";
getch();
exit(0);
}

Computer Science Manual Class XII


7

cout<<"\nInput matrix-A:\n";
for(i=0;i<m;i++)
{ for(j=0;j<n;j++)
cin>>a[i][j];
}
cout<<"\nInput matrix-B:\n";
for(i=0;i<p;i++)
{ for(j=0;j<q;j++)
cin>>b[i][j];
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
c[i][j]=a[i][j]+b[i][j];
}
cout<<"\nThe sum of matrices is:\n";
for(i=0;i<m;i++)
{ cout<<"\n";
for(j=0;j<n;j++)
cout<<" "<<c[i][j];
}
getch();
}

___________________________________________________________
Program 6. C++ program to Multiple Inheritance
/* Program to define the classes PERSON, GAME and STUDENT & to access the essential data using
multiple inheritance.*/

#include<iostream.h>
#include<stdio.h>
#include<conio.h>

Computer Science Manual Class XII


8

class person{ char name[21];


int age;
public:
void indata()
{cout<<"\n\nEnter the name of Student: " ;
gets(name);
cout<<"\n\nEnter the age : ";
cin>>age;
}
void outdata();

};

void person::outdata() // since the function contains loop so it is not made inline
{
cout<<"\n\n";
for(int i=0; i<79; i++)
cout<<"-";
cout<<"\n\nName of the student is: "<<name;
cout<<"\n\nAge of the student is : "<<age;

class game {
char game_name[20];
public:
void input()
{
cout<<"\n\nEnter the game name : ";
cin.get();cin.getline(game_name,20);
}
void output()
{
cout<<"\n\nGame opted by the student is : "<<game_name;
}
};

class student: public person, public game


{ float Tmarks;
int rollno;
public:
char calgrade()
{if(Tmarks>90)
return 'A';
else if(Tmarks>80&&Tmarks<=90)
return 'B';
else if(Tmarks>70&&Tmarks<=80)
return 'C';
else if(Tmarks>60&&Tmarks<=70)
return 'D';
else
return 'E';
}
void enter()
{

Computer Science Manual Class XII


9

indata(); // indata() of class person called here

cout<<"\n\nEnter the roll number: "; cin>>rollno;

input(); // input() of class game called here

cout<<"\n\nEnter total marks (out of 100) : ";


cin>>Tmarks;

}
void display()
{
outdata();
cout<<"\n\nRoll number : "<<rollno;
output();
cout<<"\n\nTotal marks are : "<<Tmarks;
cout<<"\n\nGrade = "<<calgrade();
}
};

void main()
{ clrscr();
student A;
A.enter();
A.display();
getch();
}

_______________________________________________________
Program 7. C++ program using Function Overloading to calculate A ^B.
/* WAP USING FUNCTION OVERLOADING TO CALCULATE A^B */

Computer Science Manual Class XII


10

#include<iostream.h>
#include<math.h>
#include<conio.h>

int calc(int a, int b)


{
return pow(a,b);
}

float calc(float a, float b)


{
return pow(a,b);
}

float calc(int a, float b)


{
return pow(a,b);
}
float calc(float a, int b)
{
return pow(a,b);
}

void main()
{clrscr();

int P,Q;
float R,S;

cout<<"Enter int P : "; cin>>P;


cout<<"Enter int Q : "; cin>>Q;
cout<<"Enter real R : "; cin>>R;
cout<<"Enter real S : "; cin>>S;

cout<<P<<"^"<<Q<<" = "<<pow(P,Q)<<"\n\n";
cout<<P<<"^"<<R<<" = "<<pow(P,R)<<"\n\n";
cout<<R<<"^"<<Q<<" = "<<pow(R,Q)<<"\n\n";
cout<<R<<"^"<<S<<" = "<<pow(R,S);

getch();
}

Computer Science Manual Class XII


11

____________________________________
Program 8. C++ Program to count total no of alphabet in text file .
#include<iostream.h>
#include<fstream.h>
#include<ctype.h>
#include<conio.h>
void display()
{
ifstream fin;
fin.open("STORY.TXT");
char ch;
int c=0;
while(fin)
{
fin.get(ch);
if(isalpha(ch))
c++;
}
cout<<"The number of alphabets are:"<<c;
fin.close();
}
void main()
{ clrscr();
display();
getch();
}

Computer Science Manual Class XII


12

___
Program 9. C++ Program to count total no of blank space in text file .

#include<iostream.h>
#include<fstream.h>
#include<ctype.h>
#include<conio.h>
void display()
{
ifstream fin;
fin.open("NOTE.TXT");
char ch;
int c=0;
while(fin)
{
fin.get(ch);
if(ch==' ')
c++;
}
cout<<"The number of blank spaces are:"<<c;
fin.close();
}
void main()
{ clrscr();
display();
getch();
}

Computer Science Manual Class XII


13

_____________
Program 10. To append data in Binary File
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
class stu
{ int rollno;
char name[25];
char Class[4];
float marks;
char grade;
public:
void getdata()
{
cout<<"Rollno:"; cin>>rollno;
cout<<"Name:"; cin>>name;
cout<<"Class:"; cin>>Class;
cout<<"Marks:"; cin>>marks;
if(marks>=75) grade='A';
else if(marks>=60) grade='B';
else if(marks>=50) grade='C';
else if(marks>=40) grade='D';
else grade='F';
}
void putdata()
{
cout<<name<<",rollno"<<rollno<<"has"<<marks
<<"%marks and"<<grade<<"grade."<<endl;
}
int getrno()
{
return rollno;
}
}s1;

Computer Science Manual Class XII


14

void main()
{
ofstream fo("stu.dat",ios::app);
char ans='y';
while(ans=='y')
{
s1.getdata();
fo.write((char*)&s1,sizeof(s1));
cout<<"Record added to file.\n";
cout<<"Want to enter more record?(y/n):";
cin>>ans;
}
fo.close();
getch();
}

__________
Program 11- Read from Binary File

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
struct customer
{ char name[51];
float balance;
};
void main()
{
clrscr();
customer savac;

Computer Science Manual Class XII


15

strcpy(savac.name,"Tina Marshall");
savac.balance=21310.75;
ofstream fout;
fout.open("Saving",ios::out|ios::binary);
if(!fout)
{
cout<<"file cannot be opened.\n";

}
fout.write((char*)&savac,sizeof(customer));
fout.close();
ifstream fin;
fin.open("Saving",ios::in|ios::binary);
fin.read((char*)&savac,sizeof(customer));
cout<<savac.name;
cout<<"has the balance amount of Rs."<<savac.balance<<"\n";
fin.close();
getch();
}

__________________

Program 12. C++ program - Linear Search


#include<iostream.h>
#include<conio.h>
int Lsearch(int[],int,int);
void main()
{ clrscr();
int AR[50],item,n,index;
cout<<"Enter the size of array(amx.50):";
cin>>n;
cout<<"\nEnter the element of array\n:";
for(int i=0;i<n;i++)
{
cin>>AR[i];

Computer Science Manual Class XII


16

}
cout<<"\nEnter element to be search for:";
cin>>item;
index=Lsearch(AR,n,item);
if(index==-1)
cout<<"\nSorry!! given element not found.\n";
else
cout<<"\nElement found at index:"<<index<<",Position:"<<index+1;
getch();
}
int Lsearch(int AR[],int size,int item)
{
for(int i=0;i<size;i++)
{
if(AR[i]==item)
return i;
}
getch();
return -1;
}

_______________________

Program 13. C++ program using Binary Search


#include<iostream.h>
#include<conio.h>
int Bsearch(int [],int,int);
void main()
{clrscr();
int AR[50],item,n,index;
cout<<"\nEnter the size of array(max.50):";
cin>>n;
cout<<"\nEnter the element of array(must be sorted in Asc or Desc order):";
for(int i=0;i<n;i++)
cin>>AR[i];
cout<<"\nEnter element to be search for:";

Computer Science Manual Class XII


17

cin>>item;
index=Bsearch(AR,n,item);
if(index==-1)
cout<<"\nSorry!! given element not found.";
else
cout<<"\nElement found at index:"<<index<<",Positon:"<<index+1;
getch();
}
int Bsearch(int AR[],int size,int item)
{
int beg,last,mid;
beg=0;
last=size-1;
while(beg<=last)
{
mid=(beg+last)/2;
if(item==AR[mid])
return mid;
else
if(item>AR[mid])
beg=mid+1;
else
last=mid-1;
}
getch();
return -1;
}

__________________________________________________
Program 14. Bubble Sort
#include<iostream.h>
#include<conio.h>
void BubbleSort(int [],int);
void main()

Computer Science Manual Class XII


18

{clrscr();
int AR[50],item,n,index;
cout<<"Enter the size of array(max.50):";
cin>>n;
cout<<"\nEnter the elements of array:\n";
for(int i=0;i<n;i++)
cin>>AR[i];
BubbleSort(AR,n);
cout<<"\nThe sorted array is as shown below:\n";
for(i=0;i<n;i++)
cout<<AR[i]<<" ";
cout<<endl;
getch();
}
void BubbleSort(int AR[],int size)
{
int tmp,ctr=0;
for(int i=0;i<size;i++)
{ for(int j=0;j<(size-1);j++)
{
if(AR[j]>AR[j+1])
{ tmp=AR[j];
AR[j]=AR[j+1];
AR[j+1]=tmp;
}
}
cout<<"Array after iteration-"<<++ctr<<"-is:";
for(int k=0;k<size;k++)
cout<<AR[k]<<" ";
cout<<endl;
}
getch();
}

Computer Science Manual Class XII


19

__________________________________________
Program 15- Program to sort an array using Selection Sort

#include<iostream.h>
#include<conio.h>
void SelSort(int [],int);
void main()
{ clrscr();
int AR[50],item,n,index;
cout<<"Enter the size of array(max.50):";
cin>>n;
cout<<"\nEnter the elements of array:";
for(int i=0;i<n;i++)
cin>>AR[i];
SelSort(AR,n);
cout<<"\nThe sorted array is shown below:";
for(i=0;i<n;i++)
cout<<AR[i]<<" ";
cout<<endl;
getch();
}
void SelSort(int AR[],int size)
{
int small,pos,tmp;
for(int i=0;i<size;i++)
{ small=AR[i];
for(int j=i+1;j<size;j++)
{ if(AR[j]<small)
{small=AR[j];
pos=j;
}
}
tmp=AR[i];
AR[i]=AR[pos];
AR[pos]=tmp;
cout<<"\nArray after pass-"<<i+1<<"-is:";
for(j=0;j<size;j++)
cout<<AR[j]<<" ";
}
getch();
}

Computer Science Manual Class XII


20

__________________--
Program 16:- Inserting element in beginning of list .
#include<iostream.h>
#include<conio.h>
#include<process.h>
struct Node
{
int info;
Node * next;
}*start,*newptr,*save,*ptr;
Node * Create_New_Node(int);
void Insert_Beg(Node*);
void Display(Node*);
void main()
{ start=NULL;
int inf;
char ch='y';
clrscr();
while(ch=='y'||ch=='Y')
{
cout<<"\n Enter information for the new node....";
cin>>inf;
cout<<"\n Creating New Node!! Press Enter to continue...";
getch();
newptr=Create_New_Node(inf);
if(newptr!=NULL)
{ cout<<"\n\nNew Node Created Successfully. Press Enter to continue....";
getch();
}
else

Computer Science Manual Class XII


21

{
cout<<"\nCannot create new node!!! Aborting!!\n";
getch();
exit(1);
}
cout<<"\n\nNow inserting this node in the beginning of list....\n";
cout<<"Press Enter to continue....\n";
getch();
Insert_Beg(newptr);
cout<<"\nNow the list is:\n";
Display(start);
cout<<"\n Press Y toenter more node, N to exit...";
cin>>ch;
}
}
Node * Create_New_Node(int n)
{
ptr = new Node;
ptr -> info = n;
ptr -> next = NULL;
return ptr;
}
void Insert_Beg(Node* np)
{
if(start==NULL)
start = np;
else
{
save = start;
start = np;
np -> next = save;
}
}
void Display(Node* np)
{
while(np!=NULL)
{
cout<<np -> info <<"->";
np = np -> next;
}
cout<<"!!!!\n";
}

Computer Science Manual Class XII


22

_______________________________
Program 17 - Delete element from Linked List
#include<iostream.h>
#include<conio.h>
#include<process.h>
struct Node
{
int info;
Node * next;
}*start,*newptr,*save,*ptr,*rear;
Node * Create_New_Node(int);
void Insert(Node*);
void Display(Node*);
void DelNode();
void main()
{ start=rear=NULL;
int inf;
char ch='y';
while(ch=='y'||ch=='Y')
{
cout<<"\n Enter information for the new node....";
cin>>inf;
newptr=Create_New_Node(inf);
if(newptr==NULL)
{
cout<<"\nCannot create new node!!! Aborting!!\n";
getch();
exit(1);
}
Insert(newptr);

Computer Science Manual Class XII


23

cout<<"\n Press Y toenter more node, N to exit...";


cin>>ch;
}
clrscr();
do
{
cout<<"\nThe List now is:\n";
Display(start);
getch();
cout<<"Want to delete first node?(y/n)....";
cin>>ch;
if(ch=='y'||ch=='Y')
DelNode();
}while(ch=='y'||ch=='Y');
}
Node * Create_New_Node(int n)
{
ptr = new Node;
ptr -> info = n;
ptr -> next = NULL;
return ptr;
}
void Insert(Node* np)
{
if(start==NULL)
start = rear = np;
else
{
rear -> next = np;
rear = np;
}
}
void DelNode()
{
if(start == NULL)
cout<<" UNDERFLOW!!!\n";
else
{
ptr = start;
start= start -> next;
delete ptr;
}
}
void Display(Node* np)
{
while(np!=NULL)
{
cout<<np -> info <<"->";
np = np -> next;

Computer Science Manual Class XII


24

}
cout<<"!!!!\n";
}

_____________________________________________
Program 18- Static Implementation of Stack using Array
#include<iostream.h>
#include<conio.h>
#include<process.h>
int Push(int [],int&,int);
void Display(int [], int);
const int size=50;
void main()
{
int Stack[size],item,top=-1,res;
char ch='y';
clrscr();
while(ch=='y'||ch=='Y')
{
cout<<"\n Enter item for insertion:";
cin>>item;
res=Push(Stack,top,item);
if(res==-1)
{
cout<<"OVERFLOW!!! ABORTING!!\n";
exit(1);
}
cout<<"\n The Stack now is:\n";
Display(Stack,top);
cout<<"\nWant to insert more elements?(y/n):";
cin>>ch;

Computer Science Manual Class XII


25

}
}
int Push(int Stack[],int & top,int ele)
{
if(top==size-1)
return -1;
else
{ top++;
Stack[top]=ele;
}
getch();
return 0;
}
void Display(int Stack[], int top)
{
cout<<Stack[top]<<"<--"<<endl;
for(int i=top-1;i>=0;i--)
cout<<Stack[i]<<endl;
getch();
}

_____________________________________________
Program 19- Dynamic Implementation Stack Using Linked List
#include<iostream.h>
#include<conio.h>
#include<process.h>
struct Node
{
int info;
Node * next;

Computer Science Manual Class XII


26

}*top,*newptr,*save,*ptr;
Node * Create_New_Node(int);
void Push(Node*);
void Display(Node*);
void main()
{
int inf;
char ch='y';
top=NULL;
clrscr();
while(ch=='y'||ch=='Y')
{
cout<<"\n Enter information for the new node....";
cin>>inf;
newptr=Create_New_Node(inf);
if(newptr==NULL)
{
cout<<"\nCannot create new node!!! Aborting!!\n";
exit(1);
}
Push(newptr);
cout<<"\nNow linked-stack is:\n";
Display(top);
cout<<"\n Press Y toenter more node, N to exit...";
cin>>ch;
}
}
Node * Create_New_Node(int n)
{
ptr = new Node;
ptr -> info = n; ptr -> next = NULL;
return ptr;
}
void Push(Node* np)
{
if(top==NULL) top = np;
else
{
save = top; top = np;
np -> next = save;
}
}
void Display(Node* np)
{
while(np!=NULL)
{
cout<<np -> info <<"->";
np = np -> next;
}

Computer Science Manual Class XII


27

cout<<"!!!!\n";
}

_________________________________________________
Program 20- Program to implement queue statically ( array )
#include<iostream.h>
#include<conio.h>
#include<process.h>
int Insert_in_Q(int [],int);
void Display(int [],int,int);
const int size=50;
int Queue[size],front=-1,rear=-1;
void main()
{
int item,res;
char ch='y';
clrscr();
while(ch=='y'||ch=='Y')
{
cout<<"\n Enter item for insertion:";
cin>>item;
res=Insert_in_Q(Queue,item);
if(res==-1)
{
cout<<"OVERFLOW!!! ABORTING!!\n";
exit(1);
}
cout<<"\n Now the Queue(Front to Rear) is:\n";
Display(Queue,front,rear);

Computer Science Manual Class XII


28

cout<<"\nWant to insert more elements?(y/n):";


cin>>ch;
}
}
int Insert_in_Q(int Queue[],int ele)
{
if(rear==size-1)
return -1;
else if(rear==-1)
{ front=rear=0;
Queue[rear]=ele;
}
else
{ rear++;
Queue[rear]=ele;
}
getch();
return 0;
}
void Display(int Queue[], int front, int rear)
{
if(front==-1)
return;
for(int i=front;i<rear;i++)
cout<<Queue[i]<<"<-\t";
cout<<Queue[rear]<<endl;
getch();
}

____________________________________

Computer Science Manual Class XII


29

Program 21 – Dynamic Implementation of Queue using Linked List

#include<iostream.h>
#include<conio.h>
#include<process.h>
struct Node
{
int info;
Node * next;
}*front,*newptr,*save,*ptr,*rear;
Node * Create_New_Node(int);
void Insert_End(Node*);
void Display(Node*);
void main()
{ front=rear=NULL;
int inf;
char ch='y';
clrscr();
while(ch=='y'||ch=='Y')
{
cout<<"\n Enter information for the new node....";
cin>>inf;
newptr=Create_New_Node(inf);
if(newptr==NULL)
{
cout<<"\nCannot create new node!!! Aborting!!\n";
exit(1);
}
Insert_End(newptr);
cout<<"\nNow the Queue(front to rear) is:\n";
Display(front);
cout<<"\n Press Y toenter more node, N to exit...";
cin>>ch;
}
}
Node * Create_New_Node(int n)
{
ptr = new Node;
ptr -> info = n; ptr -> next = NULL;
return ptr;
}
void Insert_End(Node* np)
{
if(front==NULL) front = rear = np;
else
{
rear -> next = np;
rear = np;
}

Computer Science Manual Class XII


30

}
void Display(Node* np)
{
while(np!=NULL)
{
cout<<np -> info <<"->";
np = np -> next;
}
cout<<"!!!!\n";
}

________

Answer the Following questions based upon on SQL

Q1. Write SQL command for (a) to (f) and write output of SQL command given in (g) with the help of table
shown below:

S.no. Title Author Type Pub Qty Price


1 Data Structure Lipschutz DS Mcgraw 4 217
2 Computer Studies French FND Galgotia 2 75
3 Advanced Pascal Schildt PROG Mcgraw 4 350
4 Dbase Dummies Palmer DBMS PustakM 5 130
5 Mastering C++ Guerewish PROG BPB 3 295
6 Guide Network Freed NET ZPress 3 200
7 Mastering Foxpro Seigal DBMS BPB 2 135
8 DOS Guiede Norton OS PHI 3 175
9 Basic of Beginner Morton PROG BPB 3 40
10 Mastering Window Cowart OS BPB 1 225

Computer Science Manual Class XII


31

a) Select all the PROG type published by BPB from Library.


b) Display a list of all books with Price more than 130 and sorted by Qty.
c) Display all books sorted by Price in ascending order.
d) Display all report, listing books title, current value and misplacement charges for each book in above
table.
Calculate the misplacement charges for all books price*1.25.
e) Count the number of books in above table. Fill all the column with values.
f) Insert a new book in Library table. Fill all column with valus.
g) Give the output of following SQL command on the basis of table Library
1. Select MIN(Price) from Library where Price<150;
2. Select AVG(Price) from Library where Qty<3;
3. Select COUNT(DISTINCT Pub) from Library;
Answer :
a) SELECT Type
FROM Library
WHERE(Type=’PROG’AND Pub=’BPB’);
b) SELECT Title ‘BOOKS’,
FROM Library
WHERE Price>130
ORDER BY Qty;
c) SELECT Title ‘BOOKS’,
FROM Library
ORDER BY Price ASC;
d) SELECT Title ‘BOOKS’, Price “Current Value”, Price*1.25”Misplacement Charges”
FROM Library;
e) SELECT Count(Title)
FROM Library
WHERE Pub=’PHI’;
f) INSERT INTO Library
VALUES(“Exploring C”,”Yashwant”,”PROG”,”BPB”,3,230);
g) 1.40
2.145
3.6
_______________________________________________________________
K Map – SOP (Sum of Product ) using F summation F=(0,1,3,5,7,12,10,11,13,14,15)

Simplified form of above K Map is

Computer Science Manual Class XII


32

F= ab+ac+a’d+a’b’c’

------------------------ *****************-----------------------***************---

Computer Science Manual Class XII

Anda mungkin juga menyukai